Skip to content

Instantly share code, notes, and snippets.

@hasherezade
Created November 23, 2017 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hasherezade/328210a57464360e23e125929b62b301 to your computer and use it in GitHub Desktop.
Save hasherezade/328210a57464360e23e125929b62b301 to your computer and use it in GitHub Desktop.
import socket
import sys
import argparse
def main():
parser = argparse.ArgumentParser(description="Send to the Crackme")
parser.add_argument('--key', dest="key", default="0xa2", help="The value to be sent")
args = parser.parse_args()
my_key = int(args.key, 16) % 255
print '[+] Checking the key: ' + hex(my_key)
key = chr(my_key) + '012'
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('127.0.0.1', 2222))
s.send(key)
result = s.recv(512)
if result is not None:
print "[+] Response: " + result
s.close()
except socket.error:
print "Could not connect to the socket. Is the crackme running?"
if __name__ == "__main__":
sys.exit(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment