Skip to content
leg3ndProjects & tools
01Home02Projects03Tools04Notes
GMT+8
O/ OSCP exploitation reference
Workspace controls Memory only · 0 steps
Visualize path ↗
Command values 0 filled

Temporary connection values clear on reload. Passwords, hashes and tickets remain placeholders. Check address-family syntax in the selected command.

Reference index ↗ Search all procedures & variants ↗
01Discovery02Enumeration03Initial access04Usable access05Local privilege06Active Directory07Internal access08Evidence & reporting

QUICK REFERENCE

Discovery›Services›Web mapping›Web exploitation›Credentials›Public exploits›Sessions & transfers›Linux escalation›Windows escalation›AD enumeration›AD identity attacks›Lateral movement›Pivoting & tunnels›Execution troubleshooting›Integration & evidence›
174 methods · 15 topicsFull reference on GitHub ↗Commands · scripts · next steps
Tools/OSCP/Initial access/Public exploits
← All public exploits tasks

Audit a PoC and reproduce its interpreter/dependency environment

CommandsIf → thenExplanation & examples

Needs: Reviewed source, understood network/file actions, correct interpreter and compatible isolated dependencies

Start with metadata and readable text

# Start with metadata and readable text
file EXPLOIT_FILE
sha256sum EXPLOIT_FILE
sed -n '1,240p' EXPLOIT_FILE
grep -nEi 'sudo|setuid|chmod|chown|rm |unlink|remove|subprocess|system\(|popen|exec\(|socket|connect|requests|curl|wget|powershell|cmd\.exe|/bin/(ba)?sh|http://|https://' EXPLOIT_FILE

If only a binary exists, treat it as a substantially higher-risk choice

For binaries, prefer obtaining inspectable source. If only a binary exists, treat it as a substantially higher-risk choice:

# If only a binary exists, treat it as a substantially higher-risk choice
file EXPLOIT_BINARY
sha256sum EXPLOIT_BINARY
strings -a EXPLOIT_BINARY | less
objdump -f EXPLOIT_BINARY

# Baseline
head -n 1 EXPLOIT_FILE
python3 --version
gcc --version
file EXPLOIT_FILE

After source review

  1. where the exploit program itself runs;
  2. the vulnerable target process;
  3. the payload that will execute inside or on the target.

A remote Python exploit may run on Kali while delivering a Windows x64 payload. A local Linux exploit normally must run on the target-compatible architecture. Compiler choice follows the produced program; payload choice follows the target execution context.

# After source review
python3 -m py_compile exploit.py
python3 exploit.py --help

# Isolate explicit dependencies
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip freeze > requirements-resolved.txt

Useful diagnostics

Run --help only after confirming that module import and argument handling do not trigger the exploit. Old Python 2 syntax, str/bytes mistakes, renamed modules and obsolete TLS dependencies are runtime problems, not target evidence.

# Useful diagnostics
python3 -X dev exploit.py ARGUMENTS
python3 -m trace --trace exploit.py ARGUMENTS

# Linux/Kali virtual environment
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

Use tracing only when its output is bounded and does not expose credentials. Prefer adding a few prints around the failing request/parser over changing many lines at once.

Install one explicitly selected package only when needed

# Install one explicitly selected package only when needed
python -m pip install PACKAGE

# Linux/Kali virtual environment
python -m pip show PACKAGE
python -m pip freeze
deactivate

Windows PowerShell

# Windows PowerShell
py -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
deactivate

Reproducibility checks

# Reproducibility checks
python --version
python -m pip --version
python -m pip freeze > requirements-resolved.txt

# uv alternative for a Python PoC with missing dependencies
# Run outside the current project's dependencies, supplying the known dependency
uv run --no-project --with requests exploit.py --help

# For a script with its own inline dependency metadata
uv run --script exploit.py --help

Read: a working help/import path establishes the local runtime only. Inspect actual arguments, authentication and target requirements before execution. Pin dependency versions when the PoC depends on an older API; an ImportError and a target-side exploit failure are different boundaries. Dependency resolution can require Internet access.

Verify → Confirm interpreter/dependency identity and observable intended request behavior; preserve the reviewed source and changes.

If it fails → Do not solve every old script with a global package change. Inspect Python-version semantics and choose a supported environment or minimal reviewed edit. More detail ↓

If → then

  • An exploit sends requests but authentication, routing or parsing differs from the target → Repair a web PoC using the real HTTP transaction

    Needs: A valid baseline transaction with correct host, base path, session/CSRF state and request encoding

  • An existing C/C++ or platform-specific PoC matches the candidate → Compile and minimally adapt an existing native or memory-corruption PoC

    Needs: Correct compiler/target architecture, runtime dependencies, documented payload constraints and validated exploit-specific constants

  • A simple command works while a longer or nested payload fails → Repair quoting, encoding and command-length boundaries

    Needs: Known outer request/template/database parser and inner shell; correct character encoding and transport length

