Beispiel #1
0
def check_process_exists(process_name):
    returncode = ''
    try:
        p = os.popen('tasklist /FI "IMAGENAME eq %s"' % process_name)
        returncode = p.read().count(process_name)
    except Exception, e:
        GetDVDFabDump.log(str(e))
Beispiel #2
0
def copy_file(src_file, dest_path):
    if os.path.isfile(src_file):
        if os.path.isdir(dest_path):
            pass
        else:
            os.makedirs(dest_path)
        errors = []
        srcname = src_file
        filename = os.path.basename(src_file)
        dstname = os.path.join(dest_path, filename)
        try:
            if os.path.isfile(srcname):
                copy2(srcname, dstname)
            elif os.path.isdir(dstname):
                os.remove(dstname)
                copy2(srcname, dstname)
        except Exception, e:
            result = 'failed to copy %s' % src_file
            GetDVDFabDump.log(result + str(e))

        try:
            copystat(srcname, dstname)
        except Exception, e:
            result = 'failed to copystat %s' % src_file
            GetDVDFabDump.log(result + str(e))
Beispiel #3
0
def copy_file(src_file, dest_path):  
    if os.path.isfile(src_file): 
        if os.path.isdir(dest_path):      
            pass
        else:
            os.makedirs(dest_path)
        errors = []                             
        srcname = src_file    
        filename = os.path.basename(src_file)
        dstname = os.path.join(dest_path, filename)   
        try:                                
            if os.path.isfile(srcname):        
                copy2(srcname, dstname) 
            elif os.path.isdir(dstname):          
                os.remove(dstname)
                copy2(srcname, dstname)       
        except Exception, e:
            result = 'failed to copy %s' % src_file
            GetDVDFabDump.log(result + str(e))
            
        try:                               
            copystat(srcname, dstname)           
        except Exception, e:
            result = 'failed to copystat %s' % src_file
            GetDVDFabDump.log(result + str(e))
Beispiel #4
0
def main(version, zip_file_path, DumpAnalyze_path, PdbPath):
    SimplePath = read_ini("FilePath", "SimplePath")
    create_folder(SimplePath)
    SimplePath = changepath(SimplePath)
    pdb_file_path = find_pdbfile(PdbPath, version)
    flag = check_version(version)
    if flag:
        copy_exe_pdb_to_localpath(version, pdb_file_path)
        GetDVDFabDump.log("success to copy exe and pdb!!, version is %s!" %
                          version)
    else:
        GetDVDFabDump.log("zip file version does not change, still %s!!" %
                          version)
    #delete_file(DestPath)
    call_DumpAnalyze(DumpAnalyze_path, zip_file_path, version)
    time.sleep(5)
    zip_filename, bug_name, username, name_path, zipfile_number = get_analyzed_zip_file(
        zip_file_path)
    write_file(SimplePath + "bug_name.txt", bug_name)
    standrad_zipfile_number = read_ini("FilePath", "standrad_zipfile_number")
    if int(zipfile_number) >= int(standrad_zipfile_number):
        GetDVDFabDump.log(
            "%s zipfile number is %s, equal to %s or bigger than %s!" %
            (bug_name, zipfile_number, standrad_zipfile_number,
             standrad_zipfile_number))
        write_file(SimplePath + "name.txt", username)
        content = check_call_stack_content(name_path)
        if content:
            print "call_stack.txt is not empty, could report bug"
            #auto_report_bug.main(name_path)
        else:
            GetDVDFabDump.log('call_stack.txt does not have anything!!')
    else:
        GetDVDFabDump.log("%s zipfile number is %s, less than %s!" %
                          (bug_name, zipfile_number, standrad_zipfile_number))
Beispiel #5
0
def check_process_exists(process_name):
    returncode = ''   
    try:
        p = os.popen('tasklist /FI "IMAGENAME eq %s"' % process_name) 
        returncode = p.read().count(process_name)   
    except Exception, e:
        GetDVDFabDump.log(str(e))
Beispiel #6
0
def get_bug_id():
    cookie_support= urllib2.HTTPCookieProcessor(cookielib.CookieJar())
    opener = urllib2.build_opener(cookie_support, urllib2.HTTPHandler)
    urllib2.install_opener(opener)

    postdata=urllib.urlencode({
        "return":"index.php",
        'username':'******',
        'password':'******',
        "secure_session":"on"
    })

    headers = {
        "Host":"10.10.7.150",
        "User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0"
    }

    req = urllib2.Request(
        url = 'http://10.10.7.150/bug/login.php',
        data = postdata,
        headers = headers)

    content = urllib2.urlopen(req).read()
    data = content.split("Reported by Me")[1]
    pattern = ">\d+<"
    bug_id = re.findall(pattern, data)[0][1:-1]
    bug_id = str(int(bug_id))
    GetDVDFabDump.log("successfully use spider to get bug_id,  it is %s" % bug_id)
    return bug_id
Beispiel #7
0
def main(version, zip_file_path, DumpAnalyze_path, PdbPath):  
    SimplePath = read_ini("FilePath", "SimplePath")  
    create_folder(SimplePath)
    SimplePath = changepath(SimplePath)
    pdb_file_path = find_pdbfile(PdbPath, version)
    flag = check_version(version)
    if flag:
        copy_exe_pdb_to_localpath(version, pdb_file_path)
        GetDVDFabDump.log("success to copy exe and pdb!!, version is %s!" % version)
    else:
        GetDVDFabDump.log("zip file version does not change, still %s!!" % version)
    #delete_file(DestPath)
    call_DumpAnalyze(DumpAnalyze_path, zip_file_path, version)
    time.sleep(5)
    zip_filename, bug_name, username, name_path, zipfile_number = get_analyzed_zip_file(zip_file_path)
    write_file(SimplePath + "bug_name.txt", bug_name)
    standrad_zipfile_number  = read_ini("FilePath","standrad_zipfile_number")
    if int(zipfile_number) >= int(standrad_zipfile_number):
        GetDVDFabDump.log("%s zipfile number is %s, equal to %s or bigger than %s!" % (bug_name,zipfile_number,standrad_zipfile_number,standrad_zipfile_number ))
        write_file(SimplePath + "name.txt", username)
        content = check_call_stack_content(name_path)
        if content:
            print "call_stack.txt is not empty, could report bug"
            #auto_report_bug.main(name_path)
        else:
            GetDVDFabDump.log('call_stack.txt does not have anything!!')
    else:
        GetDVDFabDump.log("%s zipfile number is %s, less than %s!" % (bug_name, zipfile_number, standrad_zipfile_number )) 
Beispiel #8
0
def get_bug_id():
    cookie_support = urllib2.HTTPCookieProcessor(cookielib.CookieJar())
    opener = urllib2.build_opener(cookie_support, urllib2.HTTPHandler)
    urllib2.install_opener(opener)

    postdata = urllib.urlencode({
        "return": "index.php",
        'username': '******',
        'password': '******',
        "secure_session": "on"
    })

    headers = {
        "Host":
        "10.10.7.150",
        "User-Agent":
        "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0"
    }

    req = urllib2.Request(url='http://10.10.7.150/bug/login.php',
                          data=postdata,
                          headers=headers)

    content = urllib2.urlopen(req).read()
    data = content.split("Reported by Me")[1]
    pattern = ">\d+<"
    bug_id = re.findall(pattern, data)[0][1:-1]
    bug_id = str(int(bug_id))
    GetDVDFabDump.log("successfully use spider to get bug_id,  it is %s" %
                      bug_id)
    return bug_id
Beispiel #9
0
def check_version(version):
    flag = False
    if GetDVDFabDump.ZIP_VERSION == "":
        GetDVDFabDump.ZIP_VERSION = version
        flag = True
    else:
        if GetDVDFabDump.ZIP_VERSION != version:
            GetDVDFabDump.ZIP_VERSION = version
            flag = True
        GetDVDFabDump.log("check_version , %s" % flag)
    return flag
Beispiel #10
0
def check_version(version):
    flag = False
    if GetDVDFabDump.ZIP_VERSION == "":
        GetDVDFabDump.ZIP_VERSION = version
        flag = True
    else:
        if GetDVDFabDump.ZIP_VERSION != version:
            GetDVDFabDump.ZIP_VERSION = version
            flag = True
        GetDVDFabDump.log("check_version , %s" % flag)
    return flag
Beispiel #11
0
def delete_file(dest_path):
    if os.path.exists(dest_path):
        for filename in os.listdir(dest_path):
            file_path = os.path.join(dest_path, filename)
            if os.path.isfile(file_path):
                try:
                    os.remove(file_path)
                except Exception, e:
                    GetDVDFabDump.log('failed to remove ' + file_path + '; ' + str(e))
            else:
                GetDVDFabDump.log("%s is not file!" % file_path)
Beispiel #12
0
def delete_file(dest_path):
    if os.path.exists(dest_path):
        for filename in os.listdir(dest_path):
            file_path = os.path.join(dest_path, filename)
            if os.path.isfile(file_path):
                try:
                    os.remove(file_path)
                except Exception, e:
                    GetDVDFabDump.log('failed to remove ' + file_path + '; ' +
                                      str(e))
            else:
                GetDVDFabDump.log("%s is not file!" % file_path)
