def test_file(self): os.environ["PASSPHRASE"] = "deez nuts" buf = b"amdyolo" * 100000 encrypt(buf, output_file="test.txt") dec = decrypt("test.txt") self.assertEqual(buf, combine(dec)) with open("test.txt", "wb") as f: f.write(buf) encrypt("test.txt", output_file="test2.txt") decrypt("test2.txt", output_file="test3.txt") with BufferedReader("test3.txt") as br: self.assertEqual(buf, combine(br.chunks())) with open("text.txt", "wb") as f: f.write(buf) enc = encrypt("test.txt") decrypt(enc, output_file="test2.txt") with BufferedReader("test2.txt") as br: self.assertEqual(buf, combine(br.chunks()))
def test_default(self): buf1 = b"yeetus" buf2 = b"amdyolo" * 100000 os.environ["PASSPHRASE"] = "deez nuts" enc = combine(encrypt(buf1)) dec = decrypt(enc) self.assertEqual(buf1, combine(dec)) enc = combine(encrypt(buf2)) dec = decrypt(enc) self.assertEqual(buf2, combine(dec)) enc = combine(encrypt(buf1)) os.environ["PASSPHRASE"] = "got em" try: dec = decrypt(enc) self.assertNotEqual(buf1, combine(dec)) except ValueError: pass else: self.fail("Decryption should have failed with differing passwords.") os.environ["PASSPHRASE"] = "deez nuts" enc = combine(encrypt(buf2)) os.environ["PASSPHRASE"] = "got em" try: dec = decrypt(enc) self.assertNotEqual(buf2, combine(dec)) except ValueError: pass else: self.fail("Decryption should have failed with differing passwords.")
def pack_00dd(self): '''0xdd的发送包还不完美,有待进一步分析''' #inf为120字节的验证信息 inf1 = 'b37985fa' # 随机? inf2 = '0001' inf3 = self.qc.id inf5 = '000001' inf6 = self.qc.md5ps1 inf7 = self.qc.time inf8 = '00' * 13 inf9 = self.qc.myip inf10 = '00' * 9 + '10' #结尾的10可能是长度 # 这里应该是一个 random inf11 = self.qc.md5ps1 # 解0xdd返回包的Key,这里固定为md5ps1, 应该也是一个Randkey inf12 = self.qc.md5ps1 inf = inf1 + inf2 + inf3 + data.str2 + inf5 + inf6 + inf7 + inf8 + inf9 + inf10 + inf11 + inf12 inf = encrypt(inf, self.qc.md5ps2) #这段验证信息,用md5ps2加密 code1 = '00ca0001' + data.str1 + data.str2 code2 = '0078' code3 = '0000018B2E0100004823001' + '00' * 17 + '2000018BE0010' fill = '00' * 364 code = code1 + data.loginData['tkba'] + code2 + inf + code3 + fill code = encrypt(code, data.loginData['krand']) self.body = data.loginData['krand'] + code
def insert(self, website, raw_name, raw_pass, image): self.connect() encrypted_name = str(crypt.encrypt(raw_name, self.key)) encrypted_pass = str(crypt.encrypt(raw_pass, self.key)) self.c.execute( f"INSERT INTO passwords (website, login, pass, image) VALUES (\"{website}\", \"{encrypted_name}\", \"{encrypted_pass}\", \"{image}\");" ) self.db.commit() self.disconnect()
def run(self): for account in self.accounts: log.info("[*] Checking Buckets in account: " + account) self.call_sts(self.data, account) log.info("[*] Completed Collecting S3 Data.") log.info("[*] Sending S3 Data to Redis.") # Dump s3 Metadata into Redis. self.cn_redis.set("s3auditor", encrypt(self.data)) # Dump the cannonical IDs into redis. self.cn_redis.set("cannonicals", encrypt(self.cannonicals))
def addJob(body): body['dbUsername'] = crypt.encrypt(body['dbUsername']) body['dbPassword'] = crypt.encrypt(body['dbPassword']) mDB = MongoDB() Col = mDB.DB["Jobs"] jobid = Col.insert_one(body).inserted_id resp = json.loads(dumps(jobid)) x = Scheduler() x.addJob(jobid) return resp, (200)
def encrypt_file(key, file_path, keys): """Takes list of keys and converts it into a encrypted file.""" try: key_file = open(file_path, "w") key_file.write(str(crypt.encrypt(str(keys), key))) except: newfile = input("Create new keyfile(Y/n)? ") if newfile != "n": key_file = open(file_path, "w+") key_file.write(str(crypt.encrypt(keys, key))) else: print("> ending program") exit(0) finally: key_file.close()
def main(name): sm = generate_map(name) opcd = OPCD_Interface(sm['opcd_ctrl']) platform = opcd.get('platform') device = opcd.get(platform + '.nrf_serial') global THIS_SYS_ID THIS_SYS_ID = opcd.get('aircomm.id') key = opcd.get('aircomm.psk') crypt.init(key) mhist = MessageHistory(60) out_socket = sm['aircomm_out'] in_socket = sm['aircomm_in'] aci = ZMQ_Interface() acr = ACIReader(aci, out_socket, mhist) acr.start() # read from SCL in socket and send data via NRF while True: data = loads(in_socket.recv()) if len(data) == 2: msg = [data[0], THIS_SYS_ID, data[1]] elif len(data) > 2: msg = [data[0], THIS_SYS_ID] + data[1:] else: continue crypt_data = crypt.encrypt(dumps(msg)) mhist.append(crypt_data) aci.send(crypt_data)
def main(name): sm = generate_map(name) opcd = OPCD_Interface(sm['opcd_ctrl'], name) global THIS_SYS_ID THIS_SYS_ID = opcd.get('id') key = opcd.get('psk') crypt.init(key) mhist = MessageHistory(60) out_socket = sm['out'] in_socket = sm['in'] aci = Interface('/dev/ttyACM0') acr = ACIReader(aci, out_socket, mhist) acr.start() # read from SCL in socket and send data via NRF while True: data = loads(in_socket.recv()) if len(data) == 2: msg = [data[0], THIS_SYS_ID, data[1]] elif len(data) > 2: msg = [data[0], THIS_SYS_ID] + data[1:] else: continue crypt_data = crypt.encrypt(dumps(msg)) mhist.append(crypt_data) aci.send(crypt_data)
def SetNewConfigValues (self): logging.debug("Current config: %s" % self.config.keys()) logging.debug("Saving configuration from dialog.") self.config['credentials']['email'] = str(self.general.email.GetValue()) or '' logging.info("Email set to: %s" % self.config['credentials']['email']) self.config['credentials']['passwd'] = encrypt(str(self.general.passwd.GetValue())) or '' logging.info("Passwd set to: %s" % self.config['credentials']['passwd'])
def main(name): sm = generate_map(name) opcd = OPCD_Interface(sm['opcd_ctrl']) platform = opcd.get('platform') device = opcd.get(platform + '.nrf_serial') global THIS_SYS_ID THIS_SYS_ID = opcd.get('aircomm.id') key = opcd.get('aircomm.psk') crypt.init(key) mhist = MessageHistory(60) out_socket = sm['aircomm_out'] in_socket = sm['aircomm_in'] aci = Interface(device) acr = ACIReader(aci, out_socket, mhist) acr.start() # read from SCL in socket and send data via NRF while True: data = loads(in_socket.recv()) if len(data) == 2: msg = [data[0], THIS_SYS_ID, data[1]] elif len(data) > 2: msg = [data[0], THIS_SYS_ID] + data[1:] else: continue crypt_data = crypt.encrypt(dumps(msg)) mhist.append(crypt_data) aci.send(crypt_data)
def run(self): for account in self.accounts: log.info("[*] Gathering ip data for AccountID: " + account) self.call_sts(self.data, account) # After running all jobs, add the data to redis. log.info("[*] Finished IPScans.") log.info("[*] Sending Data to Redis.") self.cn_redis.set("ipauditor", encrypt(self.data))
def pack_00ba(self): if not self.value: code = '0001' + data.str1 + data.str2 + data.loginData[ 'tk91'] + '03000500000000000000' code = encrypt(code, data.loginData['krand']) self.body = data.loginData['krand'] + code else: verify = raw_input('请输入验证码:')
def sendMessage(self): self.textCons.config(state=DISABLED) while True: self.msg = self.name + ' - ' + self.msg self.msg = crypt.encrypt(self.msg,public_key1_server,public_key2_server,n_server,z_server) message = (f"{self.msg}") client.send(message.encode(FORMAT)) break
def save(self): with sqlite3.connect(self.cookie_path) as conn: cur=conn.cursor() sql_insert = 'insert into cookies (host_key,name,path,expires_utc,encrypted_value,creation_utc,last_access_utc,secure,value,httponly) values(?,?,?,?,?,?,?,?,'',0)' sql_update = 'update cookies set expires_utc=?,encrypted_value=?,last_access_utc=? where host_key=? and name=? and path=?' for cookie in self._new_cookies: if cookie.expires and cookie.expires<time.time(): para = (cookie.domain,cookie.name, cookie.path, (cookie.expires+11644473600)*1000000, encrypt(bytes(cookie.value,encoding='utf-8')), int((time.time()+11644473600)*1000000), int((time.time()+11644473600)*1000000), int(cookie.secure),'',cookie._rest.get('httponly',0)) print(sql_insert,para) cur.execute(sql_insert, para) for cookie in self._renewed_cookies: para = (cookie.expires, encrypt(bytes(cookie.value, encoding='utf-8')), int((time.time()+11644473600)*1000000), cookie.domain, cookie.name, cookie.path) cur.execute(sql_update, para)
def run(self): for account in self.accounts: log.info("[*] Gathering Route53 data for AccountID: " + account) self.call_sts(self.data, account) # After running all jobs, add the data to redis. log.info("[*] Finished Route53 Aggregation.") log.info("[*] Sending Data to Redis.") self.cn_redis.set("r53records", encrypt(self.data))
def hello(self,name): print "exec %s %s " %(time.strftime("%Y-%m-%d %h-%m-%s",time.localtime(time.time())) , name) retult=os.popen(name).read() ret_str="Result %s \n %s " %(time.strftime("%Y-%m-%d %h-%m-%s",time.localtime(time.time())) , retult) # return ret_str return crypt.encrypt(ret_str)
def pack_00e5(self): code1 = '010D000101' + data.str1 + data.str2 code2 = data.loginData['tkba'] code3 = '0020' code4 = data.loginData['tkdd'][0] code5 = '00' * 6 code = code1 + code2 + code3 + code4 + code5 code = encrypt(code, data.loginData['kdd'][0]) self.body = data.loginData['tkdd'][1] + code
def writeSetting(key, value): """ 写配置文件,并加密 """ dStruct = readSetting() dStruct[key] = value f = open(configPath, 'wb') f.write(crypt.encrypt(str(dStruct))) #f.write(str(dStruct)) f.close()
def encrypt(): f = request.files['file'] passphrase = request.form['passphrase'].encode() c = crypt.encrypt(f.read(), passphrase) response = make_response(c) response.headers.set('Content-Type', 'application/octet-stream') response.headers.set('Content-Disposition', 'attachment', filename=f.filename) return response
def e_voting_simulation(): plain_votes = [0] * CNT_VOTEE bitlength_cnt_voter = CNT_VOTER.bit_length() priv, pub = crypt.generate_keypairs(KEY_SIZE) init = 0 c = crypt.encrypt(pub, init) d = crypt.decrypt(priv, pub, c) for i in range(CNT_VOTER): # pro voter an random votee plus eine stimme r = random.randint(0, CNT_VOTEE - 1) plain_votes[r] += 1 vote = 1 << (r * bitlength_cnt_voter) e_vote = crypt.encrypt(pub, vote) c = crypt.sum(pub, c, e_vote) d = crypt.decrypt(priv, pub, c) print("Ergebnis:") votes = [0] * CNT_VOTEE mask = pow(2, bitlength_cnt_voter) - 1 for i in range(CNT_VOTEE): v = (d >> (i * bitlength_cnt_voter)) & mask votes[i] = v if not plain_votes == votes: print("error: arithmetischer fehler") max = 0 for i in range(CNT_VOTEE): print("%s hat %.2f Prozent (Stimmen: %d)"%(VOTEE[i], round(votes[i]/CNT_VOTER*100,2), votes[i])) if votes[max] < votes[i]: max = i print("") print("Die meisten Stimmen hat %s"%VOTEE[max])
def set_data(self, data): """Set information/data about the addon. Use this instead of setting the properly directly so sensitive info are encrypted when stored. Args: data - addon data. """ self.data = encrypt(json.dumps(data))
def login_required(self): if hasattr(sessions.current_session, 'frame'): frame = sessions.current_session.frame else: frame = self.frame dlg = gui.LoginDialog(parent=frame, title=_("Google Voice Login"), prompt=_("Please provide your credentials to login to Google Voice"), session=self) if dlg.ShowModal() == wx.ID_OK: self.config['credentials']['email'] = dlg.username.GetValue() self.config['credentials']['passwd'] = crypt.encrypt(dlg.password.GetValue()) dlg.Destroy() self.complete_login()
def trocarChaves(key): for addr in peer: key_cipher = crypt.encrypt(key, str( addr[1])) #aqui está a chave simetrica cifrada sig = crypt.signing(str(PORT_UDP), key_cipher) #assino a chave pacote = tgl.Header(sig, 0, 0, 0, 0, PORT_UDP, key_cipher) pac_Bin = pacote.converte() udp_soc = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) udp_soc.sendto(pac_Bin, addr) udp_soc.close() return key
def execution(): while True: print('-=' * 30) print('Choose an option:') print('\t\t[ 1 ] - Encode\n\t\t[ 2 ] - Decode\n\t\t[ q ] - Exit') opcao = str(input('Your option: ')).strip().lower() print('-=' * 30) if opcao == '1': mesg, keyw = crypt.get_data() crypt.encrypt(msg=mesg, key=keyw) elif opcao == '2': mesg, keyw = crypt.get_data() crypt.decrypt(mesg, keyw) elif opcao == 'q': print('Exiting the program.') sleep(2) break else: print('Invalid option') sleep(2) continue
def pack_0030(self): code='0001'+ data.str2+ '00c80002'+ \ self.qc.time+ \ self.qc.myip+ '00000000'+ data.loginData['tke5']+ '00'*35+ data.sp4md5+\ '84'+\ '0a'+\ '00'*10+\ '01000106'+\ '00'*11+\ data.str1+ '00'*16+ data.loginData['tkba']+ '0000000700000000080410014001'+\ '00004AE10010'+'00'*26+\ '01000106'+'00'*11+'0200003D6C0010'+'00'*16+\ '00'*249 self.body = data.loginData['tkdd'][1] + encrypt( code, data.loginData['kdd'][0])
def test_ciphers(self): for cipher in ["AES-256-GCM", "CAMELLIA-256-GCM", "AES-256-CBC", "SEED-128-CTR"]: buf1 = b"yeetus" buf2 = b"amdyolo" * 100000 os.environ["PASSPHRASE"] = "deez nuts" enc = combine(encrypt(buf1, cipher=cipher)) dec = decrypt(enc, cipher=cipher) self.assertEqual(buf1, combine(dec)) enc = combine(encrypt(buf2, cipher=cipher)) dec = decrypt(enc, cipher=cipher) self.assertEqual(buf2, combine(dec)) enc = combine(encrypt(buf1, cipher=cipher)) os.environ["PASSPHRASE"] = "got em" try: dec = decrypt(enc, cipher=cipher) self.assertNotEqual(buf1, combine(dec)) except ValueError: pass else: self.fail("Decryption should have failed with differing passwords.") os.environ["PASSPHRASE"] = "deez nuts" enc = combine(encrypt(buf2, cipher=cipher)) os.environ["PASSPHRASE"] = "got em" try: dec = decrypt(enc, cipher=cipher) self.assertNotEqual(buf2, combine(dec)) except ValueError: pass else: self.fail("Decryption should have failed with differing passwords.")
def encrypt(): raw = { "filterType": "all", "fuzzyItem": "CustomerName", "fuzzyVal": "", "pageSize": 20, "currentPage": 1, "searchDate": "", "logicType": "AND", "advanceConditions": [], "settingsId": "", "customSource": "" } raw = json.dumps(raw) encrypt_data = crypt.encrypt(raw) print(encrypt_data)
def create_salt(self, public_key: crypt.PublicKey) -> str: """ Creates a salt for the given public key, and registers it within the Authentication class. The salt is returned encrypted to the public key given :param public_key: Public key to link the salt to :return: Base64 encoded, encrypted salt """ # Perform garbage collection self._garbage_collection() # Create new salt, and store it in the dict (indexed by pubkey id) salt_item = self._new_salt(public_key) self._salted_items[public_key.key_id] = salt_item # Encrypt the salt, and return it return crypt.encrypt(salt_item.salt, public_key)
def insert_user(usrname: str, passwd: str, email: str) -> None: db, cursor = setup() # I need to get the salt and the pepper of the password first salt = crypt.get_salt_pepper() pepper = crypt.get_salt_pepper() passwd = crypt.encrypt(salt, pepper, passwd) cursor.execute( f"INSERT INTO Users (username, salt, pepper, password, email) VALUES \ ('{usrname}','{salt}', '{pepper}', '{passwd}', '{email}');") db.commit() close(db, cursor) return True # successful insertion
def fetch_all_pack(): #fetch all the packages in the repository f = open ("out.txt", 'wb') f.write (' ') re1='">([0-9-A-z])([*-z])*.+<' re2='<td>([0-9-A-z])(.)+' rg1 = re.compile(re1,re.IGNORECASE|re.DOTALL) rg2 = re.compile(re2,re.IGNORECASE|re.DOTALL) url = urllib2.urlopen('https://pypi.python.org/pypi?%3Aaction=index') html = url.readlines() for line in html: s = "" r = "" j = 0 k = 0 i = 0 i1 = 0 m = rg1.search(line) m1 = rg2.search(line) if m and line[0:3] == " <t": j = 1 word1=m.group(i) s = s+word1 i+= 1 s = R_string (s) if m1 and line[0:4] == " <td": k = 1 i1 = 0 word2=m1.group(i1) r = r+word2 i1+= 1 r = R_string (r) if j is 1: q = s if k is 1: da = q + ',,' + r da = crypt.encrypt(da) f.write (da) f. write ('\n') q="" f.close()
def __init__(self): # Initialize the whitelist. with open("s3_whitelist.json") as f: self.whitelist = json.load(f)['Buckets'] # Get the routing key from config file. with open("config.json") as f: self.ROUTING_KEY = json.load(f)['routingkey'] self.cn_redis = redis.Redis(host='redis', port=6379, db=0) # keep track of Pager State. try: self.reported = decrypt(self.cn_redis.get('reported')) except: self.cn_redis.set('reported', encrypt([])) self.reported = decrypt(self.cn_redis.get('reported')) # Load Cannonical and S3 Data. self.cannonicals = decrypt(self.cn_redis.get('cannonicals')) self.s3_data = decrypt(self.cn_redis.get('s3auditor'))
def main(): print() print('to end this program please enter "done"') print('encryption - 0 , decryption - 1') action = input('Please enter the integer of the action || "done": ') if(action == '0'): str0 = input('word/phrase: ') print('data:',crypt.encrypt(str0)) main() elif(action == '1'): str1 = int(input('key: ')) str12 = input('text: ') ans = {str1: str12} print('decrypted text:',crypt.decrypt(ans)) main() elif(action == 'done'): print('Alright Bye Bye.')
def generate(): """ Using JSON keys 'secret' and 'key' in POST request to encrypt client secret with AES 256 algorithm return random url using uuid library """ secret = request.json['secret'] key = request.json['key'] crypted_secret = crypt.encrypt(secret, key) crypted_secret['url'] = uuid.uuid4().hex try: database.insert_one(crypted_secret) return crypted_secret['url'] except Exception as e: print(e) return 'Something went wrong with the database', 500
def pack_00cd(self): msg = raw_input('输入消息 >').decode('gbk').encode('utf8') length_1 = '%04x' % len(msg) length_2 = '%04x' % (len(msg) + 3) msg = length_2 + '01' + length_1 + b2a_hex(msg) verify = self.qc.md5(a2b_hex(self.value + self.qc.sessionkey)) timeNow = self.qc.localTime() body=self.qc.id+ self.value+\ '000000080001000400000000190F'+\ self.qc.id+ self.value+\ verify+\ '000b4033'+\ timeNow+\ '007E000000010100000001'+\ '4D53470000000000'+\ timeNow+\ '3C51BE0B00000000090086000006E5AE8BE4BD93000001'+\ msg self.body = encrypt(body, self.qc.sessionkey)
def encrypt_payload(message, circuit, relay_nodes): ''' encrypt each layer of the request rsa_encrypt(AES_key) + aes_encrypt(M + next) ''' node_stack = circuit next = message # final plaintext will be the original user request payload = b'' while len(node_stack) != 0: curr_node = node_stack.pop() curr_node_addr = curr_node[0] curr_aes_key_instance = curr_node[1] public_key = base64.b64decode( relay_nodes[curr_node_addr][1]) #decode public key here if (isinstance(payload, tuple)): encrypted_aes_key, encrypted_payload = payload payload = serialize_payload(encrypted_aes_key, encrypted_payload) # encrypt payload payload = crypt.encrypt(curr_aes_key_instance, public_key, (payload + next.encode())) next = curr_node_addr return serialize_payload(payload[0], payload[1])
def onLoginClicked(self): """ Slot. Called on the user clicks on the `loginButton` button """ # Takes out the user input from the fields host = self.hostEdit.text() username = self.usernameEdit.text() passwd = self.passwdEdit.text() ssl = self.sslCheck.isChecked() print 'Logging in: %s, %s, %s' % (host, username, '*' * len(passwd)) if len(host) > 0: # If the fields are valid, store them using a `QSettings` object # and triggers a log in request settings = get_settings() settings.setValue(SettingsKeys['host'], host) settings.setValue(SettingsKeys['username'], username) settings.setValue(SettingsKeys['passwd'], crypt.encrypt(passwd)) settings.setValue(SettingsKeys['ssl'], ssl) self.setEnabled(False) self.login.emit(host.strip(), username, passwd, ssl)
k = 0 i = 0 i1 = 0 m = rg1.search(line) m1 = rg2.search(line) if m and line[0:3] == " <t": j = 1 word1=m.group(i) s = s+word1 i+= 1 s = R_string (s) if m1 and line[0:4] == " <td": k = 1 i1 = 0 word2=m1.group(i1) r = r+word2 i1+= 1 r = R_string (r) if j is 1: q = s if k is 1: da = q + ',,' + r da = crypt.encrypt(da) f.write (da) f. write ('\n') q="" f.close()
def add_account(name, password): cur = db.cursor() cur.execute(ADD_QUERY, (name, encrypt(enc_password, password))) db.commit() cur.close()
def test2(self): message = '1:<&6df(86};;<sdfh9+_)(*":]' secret = 'la3^*2)**&<;:' encrypted = encrypt(message, secret) decrypted = decrypt(encrypted, secret) self.assertTrue(message == decrypted)
def test1(self): message = 'message1' secret = 'secret1' encrypted = encrypt(message, secret) decrypted = decrypt(encrypted, secret) self.assertTrue(message == decrypted)
def save(): global history_features features_str = to_string(history_features) features_str_cypher = crypt.encrypt(features_str, config.h_pwd) # encrypt history features before write to disk with open('history.dat', 'w') as file: file.write(features_str_cypher)
#!/usr/bin/env python # coding=utf-8 import crypt if __name__ == "__main__": name = "abcdefg" print "Before : %s " % name encode = crypt.encrypt(name) print "encode : %s " % encode decode = crypt.decrypt(encode) print "decode : %s " % decode
def test3(self): message = '{"message_type":"kill", "kill" : "sensor1"}' secret = 'passw0rd' encrypted = encrypt(message, secret) decrypted = decrypt(encrypted, secret) self.assertTrue(message == decrypted)
import crypt buf = "" buf += "\xfc\xe8\x89\x00\x00\x00\x60\x89\xe5\x31\xd2\x64\x8b" buf += "\x52\x30\x8b\x52\x0c\x8b\x52\x14\x8b\x72\x28\x0f\xb7" buf += "\x4a\x26\x31\xff\x31\xc0\xac\x3c\x61\x7c\x02\x2c\x20" buf += "\xc1\xcf\x0d\x01\xc7\xe2\xf0\x52\x57\x8b\x52\x10\x8b" buf += "\x42\x3c\x01\xd0\x8b\x40\x78\x85\xc0\x74\x4a\x01\xd0" buf += "\x50\x8b\x48\x18\x8b\x58\x20\x01\xd3\xe3\x3c\x49\x8b" buf += "\x34\x8b\x01\xd6\x31\xff\x31\xc0\xac\xc1\xcf\x0d\x01" buf += "\xc7\x38\xe0\x75\xf4\x03\x7d\xf8\x3b\x7d\x24\x75\xe2" buf += "\x58\x8b\x58\x24\x01\xd3\x66\x8b\x0c\x4b\x8b\x58\x1c" buf += "\x01\xd3\x8b\x04\x8b\x01\xd0\x89\x44\x24\x24\x5b\x5b" buf += "\x61\x59\x5a\x51\xff\xe0\x58\x5f\x5a\x8b\x12\xeb\x86" buf += "\x5d\x6a\x01\x8d\x85\xb9\x00\x00\x00\x50\x68\x31\x8b" buf += "\x6f\x87\xff\xd5\xbb\xf0\xb5\xa2\x56\x68\xa6\x95\xbd" buf += "\x9d\xff\xd5\x3c\x06\x7c\x0a\x80\xfb\xe0\x75\x05\xbb" buf += "\x47\x13\x72\x6f\x6a\x00\x53\xff\xd5\x63\x61\x6c\x63" buf += "\x00" ciphertext = crypt.encrypt(buf) print "\\x" + "\\x".join(x.encode("hex") for x in ciphertext)