Skip to content
This repository was archived by the owner on Apr 9, 2025. It is now read-only.
/ PyDissect Public archive

Simple terminal-based script that dissects python scripts into bytecode and low-level info!

License

Notifications You must be signed in to change notification settings

DefinetlyNotAI/PyDissect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 PyDissect

A minimal but powerful static and dynamic analyzer for Python scripts.
It parses, inspects, and disassembles Python code to reveal its AST structure, function/class definitions, and bytecode—all exported cleanly into human-readable files.


📦 Features

  • 📄 Dumps the full Abstract Syntax Tree (AST).
  • 🔍 Lists all functions, async functions, and classes with line numbers.
  • 🔬 Outputs full bytecode disassembly of the script.
  • 🧩 Separately disassembles top-level functions for focused inspection.
  • 📁 Saves everything in a cleanly organized folder named after the script.

🚀 Usage

python dissect.py <target_script.py>

Example:

python dissect.py example.py

This will create a folder called example/ in the current working directory containing:


📂 Output Structure

example/
├── ast.txt
├── functions.txt
├── bytecode.txt
└── functions_bytecode.txt

⚠️ Notes

Warning

  • Only top-level functions are disassembled separately. Nested functions, lambdas, etc., aren't isolated.
  • Code execution (exec) is used to analyze function bytecode. Avoid running this tool on untrusted scripts unless sandboxed.

🛠 Dependencies

  • Built-in Python modules only:
    • ast
    • dis
    • os
    • sys

Tested on Python 3.11

🧪 License

MIT License — do whatever, just don’t blame the author if it goes sideways.


Let me know if you want badges, emoji-free version, or to turn this into a PyPI package.

About

Simple terminal-based script that dissects python scripts into bytecode and low-level info!

Topics

Resources

License

Stars

Watchers

Forks

Languages