import os import sys import random import string import base64 import binascii import struct from Crypto.Cipher import AES

def main(): if len(sys.argv) < 3: print("./gld shellcode.bin [x64/x86]") return

f = sys.argv[1]
try:
    with open(f, 'rb') as file:
        raw = file.read()
except IOError as e:
    print("[!] " + str(e))
    return

key = os.urandom(32)
nonce = os.urandom(12)
cipher = AES.new(key, AES.MODE_GCM, nonce=nonce)
ciphertext, tag = cipher.encrypt_and_digest(raw)

with open(TEMP, 'wb') as file:
    file.write(struct.pack('<I', len(key)))
    file.write(key)
    file.write(struct.pack('<I', len(nonce)))
    file.write(nonce)
    file.write(struct.pack('<I', len(tag)))
    file.write(tag)
    file.write(ciphertext)

print("[*] Generate template")

if name == "main": main()

用python改写下面的go代码func main 	if lenosArgs 2 		printlngld shellcodebin x64x86		return		f = osArgs1	raw err = ioutilReadFilef	if err != nil 		println! + errError		return		key = makebyte 32	nonce = makeb

原文地址: https://www.cveoy.top/t/topic/ZAQ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录