Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/python3
- import socket
- import rsa
- import base64
- import time
- import binascii
- TCP_IP = 'challenge01.root-me.org'
- TCP_PORT = 51031
- BUFFER_SIZE = 1024
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((TCP_IP, TCP_PORT))
- n = 456378902858290907415273676326459758501863587455889046415299414290812776158851091008643992243505529957417209835882169153356466939122622249355759661863573516345589069208441886191855002128064647429111920432377907516007825359999
- e = 65537
- c = 41662410494900335978865720133929900027297481493143223026704112339997247425350599249812554512606167456298217619549359408254657263874918458518753744624966096201608819511858664268685529336163181156329400702800322067190861310616
- key = rsa.PublicKey(n, e)
- # print(key._save_pkcs1_pem())
- ciphered = rsa.encrypt(b"toto", key)
- print(ciphered)
- def recv():
- data = s.recv(BUFFER_SIZE)
- print(data.decode("ascii"))
- def send(toBesend):
- s.send(toBesend)
- s.send(bytearray(chr(10), 'ascii'))
- recv()
- send(base64.b64encode(ciphered))
- time.sleep(1)
- recv()
- s.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement