Skip to end of metadata
Go to start of metadata

Просмотр таблицы маршрутов

route -e
netstat -r
ip route 

Замена traceroute командой ping

Разные типы пакетов ICMP, но в общем случае подходит, если все хосты трассы пингуемы.

traceroute <remote-host>
mtr <remote host>

= (Если в качестве аргумента указать айпишник, то трасса получается ОЧЕНЬ быстро)


REMOTE_HOST_2=`host $1 | grep 'has address' | awk '{printf $4}'`

echo Tracing host $REMOTE_HOST\($REMOTE_HOST_2\)

while [ "$REMOTE_HOST" != "$TARGET_HOST" -a "$REMOTE_HOST_2" != "$TARGET_HOST" ]
    TARGET_HOST=`ping -c 1 -t $TARGET_TTL $REMOTE_HOST | grep 'exceeded' | awk '{printf $2}'`
    if [ "$TARGET_HOST" != "" ]

Пересылка файла по сети

Пересылка между А и В, где сначала А посылает, далее В принимает

#On A:
cat | nc -l -p 1234

#On B:
netcat 1234 >

Пересылка между А и В, где сначала А слушает и пассивно ждет (как сервер), далее В отсылает

#On A:
nc -l -p 1234 -q 1 > < /dev/null

#On B:
cat | netcat 1234

NIC configure

ifconfig ethN ip/cidr # set IP 1-time
route add default gw $GW_IP # add default gateway route


Show HTML page with verbose output on connection

curl -v

Download HTML page

curl -o example.html

Download multiple files in one TCP session

curl -O libiconv-1.14.tar.gz -O -O

Resume download tranfser

curl -C - -O

See only answer to request

curl -I

Curl via proxy

curl -x http://proxyserver:proxyport --proxy-user user:password -L

Ignore SSL certificate error

curl -k

FTP download with curl

curl --user username:password -o
curl --user username:password # first see FTP directory structure

FTP upload with curl

curl -T --user username:password

Delete file on FTP with curl

curl -X 'DELE' --user username:password

Send EMAIL with curl

curl --url "smtps://" --ssl-reqd   --mail-from "" --mail-rcpt ""   --upload-file mailcontent.txt --user "" --insecure

In the above command, replace smtps:// with your SMTP server and port.

--mail-from: This field contains the from address that the receiver should see.

--mail-rcpt: This field contains TO address

--upload-file: The file provided here should contain your message as a content

--user: SMTP user@domain:password

--insecure option used is exactly same as using -k option we saw earlier, to ignore unknown SSL certificates.

Просмотр списка сетевых интерфейсов

ifconfig -s 
netstat -i 
ip addr 

Network monitoring utilities


Network Statistics

Provides info on:

  • Open sockets
  • Kernel routing tables
  • NICs
  • Masquerade connections
  • Protocol statistics
netstat -a # list all tcp/udp sockets
netstat -at # list all TCP sockets
netstat -l # list all listening sockets
netstat -lu # list all listening UDP sockets
netstat -lx # list all listening UNIX domain sockets
netstat -s # display protocol statistics
netstat -c # display protocol statistics in continuous mode
netstat -r # routing table (same as "ip r")
netstat -i # display network interface details

netstat -p # PID info (most useful, can be used with another params - shows Linux processes with their net activity.)

netstat -tulpn # list TCP+UDP listening ports, PID of processes on them, use numerical addresses


Provides info on current network connections.

-t - TCP ports
-p - list processes using sockets

watch ss -tp


Interactive IP LAN Monitor

Shows: TCP info, UDP counts, ICMP info, OSPF info, Ethernet load, node stats, IP checksum errors

iptraf -i eth0 -t 1 -B -L /tmp/iptraf.log # batch collect statistics for 1 minute and write them in log file


Wi-Fi frequency scanner

iwlist <wlan0> scan # scan for Wi-Fi using WiFi interface wlan0



Wget over proxy

wget --no-host-lookup --proxy=on --proxy-user=blablabla --proxy-passwd=blablabla

Download via wget:

# Edit config file /etc/wget/wgetrc  
# Add lines

http_proxy = http://your_proxy:port  
ftp_proxy = http://your_proxy:port  
# If you do not want to use proxy at all, set this to off.  
use_proxy = on


"Power version" of Telnet. Does network connections using TCP/UDP. There are several Netcats available, best one is ncat - made by nmap team.

Telnet usage:

$ ncat -v 80
GET index.html HTTP/1.1

When ncat is connected (with -v = verbose flag), send a message, like fetching the start page. Press ENTER twice after message sent.

Socket server usage - make a simple socket server, by listening to port 8091:

$ ncat -l -v 8091 > serverlog.log

When connection with Telnet or browser to ncat server, info is given on the clients and is saved to the log file specified.

UDP socket server:

$ ncat -ul -v 8091 > serverlog.log

Remote Shell/Backdoor - ncat can start a basic shell with no SSH needed:

$ ncat -v -l -p 7777 -e /bin/bash

Server on port 7777 will listen for incomings