No useful finding → another task in this topic. Failed check → resolve the failure before ruling out the path.

Explanation & examples

Audit a PoC and reproduce its interpreter/dependency environment

USE WHEN
A plausible exploit fails before reaching the target or has unreviewed side effects
STARTING ACCESS
An identified component/build and a candidate exploit with reviewable source
RESULT
A controlled, reproducible tool environment and an understood PoC

Recognize the clue

Read the candidate source and local error path before interpreting target success/failure; inspect interpreter/import and dependency requirements.

file exploit.py
python3 --version
python3 -m pip --version
SYNTHETIC EXAMPLE OUTPUT
Traceback: ModuleNotFoundError: REQUIRED_MODULE
No target request observed

Means: The failure occurred locally before the vulnerable request; it says nothing about target patch state.

Confirm: Review side effects, reproduce supported dependencies/interpreter and observe the real request before judging exploitation.

After validation
A controlled environment runs the reviewed request: proceed to prerequisite/effect testing.
Ruled out in this context
The script's assumptions target a different runtime/protocol and cannot match this candidate: reject it.
Still inconclusive
An import error leaves target behavior unknown; isolate the environment and repair the documented dependency.

Troubleshooting: Do not solve every old script with a global package change. Inspect Python-version semantics and choose a supported environment or minimal reviewed edit.

Additional prerequisite checks

file exploit.py
python3 --version
python3 -m venv .venv
. .venv/bin/activate

Start with metadata and readable text:

For binaries, prefer obtaining inspectable source. If only a binary exists, treat it as a substantially higher-risk choice:

Audit for:

  • unexpected privilege requirements on the attacking host;
  • destructive file/process/service operations or denial of service;
  • downloads, callbacks or telemetry to third parties;
  • embedded credentials, tokens, commands or payloads;
  • files written or overwritten and their cleanup behavior;
  • hard-coded target addresses, ports, paths, virtual hosts and callback values;
  • authentication, cookie, CSRF, redirect, TLS and proxy assumptions;
  • target OS, architecture, runtime, library and payload assumptions;
  • success messages that are printed without verifying the claimed effect.

Safety cue: use source, a disposable environment and a clean snapshot when uncertainty remains. Do not grant sudo merely because an unknown PoC requests it.

Separate three architectures:

  1. where the exploit program itself runs;
  2. the vulnerable target process;
  3. the payload that will execute inside or on the target.

A remote Python exploit may run on Kali while delivering a Windows x64 payload. A local Linux exploit normally must run on the target-compatible architecture. Compiler choice follows the produced program; payload choice follows the target execution context.

After source review:

Isolate explicit dependencies:

Run --help only after confirming that module import and argument handling do not trigger the exploit. Old Python 2 syntax, str/bytes mistakes, renamed modules and obsolete TLS dependencies are runtime problems, not target evidence.

Useful diagnostics:

Use tracing only when its output is bounded and does not expose credentials. Prefer adding a few prints around the failing request/parser over changing many lines at once.

Use when: a source-based Python assessment tool has dependencies that should not modify Kali's system Python. This is setup/reference material, not authorization to install a tool.

Linux/Kali virtual environment

Install one explicitly selected package only when needed:

PEP 668 intentionally protects externally managed system environments. Do not bypass it with --break-system-packages; use a venv or the distribution package when appropriate.

Windows PowerShell
Reproducibility checks

Record the tool source/commit, Python version, dependency file and exact command. Keep environments per tool when their dependency ranges conflict.

uv alternative for a Python PoC with missing dependencies

Use when uv is already available and the reviewed script needs a small dependency set. Keep the baseline venv workflow as an option when uv is absent.

Read: a working help/import path establishes the local runtime only. Inspect actual arguments, authentication and target requirements before execution. Pin dependency versions when the PoC depends on an older API; an ImportError and a target-side exploit failure are different boundaries. Dependency resolution can require Internet access.

Sources: upstream 1.

Why it works

A syntax/import/dependency failure is a local environment issue, not evidence that the target is patched. Dependencies and downloaded payloads can themselves execute code.

Worked example · hypothetical

Observation: a PoC exits with an import error before any request. Test: inspect imports and reproduce its documented environment. Illustrative output: local initialization succeeds. Interpretation: proceed to the target transaction; no vulnerability conclusion was possible earlier.

New identity, privilege, host or route? Re-enumerate → All topic tasks →

Study guide ↗Full procedure ↗Cheatsheet ↗
HomeProjectsToolsNotes
Interactive toolsOSCP notes ↗Extended OSCP workspace ↗Attack-path visualizer ↗

© 2026 Armaan. Built with curiosity.

GitHub ↗GMT+8