How to use __len__ method in localstack

Best Python code snippet using localstack_python

BFUSCATED_main.py

Source:BFUSCATED_main.py Github

copy

Full Screen

...

Full Screen

Full Screen

obfuscate_me_BFUSCATED.py

Source:obfuscate_me_BFUSCATED.py Github

copy

Full Screen

...

Full Screen

Full Screen

functions.py

Source:functions.py Github

copy

Full Screen

...36 "({}>{})".format(37 utils.convert(random.randint(1, 10)),38 utils.convert(random.randint(1, 10))39 ),40 "(not({}).__len__())".format(41 ",".join(["()"] * random.randint(1, 10))42 )43 ]),44 "type": str(bool)45 },46 # <class 'list'>47 "list": {48 "get": lambda: "[]",49 "type": str(list)50 },51 # <class 'tuple'>52 "tuple": {53 "get": lambda: "()",54 "type": str(tuple)55 },56 # <class 'dict'>57 "dict": {58 "get": lambda: "{}",59 "type": str(dict)60 },61 # <class 'generator'>62 "generator": {63 "get": lambda: "(()for _ in())",64 "type": str(type((() for _ in ())))65 },66 # <class 'type'>67 "type": {68 "get": lambda: random.choice(["type", "str", "int", "float"]),69 "type": str(type)70 },71 # <class 'function'>72 "function": {73 "get": lambda: "(lambda:())",74 "type": str(type(lambda: ()))75 },76 # <class 'builtin_function_or_method'>77 "builtin_function_or_method": {78 "get": lambda: random.choice(["len", "print", "input"]),79 "type": str(type(len))80 },81 # <class '_sitebuiltins._Helper'>82 "_sitebuiltins._Helper": {83 "get": lambda: "help",84 "type": str(type(help))85 },86}87HEADERS = {88 True: "exec(eval((lambda f=open(__file__).read().split(chr((((),()).__len__()**((),()).__len__())*(((),"89 "()).__len__()+[()].__len__())*((),(),()).__len__()-[()].__len__())):(lambda s=[chr(int(c, ((((),"90 ")>(()))+(((),())>((),)))**(((())<((),()))+(((),(),)>((),)))**((()<((),))+(((),())>()))))for c in[f[(((),"91 "())>())+(()<())][l*(((())<((),()))+(((),())>(()))):(l+(((())>(()))+((())<((),))))*(((())<((),()))+(((),"92 "())>(())))]for l in range(len(f[((((),)<(()))+(((),)>(())))])//((((),)>(()))+(((),)>(()))))]]:''.join(chr("93 "ord(a)^ord(b))for a,b in zip(s,f[(((())<((),()))+(()<((),())))]*-(-len(s)//len(f[((((),)>(()))+(()<((),"94 "())))])))))())()))# ",95 False: "exec(eval(open(__file__).read().split(chr((((),()).__len__()**((),()).__len__())*(((),()).__len__("96 ")+[()].__len__())*((),(),()).__len__()-[()].__len__()))[[()].__len__()]))# "97}98# Generate a dict of existing characters within99# the types and their matches100matches = {}101for letter in string.printable:102 characters = []103 for element in TYPES.values():104 if letter in element["type"]:105 characters.append(element)106 if characters:107 matches[letter] = characters108def lambda_bfuscate(code, args) -> str:109 """110 Obfuscates python code with the lambda method.111 """112 obfuscated = HEADERS[args.defend]113 segments = []114 for char in code:115 # Check if char has a match116 if char in matches:117 chosen_type = random.choice(matches[char])118 chosen_index = random.choice(utils.find(char, chosen_type["type"]))119 segments.append("str({}.__class__)[{}]".format(120 chosen_type["get"](),121 utils.convert(chosen_index)122 ))123 # Check if char is uppercase and has lowercase counterpart124 elif char.isupper() and char.lower() in matches:125 chosen_type = random.choice(matches[char.lower()])126 chosen_index = random.choice(utils.find(char.lower(), chosen_type["type"]))127 segments.append("chr(ord(str({}.__class__)[{}])-(((),()).__len__()**((),(),(),(),()).__len__()))".format(128 chosen_type["get"](),129 utils.convert(chosen_index)130 ))131 # Check if char is a digit132 elif char in string.digits:133 segments.append("str({})".format(134 utils.convert(int(char))135 ))136 # Create character137 else:138 segments.append("chr({})".format(139 utils.convert(ord(char))140 ))141 obfuscated += "+".join(segments)142 if args.defend:143 return utils.encrypt(obfuscated)144 else:145 return obfuscated146def len_bfuscate(code, args) -> str:147 """148 Obfuscates python code with the len method.149 """150 obfuscated = HEADERS[args.defend]151 segments = []152 for char in code:153 # Check if char has a match154 if char in matches:155 chosen_type = random.choice(matches[char])156 chosen_index = random.choice(utils.find(char, chosen_type["type"]))157 split_num = utils.split(chosen_index)158 segments.append("str({}.__class__)[{}-{}]".format(159 chosen_type["get"](),160 "*".join(161 "({}**{})".format(162 "({}).__len__()".format("()," * n),163 "({}).__len__()".format("()," * a)164 )165 for n, a in split_num[0].items()166 ),167 "({}).__len__()".format(",".join(["()"] * split_num[1])) if split_num[1] > 0 else "(()).__len__()"168 ))169 # Check if char is uppercase and has lowercase counterpart170 elif char.isupper() and char.lower() in matches:171 chosen_type = random.choice(matches[char.lower()])172 chosen_index = random.choice(utils.find(char.lower(), chosen_type["type"]))173 split_num = utils.split(chosen_index)174 segments.append("chr(ord(str(type({}))[{}-{}])-(((),()).__len__()**((),(),(),(),()).__len__()))".format(175 chosen_type["get"](),176 "*".join(177 "({}**{})".format(178 "({}).__len__()".format("()," * n),179 "({}).__len__()".format("()," * a)180 )181 for n, a in split_num[0].items()182 ),183 "({}).__len__()".format(",".join(["()"] * split_num[1])) if split_num[1] > 0 else "(()).__len__()"184 ))185 # Check if char is a digit186 elif char in string.digits:187 split_num = utils.split(int(char))188 segments.append("str({}-{})".format(189 "*".join(190 "({})".format(191 "*".join(["({}).__len__()".format("()," * n)] * a)192 )193 for n, a in split_num[0].items()194 ),195 "({}).__len__()".format(",".join(["()"] * split_num[1])) if split_num[1] > 0 else "(()).__len__()"196 ))197 # Create character198 else:199 split_num = utils.split(ord(char))200 segments.append("chr({}-{})".format(201 "*".join(202 "({}**{})".format(203 "({}).__len__()".format("()," * n),204 "({}).__len__()".format("()," * a)205 )206 for n, a in split_num[0].items()207 ),208 "({}).__len__()".format(",".join(["()"] * split_num[1])) if split_num[1] > 0 else "(()).__len__()"209 ))210 obfuscated += "+".join(segments)211 if args.defend:212 return utils.encrypt(obfuscated)213 else:...