Beispiel #13
0
def copy_exe_pdb_to_localpath(version, pdb_file_path):
    for onefile in os.listdir(pdb_file_path):
        filename = os.path.join(pdb_file_path, onefile)
        try:
            exe_pdb_destpath = read_ini("FilePath", "EXE_PDB_DESTPATH")
            copy_file(filename, exe_pdb_destpath)
            if filename.endswith(".exe"):
                shutil.copy2(filename, exe_pdb_destpath + "\\Fab.exe")
                shutil.copy2(filename, exe_pdb_destpath + "\\DVDFab.exe")
            if filename.endswith(".pdb"):
                shutil.copy2(filename, exe_pdb_destpath + "\\Fab.pdb")
                shutil.copy2(filename, exe_pdb_destpath + "\\DVDFab.pdb")
            GetDVDFabDump.log("success to copy %s" % filename)
        except Exception, e:
            GetDVDFabDump.log("failed to copy " + filename + "; " + str(e))
Beispiel #14
0
def copy_exe_pdb_to_localpath(version, pdb_file_path):
    for onefile in os.listdir(pdb_file_path):
        filename = os.path.join(pdb_file_path, onefile)
        try:
            exe_pdb_destpath = read_ini("FilePath", "EXE_PDB_DESTPATH")
            copy_file(filename, exe_pdb_destpath)
            if filename.endswith(".exe"):
                shutil.copy2(filename, exe_pdb_destpath + "\\Fab.exe")
                shutil.copy2(filename, exe_pdb_destpath + "\\DVDFab.exe")
            if filename.endswith(".pdb"):
                shutil.copy2(filename, exe_pdb_destpath + "\\Fab.pdb")
                shutil.copy2(filename, exe_pdb_destpath + "\\DVDFab.pdb")
            GetDVDFabDump.log("success to copy %s" % filename)
        except Exception, e:
            GetDVDFabDump.log("failed to copy " + filename + "; " + str(e))
Beispiel #15
0
def find_pdbfile(pdb_path, version):  
    full_pdb_path = ''
    pdb_list = []
    ctime_list = []
    if os.path.exists(pdb_path + '\\' + version):
        full_pdb_path = pdb_path + '\\' + version
        for all_roots, _, all_files in os.walk(full_pdb_path):
            for onefile in all_files:
                filename = os.path.join(all_roots, onefile)
                if filename.endswith(".pdb"):
                    ctime = time.mktime(time.localtime(os.stat(filename).st_mtime))
                    pdb_list.append(filename)
                    ctime_list.append(ctime)
        if ctime_list:
            max_time = max(ctime_list)
            full_pdb_path = pdb_list[ctime_list.index(max_time)].replace(os.path.basename(pdb_list[ctime_list.index(max_time)]), "")
        else:
            GetDVDFabDump.log("Sorry, no DVDFab.pdb file!!!")
    else:
        GetDVDFabDump.log('pdb_path does not exist!!')
    return full_pdb_path
Beispiel #16
0
def find_pdbfile(pdb_path, version):
    full_pdb_path = ''
    pdb_list = []
    ctime_list = []
    if os.path.exists(pdb_path + '\\' + version):
        full_pdb_path = pdb_path + '\\' + version
        for all_roots, _, all_files in os.walk(full_pdb_path):
            for onefile in all_files:
                filename = os.path.join(all_roots, onefile)
                if filename.endswith(".pdb"):
                    ctime = time.mktime(
                        time.localtime(os.stat(filename).st_mtime))
                    pdb_list.append(filename)
                    ctime_list.append(ctime)
        if ctime_list:
            max_time = max(ctime_list)
            full_pdb_path = pdb_list[ctime_list.index(max_time)].replace(
                os.path.basename(pdb_list[ctime_list.index(max_time)]), "")
        else:
            GetDVDFabDump.log("Sorry, no DVDFab.pdb file!!!")
    else:
        GetDVDFabDump.log('pdb_path does not exist!!')
    return full_pdb_path
Beispiel #17
0
def call_DumpAnalyze(DumpAnalyze_path, zip_file_path, s_version):
    zip_path = zip_file_path.replace(os.path.basename(zip_file_path), "")
    cmd_string = DumpAnalyze_path + " " + zip_path + " " + zip_path + " " + s_version
    GetDVDFabDump.log("cmd_string: " + cmd_string)
    try:
        os.system(cmd_string)
        GetDVDFabDump.log('success to call ZipTypeAnalyze.exe')
    except Exception, e:
        print str(e)
        GetDVDFabDump.log('failed to call ZipTypeAnalyze.exe' + str(e))
