network

locate servers in network

nmap -p22 --open '192.168.100.0/24'
# nmap '192.168.100.0/24'

list open ports

lsof -nP -i'TCP:22' -i'TCP:1313' -s'TCP:LISTEN'
# lsof -nP -i'TCP' -s'TCP:LISTEN'

list active connections

lsof -nP -i'TCP' -s'TCP:ESTABLISHED'

dns query records

# dig @1.1.1.1 +trace example.com AAAA
dig @1.1.1.1 +short example.com AAAA

curl

debug requests

curl \
   --silent --show-error \
   --fail --fail-early \
   --compressed --location \
   --create-dirs \
   --dump-header - --output - \
   --write-out '
           time_namelookup:  %{time_namelookup}
              time_connect:  %{time_connect}
           time_appconnect:  %{time_appconnect}
          time_pretransfer:  %{time_pretransfer}
             time_redirect:  %{time_redirect}
        time_starttransfer:  %{time_starttransfer}
                           ----------
                time_total:  %{time_total}
    ' \
   --request GET --url https://example.com

ip address

# curl https://ident.me/  # https://api.ident.me/
curl https://ident.me/json | jq
# curl https://checkip.amazonaws.com/

qr code

echo "my text" | curl --form 'data=<-' https://qrenco.de/

weather

curl https://v2.wttr.in/curitiba
# curl https://wttr.in/curitiba

netcat

listen to port

netcat -vvv -l -p 8000 -s localhost

connect to server

netcat -vvv localhost 8000

port tunnel

netcat -vvv -L "localhost:8001" -p 8000 -s localhost