Best Python code snippet using localstack_python
deobfuscate_resolve_Vidar.py
Source: deobfuscate_resolve_Vidar.py
...97 plaintext = "str_" + plaintext98 idc.MakeName(var_addr, plaintext)99100101def resolve_apis(main_refsList):102 """GetProcaddress call pattern103 mov ecx, str_Exitprocess104 push ecx ; lpProcName105 mov edx, [ebp+pKernel32Base]106 push edx ; hModule107 call getprocaddress108 mov dword_4317B4, eax109 """110 pattern = ['mov', 'push', 'mov', 'push', 'call', 'mov']111 resolveList = list(FuncItems(idc.LocByName(main_refsList[1])))112 113 resolve_addrList = list(FuncItems(idc.LocByName(main_refsList[1])))114 idc.MakeName(idc.LocByName(main_refsList[1]), "resolveAPIs_"+main_refsList[1])115 resolve_refsList = [idc.GetOpnd(line,0) for line in resolve_addrList if idc.GetMnem(line) == 'call']116 117 idc.MakeName(idc.LocByName(resolve_refsList[0]), "load_kernel32dll_"+resolve_refsList[0])118 idc.MakeName(idc.LocByName(resolve_refsList[1]), "parse_kernel32dll_"+resolve_refsList[1])119 120 ea = idc.LocByName("parse_kernel32dll_"+resolve_refsList[1])121 xref = idautils.XrefsTo(ea, 0)122 loadlib_ref = idc.NextHead(idc.NextHead(next(xref).frm))123 idc.MakeName(idc.GetOperandValue(loadlib_ref, 0), "loadlibraryA")124 getprocaddr_ref = idc.NextHead(idc.NextHead(next(xref).frm))125 idc.MakeName(idc.GetOperandValue(getprocaddr_ref, 0), "getprocaddress")126 127 for i in range(0, len(resolveList)-len(pattern)):128 if idc.GetMnem(resolveList[i]) == 'call' and "getprocaddress" in idc.GetOpnd(resolveList[i], 0):129 addr = idc.GetOperandValue(resolveList[i-4],1)130 if addr in strings_dict:131 api = strings_dict[addr]132 resolvedaddr = idc.GetOperandValue(resolveList[i+1],0)133 idc.MakeName(resolvedaddr, "_"+api)134135if __name__ == "__main__":136 main_addrList = list(FuncItems(idc.LocByName("_WinMain@16")))137 main_refsList = [idc.GetOpnd(line,0) for line in main_addrList if idc.GetMnem(line) == 'call'] 138 decrypt_strings(main_refsList)139 resolve_apis(main_refsList)140 141 idc.MakeName(idc.LocByName(main_refsList[2]), "CIS_check_"+main_refsList[2])142 idc.MakeName(idc.LocByName(main_refsList[3]), "windowsdefender_check_"+main_refsList[3])
...
ida_resolve_apis.py
Source: ida_resolve_apis.py
...47 for api in item['imports']:48 if api_hash == api['hash']:49 return "{}!{}".format(item['name'], api['name'])50 return "{}!unknown".format(item['name'])51def resolve_apis(resolver_offset, hashes_table, xor_key):52 for xref in idautils.XrefsTo(resolver_offset):53 off = idc.prev_head(xref.frm)54 # This loop will search for the hash that is being passed by the function55 # It's limited to 100 searches to avoid possible infinite loops.56 dll, api = None, None57 for i in range(1, 101):58 if i == 100:59 print "[-] Cannot find hash for address: %s" % hex(xref.frm)60 break61 # If it's not a "push" operation, keep looking62 if idc.GetMnem(off) != "push":63 off = idc.prev_head(off)64 continue65 # If a "push" is identified, checks if it's the DLL or the API hash66 if not dll:67 dll = hex(idc.GetOperandValue(off, 0))68 off = idc.prev_head(off)69 continue70 # If the DLL was already found, then the second push is the API hash71 api_name = api_resolver(dll, hex(idc.GetOperandValue(off, 0)), hashes_table, xor_key)72 comment = "Unknown" if not api_name else api_name73 idc.set_cmt(xref.frm, comment, True)74 break75# ---------------------- Main ---------------------- #76def main(xor_key, resolver_function):77 hashes = generate_hashes_table(xor_key)78 resolve_apis(resolver_function, hashes, xor_key)...
fix.py
Source: fix.py
1def resolve_apis(services: Iterable[str]) -> Set[str]:2 """3 Resolves recursively for the given collection of services (e.g., ["serverless", "cognito"]) the list of actual4 API services that need to be included (e.g., {'dynamodb', 'cloudformation', 'logs', 'kinesis', 'sts',5 'cognito-identity', 's3', 'dynamodbstreams', 'apigateway', 'cloudwatch', 'lambda', 'cognito-idp', 'iam'}).6 More specifically, it does this by:7 (1) resolving and adding dependencies (e.g., "dynamodbstreams" requires "kinesis"),8 (2) resolving and adding composites (e.g., "serverless" describes an ensemble9 including "iam", "lambda", "dynamodb", "apigateway", "s3", "sns", and "logs"), and10 (3) removing duplicates from the list.11 :param services: a collection of services that can include composites (e.g., "serverless").12 :returns a set of canonical service names13 """14 stack = []15 result = set()...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
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!!