Beispiel #18
0
def call_DumpAnalyze(DumpAnalyze_path, zip_file_path, s_version):
    zip_path = zip_file_path.replace(os.path.basename(zip_file_path), "")
    cmd_string = DumpAnalyze_path + " "  + zip_path + " " + zip_path + " " + s_version
    GetDVDFabDump.log("cmd_string: " + cmd_string)
    try:
        os.system(cmd_string)
        GetDVDFabDump.log('success to call ZipTypeAnalyze.exe')      
    except Exception, e:
        print str(e)
        GetDVDFabDump.log('failed to call ZipTypeAnalyze.exe' + str(e))
Beispiel #19
0
def record_bug(bug_file_path, bug_name, bug_id):
    bug_file = bug_file_path + "bug_name_id.txt"
    if os.path.exists(bug_file):
        all_lines = read_file_lines(bug_file)
        bug_list = [i.strip() for i in all_lines]
        if (bug_name + "=" + bug_id) in bug_list:
            GetDVDFabDump.log("the bug has been reported!")
        else:
            write_file(bug_file, bug_name + "=" + bug_id + "\n\r", mode = "a")
            GetDVDFabDump.log("this is a new bug!")
    else:
        write_file(bug_file, bug_name + "=" + bug_id + "\n\r", mode = "a")
        GetDVDFabDump.log("this is a new bug!")
Beispiel #20
0
def record_bug(bug_file_path, bug_name, bug_id):
    bug_file = bug_file_path + "bug_name_id.txt"
    if os.path.exists(bug_file):
        all_lines = read_file_lines(bug_file)
        bug_list = [i.strip() for i in all_lines]
        if (bug_name + "=" + bug_id) in bug_list:
            GetDVDFabDump.log("the bug has been reported!")
        else:
            write_file(bug_file, bug_name + "=" + bug_id + "\n\r", mode="a")
            GetDVDFabDump.log("this is a new bug!")
    else:
        write_file(bug_file, bug_name + "=" + bug_id + "\n\r", mode="a")
        GetDVDFabDump.log("this is a new bug!")
Beispiel #21
0
def kill_process(process_name):
    try:
        os.system('taskkill /f /im ' + process_name)
        GetDVDFabDump.log('%s is killed now' % process_name)
    except Exception, e:
        GetDVDFabDump.log('failed to kill process; ' + str(e))
Beispiel #22
0
def kill_process(process_name):
    try: 
        os.system('taskkill /f /im ' + process_name) 
        GetDVDFabDump.log('%s is killed now' % process_name) 		
    except Exception, e:
        GetDVDFabDump.log('failed to kill process; ' + str(e))         
Beispiel #23
0
    return content


def delete_file(dest_path):
    if os.path.exists(dest_path):
        for filename in os.listdir(dest_path):
            file_path = os.path.join(dest_path, filename)
            if os.path.isfile(file_path):
                try:
                    os.remove(file_path)
                except Exception, e:
                    GetDVDFabDump.log('failed to remove ' + file_path + '; ' + str(e))
            else:
                GetDVDFabDump.log("%s is not file!" % file_path)
    else:
        GetDVDFabDump.log("%s does not exist!" % dest_path)
          
def check_process_exists(process_name):
    returncode = ''   
    try:
        p = os.popen('tasklist /FI "IMAGENAME eq %s"' % process_name) 
        returncode = p.read().count(process_name)   
    except Exception, e:
        GetDVDFabDump.log(str(e))
    else:
        if returncode:
            GetDVDFabDump.log(process_name + ' exists')    
    return returncode
        
def kill_process(process_name):
    try: 
Beispiel #24
0

def delete_file(dest_path):
    if os.path.exists(dest_path):
        for filename in os.listdir(dest_path):
            file_path = os.path.join(dest_path, filename)
            if os.path.isfile(file_path):
                try:
                    os.remove(file_path)
                except Exception, e:
                    GetDVDFabDump.log('failed to remove ' + file_path + '; ' +
                                      str(e))
            else:
                GetDVDFabDump.log("%s is not file!" % file_path)
    else:
        GetDVDFabDump.log("%s does not exist!" % dest_path)


def check_process_exists(process_name):
    returncode = ''
    try:
        p = os.popen('tasklist /FI "IMAGENAME eq %s"' % process_name)
        returncode = p.read().count(process_name)
    except Exception, e:
        GetDVDFabDump.log(str(e))
    else:
        if returncode:
            GetDVDFabDump.log(process_name + ' exists')
    return returncode