Skip to content

Instantly share code, notes, and snippets.

@gedsic
gedsic / nmap-http-url.py
Last active January 6, 2026 14:58 — forked from tothi/nmap-http-url.py
Generate HTTP URLs from Nmap XML (and optionally use VirtualHosts)
#!/usr/bin/env python3
#
# inputs: nmap.xml (nmap scan xml output), subdomains.csv (optional virtualhost info, hostname + ip address csv file)
# output: url listing (useful for tools like EyeWitness)
#
# sample usage: ./nmap-http-url.py nmap.xml subdomains.csv | sort -u | gowitness file -f -
#
description = '''
Generate HTTP URLs from Nmap XML (and optionally additional VirtualHost listing, taken from e.g. subdomain enumeration).
@gedsic
gedsic / gettcpports.py
Created November 18, 2024 08:44
Python and Scapy - Get list of all TCP destination ports occuring in a pcap
from scapy.all import *
from natsort import natsorted
packets = rdpcap('in.pcap')
result = []
for packet in packets:
if TCP in packet:
tcpport = str(packet[TCP].dport)
if tcpport not in result:
result.append(tcpport)
@gedsic
gedsic / tcpdumpsynonly.sh
Created November 18, 2024 08:03
tcpdump - record only syn packets
sudo tcpdump -i lo -w out.pcap host 127.0.0.1 and "tcp[tcpflags] & (tcp-syn) != 0"
@gedsic
gedsic / gettcpports.sh
Created April 23, 2024 06:19
Get all open TCP ports from an nmap scan, comma separated (quick and dirty)
cat portscan.nmap | grep "^[0-9]*/tcp" | grep "open" | cut -d '/' -f 1 | sort -h | uniq | tr '\n' ',' | head -c -1
@gedsic
gedsic / flac2mp3.sh
Created April 15, 2021 14:32
Convert FLAC to MP3 using ffmpeg
#!/bin/bash
BITRATE="320k"
for fil in *.flac
do
ffmpeg -i "$fil" -ab $BITRATE -map_metadata 0 -id3v2_version 3 "${fil%.flac}.mp3";
done
@gedsic
gedsic / hexwords.sh
Created January 18, 2016 14:41
List words that can be spelled with hexadecimal digits
#!/bin/bash
cat /usr/share/dict/american-english | grep --ignore-case "^[ABCDEFGILOSZ]*$" | sed 's/[gG]/6/g;s/[iI]/1/g;s/[lL]/1/g;s/[oO]/0/g;s/[sS]/5/g;s/[zZ]/2/g' | tr [:lower:] [:upper:]
@gedsic
gedsic / top1000udp.sh
Created August 12, 2015 08:40
Get top 1000 UDP ports from nmap records
cat /usr/share/nmap/nmap-services | grep "/udp" | sort -k3 -n -r | head -n 1000 | grep -o "[0-9]*/udp" | sed 's/\/udp//g'
@gedsic
gedsic / gist:7544e28f6659a8c7dcf4
Last active August 29, 2015 14:13
For a given sequence of letters, retrieve one random dictionary word starting with each letter
for letter in {h,o,r,s,t}; do grep -i "^$letter.*[^e|en|em|er|et|est|ging]$" /usr/share/dict/ngerman | perl -e '@lines = <>; print $lines [ rand @lines ]'; done
Example output (german):
hinauszögernd
ostafrikanisch
rundend
Scheidewand
Textmaterial