nettitude / PoshC2

A proxy aware C2 framework used to aid red teamers with post-exploitation and lateral movement.
BSD 3-Clause "New" or "Revised" License
1.78k stars 323 forks source link

[BUG] PY_SSIZE_T_CLEAN macro must be defined for '#' formats #267

Closed Everlastdg closed 1 year ago

Everlastdg commented 2 years ago

Description

A clear and concise description of what the bug is. While starting the server, during creation of Donut shellcode I receive: "Donut shellcode files: PY_SSIZE_T_CLEAN macro must be defined for '#' formats"

Execution Environment:

Linux kali 5.18.0-kali5-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.5-1kali5 (2022-07-04) x86_64 GNU/Linux

Full Posh version (all the text between the === at the top of the Implant Handler) | PoshC2 v8.0 (edaa5e8 2022-07-20 08:55:44) OS & version | Linux kali 5.18.0-kali5-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.5-1kali5 (2022-07-04) x86_64 GNU/Linux Using Docker/containerisation? | NO

To Reproduce

Steps to reproduce the behavior:

  1. posh-server
  2. wait
  3. See error: Traceback (most recent call last):
    File "/home/kali/toolz/PoshC2/poshc2/server/C2Server.py", line 483, in main
    existingdb(DatabaseType)
    File "/home/kali/toolz/PoshC2/poshc2/server/C2Server.py", line 434, in existingdb
    newPayload.CreateAll()
    File "/home/kali/toolz/PoshC2/poshc2/server/payloads/Payloads.py", line 794, in CreateAll
    self.CreateDonutShellcode(name)
    File "/home/kali/toolz/PoshC2/poshc2/server/payloads/Payloads.py", line 734, in CreateDonutShellcode
    self.CreateDonutShellcodeFile(Payload, name)
    File "/home/kali/toolz/PoshC2/poshc2/server/payloads/Payloads.py", line 753, in CreateDonutShellcodeFile
    shellcode32 = donut.create(file=f"{self.BaseDirectory}{name}{sourcefile}", arch=1)
    SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
    [>] Create new DB and remove dir (/var/poshc2/local_test/)

After removing that dir, recreating the project and running posh-server the problem persists.

Expected behavior

The server should start and the donut shellcode should be created with no issues

Additional context

Posh was installed via cloning the main repository and running the installer script

riskydissonance commented 2 years ago

Hi @Everlastdg, thanks for this, it should be fixed on the python3.10 branch, are you able to confirm?

Everlastdg commented 2 years ago

I do confirm!

riskydissonance commented 2 years ago

Sweet ty, PR is up: https://github.com/nettitude/PoshC2/pull/268 will make its way to master.