Full Screen

Full Screen

jianzhi65_add.py

Source:jianzhi65_add.py Github

copy

Full Screen

...9 add_on = 010 bin_a = bin(a)[2:]11 bin_b = bin(b)[2:]12 res = ''13 for bit in range(max(bin_a.__len__(), bin_b.__len__())):14 aa = 015 bb = 016 if bit in range(bin_a.__len__()) and bit in range(bin_b.__len__()):17 aa = int(bin_a[::-1][bit])18 bb = int(bin_b[::-1][bit])19 res += str(aa ^ bb ^ add_on)20 elif bit in range(bin_a.__len__()) and bit not in range(bin_b.__len__()):21 aa = int(bin_a[::-1][bit])22 bb = 023 res += str(aa ^ bb ^ add_on)24 elif bit not in range(bin_a.__len__()) and bit in range(bin_b.__len__()):25 aa = 026 bb = int(bin_b[::-1][bit])27 res += str(aa ^ bb ^ add_on)28 # modify add_on29 if (aa and bb) or ((aa or bb) and add_on):30 add_on = 131 else:32 add_on = 033 if add_on:34 res += '1'35 res += 'b0'36 return int(res[::-1], 2)37 elif a<=0 and b<=0:38 add_on = 039 bin_a = bin(a)[3:]40 bin_b = bin(b)[3:]41 res = ''42 for bit in range(max(bin_a.__len__(), bin_b.__len__())):43 aa = 044 bb = 045 if bit in range(bin_a.__len__()) and bit in range(bin_b.__len__()):46 aa = int(bin_a[::-1][bit])47 bb = int(bin_b[::-1][bit])48 res += str(aa ^ bb ^ add_on)49 elif bit in range(bin_a.__len__()) and bit not in range(bin_b.__len__()):50 aa = int(bin_a[::-1][bit])51 bb = 052 res += str(aa ^ bb ^ add_on)53 elif bit not in range(bin_a.__len__()) and bit in range(bin_b.__len__()):54 aa = 055 bb = int(bin_b[::-1][bit])56 res += str(aa ^ bb ^ add_on)57 # modify add_on58 if (aa and bb) or ((aa or bb) and add_on):59 add_on = 160 else:61 add_on = 062 if add_on:63 res += '1'64 res += 'b0-'65 return int(res[::-1], 2)66 elif a>=0 and b<=0 and abs(a) > abs(b):67 add_on = 068 bin_a = bin(a)[2:]69 bin_b = bin(b)[3:]70 res = ''71 for bit in range(max(bin_a.__len__(), bin_b.__len__())):72 aa = 073 bb = 074 if bit in range(bin_a.__len__()) and bit in range(bin_b.__len__()):75 aa = int(bin_a[::-1][bit])76 bb = int(bin_b[::-1][bit])77 res += str(aa ^ bb ^ add_on)78 elif bit in range(bin_a.__len__()) and bit not in range(bin_b.__len__()):79 aa = int(bin_a[::-1][bit])80 bb = 081 res += str(aa ^ bb ^ add_on)82 elif bit not in range(bin_a.__len__()) and bit in range(bin_b.__len__()):83 aa = 084 bb = int(bin_b[::-1][bit])85 res += str(aa ^ bb ^ add_on)86 # modify add_on87 if (aa < bb) or (aa == bb and add_on):88 add_on = 189 else:90 add_on = 091 res += 'b0'92 if add_on:93 res += '-'94 return int(res[::-1], 2)95 elif a>=0 and b<=0 and abs(a) < abs(b):96 return -self.add(-a, -b)...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful