Hooper Labs

Networking Notes (TCP/IP)

Iptables

IPV6 iptables rules

	cat /etc/iptables/rules.v6

IPv4 iptables rules

	cat /etc/iptalbes/rules.v4

Wireless Configuration

Configure wlan0 interface

	ifconfig wlan0 

Start DNS/DHCP server

	service dnsmasq restart

Enable routing

	sysctl net.ipv4.ip_forward=1

Enable NAT

	iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Run access point daemon

	hostapd /etc/hostapd/hostapd.conf

WireShark Decrypt SSL Traffic

	Create SSLKEYLOGFILE environment variable pointing to log file.  (May have to run Chrome.exe --ssl-key-log-file=C:\Temp\ssl-keys.log

Scapy

Import Scapy

	from scapy.all import scapy

Send ICMP with Payload

	send(IP(dst="10.1.99.2")/ICMP()/"HelloWorld")

Read a PCAP File

	rdpcap('/path/to/pcap.cap')

Show a Summary

	myPackets.show()

Show TCP Layer of Packet

	myPackets[1][TCP]

Change src IP of packet

	packet.src = "127.0.0.1"

Gather all "Raw" data of every packet

	pkt[Raw].load for pkt in TCP_PACKETS if Raw in pkt

SSH

SSH Hop through host

	ssh -J user1@host1 user2@host2

Upload File with SSH

	ssh user1@host1 tee rfile < lfile

Download File with SSH

	ssh user1@host1 cat rfile > lfile

Socat Redirector

Detatch process from shell

	screen

Redirect with socat

	sudo socat TCP4-LISTEN:80,fork TCP4:secure.losenolove.com:80

Detatch Screen

	screen -d