Example #1
0
def getdbdatas(sql):
    if con_params == None: return None
    try:
        datas = mysql_utils.execute_fetchall(sql, con_params)
        return datas
    except:
        print traceback.format_exc()
def getdbdatas(i, size):
    print i
    print size
    if con_params == None: return None
    #sql = 'select pkg_name, name, version_name, version_code, public_key, virus_name, reason, reason_en, rom_category,status from an_db_lists a where trashed = \'0\' and status = \'1\' limit %d, %d ' %(i,size)
    sql = 'select pkg_name, name, version_name, version_code, public_key, virus_name, reason, reason_en, rom_category,status from an_db_lists a where status = \'3\' and trashed = \'0\' limit %d, %d ' %(i,size)
    try:
        datas = mysql_utils.execute_fetchall(sql, con_params)
        result = ''
        for r in datas:
            pkg_name = r[0] if r[0] != None else ''
            name = r[1] if r[1] != None else ''
            version_name = r[2] if r[2] != None else ''
            version_code = r[3] if r[3] != None else ''
            public_key = r[4] if r[4] != None else ''
            virus_name = r[5] if r[5] != None else ''
            reason = r[6] if r[6] != None else ''
            reason_en = r[7] if r[7] != None else ''
            rom_category = r[8] if r[8] != None else '' 
            status = r[9] if r[9] != None else ''
            result += pkg_name+_SPLIT_STR_+ public_key + _RETURNLINE_STR_
        with codecs.open(getfilename(), 'a+', 'utf-8') as f:
            f.write(result)
    except:
        print traceback.format_exc()
def getfilename():
    t = time.localtime(time.time())
    dateStr = time.strftime('%Y%m%d',t)
    sql = 'select version from rogue_website_versions a where actived = \'1\' '
    datas = mysql_utils.execute_fetchall(sql, con_params)
    version = None
    for r in datas:
        version = r[0] if r[0] != None else ''
    filename = _ROGUE_WEBSITE_INIT_FILE %(dateStr, version)
    return filename
def getfilename():
    t = time.localtime(time.time())
    dateStr = time.strftime('%Y%m%d',t)
    sql = 'select version from sy_security_versions a where actived = \'1\' '
    datas = mysql_utils.execute_fetchall(sql, con_params)
    version = None
    for r in datas:
        version = r[0] if r[0] != None else ''
    filename = _ANDROID_SECURITY_INIT_FILE %(dateStr, version)
    return filename
def getdbdatas(i, size):
    if con_params == None: return None
    sql = 'select url from rogue_websites a where trashed = \'0\' limit %d, %d ' %(i,size)
    try:
        datas = mysql_utils.execute_fetchall(sql, con_params)
        result = ''
        for r in datas:
            url = r[0] if r[0] != None else ''
            result += '+' +_SPLIT_STR_ + url + _RETURNLINE_STR_
        with open(getfilename(), 'a+') as f:
            f.write(result)
    except:
        print traceback.format_exc()
def getdbdatas(i, size):
    if con_params == None: return None
    sql = 'select public_key, virus_name, status from an_pkey_securities a where trashed = \'0\' limit %d, %d ' %(i,size)
    try:
        datas = mysql_utils.execute_fetchall(sql, con_params)
        result = ''
        for r in datas:
            public_key = r[0] if r[0] != None else ''
            virus_name = r[1] if r[1] != None else ''
            status = r[2] if r[2] != None else ''
            result += '+' +_SPLIT_STR_ + public_key + _SPLIT_STR_+  virus_name + _SPLIT_STR_ + status + _RETURNLINE_STR_
        with codecs.open(getfilename(), 'a+', 'utf-8') as f:
            f.write(result)
    except:
        print traceback.format_exc()
def getcprogramdatas(i, size):
    if con_params == None: return None
    sql = 'select uid, ca_issue, ca_subject from conflict_programs a where del = \'0\' limit %d, %d ' %(i,size)
    try:
        datas = mysql_utils.execute_fetchall(sql, con_params)
        result = ''
        for r in datas:
            uid = r[0] if r[0] != None else ''
            ca_issue = r[1] if r[1] != None else ''
            ca_subject = r[2] if r[2] != None else ''
            #optype, uid, security, ca_issue, ca_subject, name, unit_name, unit_hash, reason, reason_en
            result += '+' +_SPLIT_STR_+ uid+_SPLIT_STR_+ '5'+ _SPLIT_STR_+ ca_issue +_SPLIT_STR_+ ca_subject + _SPLIT_STR_+ '' + _SPLIT_STR_+  '' + _SPLIT_STR_+ '' + _SPLIT_STR_+ ''  + _SPLIT_STR_+ '' + _RETURNLINE_STR_
        with codecs.open(getfilename(), 'a+', 'utf-8') as f:
            f.write(result)
    except:
        print traceback.format_exc()
Example #8
0
def getdbdatas(i, size):
    print i
    print size
    if con_params == None: return None
    #sql = 'select pkg_name, name, version_name, version_code, public_key, virus_name, reason, reason_en, rom_category,status from an_db_lists a where trashed = \'0\' and status = \'1\' limit %d, %d ' %(i,size)
    sql = 'select pkgname, categories_code, content_rating from adappls a where categories_code is not null or content_rating is not null limit %d, %d ' %(i,size)
    try:
        datas = mysql_utils.execute_fetchall(sql, con_params)
        result = ''
        for r in datas:
            pkgname = r[0] if r[0] != None else ''
            categories_code = r[1] if r[1] != None else ''
            content_rating = r[2] if r[2] != None else ''
            result += pkgname+_SPLIT_STR_+ str(categories_code) + _SPLIT_STR_ +str(content_rating) + _RETURNLINE_STR_
        with codecs.open(getfilename(), 'a+', 'utf-8') as f:
            f.write(result)
    except:
        print traceback.format_exc()
def getwanteddatas(i, size):
    if con_params == None: return None
    sql = 'select pkg_key, pkg_name, unit_name, unit_hash, reason, reason_en from wanted_lists a limit %d, %d ' %(i,size)
    try:
        datas = mysql_utils.execute_fetchall(sql, con_params)
        result = ''
        for r in datas:
            uid = r[0] if r[0] != None else ''
            pkg_name = r[1] if r[1] != None else ''
            unit_name = r[2] if r[2] != None else ''
            unit_hash = r[3] if r[3] != None else ''
            reason = r[4] if r[4] != None else ''
            reason_en = r[5] if r[5] != None else ''
            #optype, uid, security, ca_issue, ca_subject, name, unit_name, unit_hash, reason, reason_en
            result += '+' +_SPLIT_STR_+ uid+_SPLIT_STR_+ '4' + _SPLIT_STR_+ '' +_SPLIT_STR_+ '' + _SPLIT_STR_+ pkg_name + _SPLIT_STR_+  unit_name + _SPLIT_STR_+ unit_hash + _SPLIT_STR_+ reason  + _SPLIT_STR_+ reason_en + _RETURNLINE_STR_
        with codecs.open(getfilename(), 'a+', 'utf-8') as f:
            f.write(result)
    except:
        print traceback.format_exc()
def insert(sql = None):
    print "execute sql"
    mysql_utils.execute_fetchall(sql, con_params)