Best Python code snippet using autotest_python
pefile_crawling.py
Source: pefile_crawling.py
...35 print("Error :", full_path)36 except :37 pass38 return path_32bit_exe, path_64bit_exe, path_32bit_dll, path_64bit_dll39def get_file_md5( file_path, block_size = 8192 ) :40 hasher = hashlib.md5()41 with open(file_path, 'rb') as f :42 buf = f.read(block_size)43 while buf :44 hasher.update(buf)45 buf = f.read(block_size)46 return hasher.hexdigest()47def crawling_32bit_exe( path_32bit ) :48 md5 = get_file_md5(path_32bit)49 target_path = os.path.join(DESTINATION_32_EXE_PATH, md5 + '.vir')50 if not os.path.exists(target_path) :51 try :52 shutil.copy(path_32bit, target_path)53 except :54 pass55def crawling_64bit_exe( path_64bit ) :56 md5 = get_file_md5(path_64bit)57 target_path = os.path.join(DESTINATION_64_EXE_PATH, md5 + '.vir')58 if not os.path.exists(target_path) :59 try :60 shutil.copy(path_64bit, target_path)61 except :62 pass63def crawling_32bit_dll( path_32bit ) :64 md5 = get_file_md5(path_32bit)65 target_path = os.path.join(DESTINATION_32_DLL_PATH, md5 + '.vir')66 if not os.path.exists(target_path) :67 try :68 shutil.copy(path_32bit, target_path)69 except :70 pass71def crawling_64bit_dll( path_64bit ) :72 md5 = get_file_md5(path_64bit)73 target_path = os.path.join(DESTINATION_64_DLL_PATH, md5 + '.vir')74 if not os.path.exists(target_path) :75 try :76 shutil.copy(path_64bit, target_path)77 except :78 pass79def init() :80 if not os.path.exists(DESTINATION_32_EXE_PATH) :81 try :82 os.makedirs(DESTINATION_32_EXE_PATH)83 except :84 exit(1)85 if not os.path.exists(DESTINATION_64_EXE_PATH) :86 try :...
jarutil.py
Source: jarutil.py
...6import os7import hashlib8import shutil9import zipfile, time10def get_file_md5(file):11 md5_l = hashlib.md5()12 with open(file, mode="rb") as f:13 by = f.read()14 md5_l.update(by)15 ret = md5_l.hexdigest()16 # print(ret)17 return ret18def unpack_jar(path):19 zfile = zipfile.ZipFile(path, 'r')20 jarlog_ = os.getcwd() + '/jarlog'21 if not os.path.exists(jarlog_):22 # shutil.rmtree(jarlog_)23 os.makedirs(os.getcwd() + '/jarlog/')24 outPath = jarlog_ + "/" + str(time.time())25 zfile.extractall(outPath)26 return outPath27def ite_file_md5(path):28 for root, dirs, files in os.walk(path):29 for file in files:30 # è·åæ件æå±ç®å½31 # print(root)32 # è·åæ件路å¾33 path_join = os.path.join(root, file)34 print(path_join)35 print(get_file_md5(path_join))36def compare_jar_class_file(jar1, jar2):37 path1 = unpack_jar(jar1)38 path2 = unpack_jar(jar2)39 for root, dirs, files in os.walk(path1):40 for file in files:41 # è·åæ件æå±ç®å½42 # print(root)43 # è·åæ件路å¾44 path_join1 = os.path.join(root, file)45 path_join2 = os.path.join(path2, file)46 print(path_join1)47 print(get_file_md5(path_join1))48 if get_file_md5(path_join1) == get_file_md5(path_join2):49 print("equals")50if __name__ == '__main__':...
recorder.py
Source: recorder.py
...10 return json.loads(content)11def write_json_file(path, t):12 with open(path, 'w') as outfile:13 json.dump(t, outfile, sort_keys=True, indent=4, separators=(',', ': '))14def get_file_md5(file):15 hash_md5 = hashlib.md5()16 with open(file, 'rb') as f:17 for chunk in iter(lambda: f.read(4096), b''):18 hash_md5.update(chunk)19 return hash_md5.hexdigest()20def get_file_modify_time(path):21 return os.stat(path).st_mtime22def read_file(file):23 return open(file, 'r').read()24def write_file(file, content):25 with open(file, 'w') as outfile:26 outfile.write(content)27class Recorder:28 def __init__(self, record_file):29 self.record_file = record_file30 self.records = read_json_file(record_file)31 def record(self, file):32 md5 = get_file_md5(file)33 modify_time = get_file_modify_time(file)34 self.records[file] = (modify_time, md5, time.ctime(modify_time))35 write_json_file(self.record_file, self.records)36 def need_update(self, file):37 if not file in self.records:38 return True39 if not os.path.isfile(file):40 return True41 if type(self.records[file]) == type(''):42 return True43 modify_time_prev = self.records[file][0]44 modify_time = get_file_modify_time(file)45 if modify_time == modify_time_prev:46 return False47 md5 = get_file_md5(file)48 md5_prev = self.records[file][1]...
Check out the latest blogs from LambdaTest on this topic:
Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools
As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????
The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!