Networking (Linux)
Post

Networking (Linux)

PSPY

Pspy github download Monitoring Services running

1
./pspy64

Examples: Epsilon

IP Address

1
2
3
ifconfig -a
ip address show
ip a s

DNS

1
cat /etc/resolv.conf

Network connections

1
2
3
4
netstat -tulnpa
ss -tulnpwr
lsof -i
watch ss -twurp `connections in live`

Running services

1
2
ps -aux
ps -ef

Routing and ARP Tables

1
2
3
route -n
ip ro show
arp -a 
1
ip xfrm state list

Iptables Rules (requires root)

1
2
3
iptables -L -n
cat /etc/iptables
iptables-save

Sometimes a one-liner is slowly, to play with threads we can create a script and disown the process of this one-liner in such way that the loop does not run one instruction at a time, this can be achieved with amperson (&)

Host Scanner

1
2
3
4
#!/bin/bash
for i in $(seq 1 255):
do
        timeout 1 bash -c "ping -c 1 192.168.122.$i &>/dev/null" && echo "[+] IP 192.168.122.$i active" & done; wait

Examples: Fulcrum

Port Scanner

1
2
3
4
5
6
#!/bin/bash
host=192.168.122.228
for port in {1..65535}; do
    timeout .1 bash -c "echo >/dev/tcp/$host/$port" && echo "port $port is open" &
done
echo "Done"

Examples: Fulcrum

Subnet Port Scanner

This is a scanner using proxychains, if you don’t have a proxychains configuration, remove the proxychains command.

1
2
3
4
5
6
7
#!/bin/bash

for port in 21 22 23 25 80 88 443 445 8080 8081 9001; do
        for i in $(seq 1 254); do
                proxychains -q timeout 1 bash -c "echo '' > /dev/tcp/10.241.251.$i/$port" 2>/dev/null && echo "[+] Port $port - OPEN in Host: 10.241.251.$i" &
        done;
done;

Examples: Tentacle