~scripts
58 itemsDownload ./*

58 itemsDownload ./*

..
display
dzen2
nginx
tiling
vosh
4cdl
4trips
alarm
ambient
battery-monitor
checkit
cleverbot.py
clock
color-gen
colors-hex
colorscheme.sh
compton.sh
dailywall
dmenu
ffthumb
grid
gridmacro
gridmacro.kde
help
importw
indexer
install-all.sh
install-twily.sh
installng
mp3ogg
netspeed.sh
orage
pipes
pipes.x
pipewire_bt.sh
ports
rain
randwall
readystart.sh
rotate.sh
scan.sh
screencast
screencast2
scrot
scrotw
search
skull
slocker
startblender.sh
starwars
streamit
sumnum
synctimedate.sh
tty-colorize
usrmount
ytp
ytplay
zombie-restart.sh


scriptsnetspeed.sh
50•  1 month ago•  DownloadRawClose
1 month ago•  50

{}
#!/bin/bash
# twily-scrpt
# dependencies~
# speedometer, tshark, tcptrack, iftop, traceroute, nethogs, netstat, ssh, dd, sudo, +(iperf, nc/netcat)

opt=$1
add=$2 # port or ip

default_dev="wlp0s20f3"
default_ip=127.0.0.1
default_port=8000

case "$opt" in
    "2") # list port listeners
        sudo netstat -plnt
        ;;
    "3") # nethog list processes
        if [ -z "$add" ]; then add=$default_dev; fi
        sudo nethogs -v 3 -a -C $add
        ;;
    "4") # trace connection
        if [ -z "$add" ]; then add=$default_ip; fi
        traceroute $add
        ;;
    "5") # speedtest between 2 devices
        if [ -z "$add" ]; then add=$default_ip; fi
        ssh amalie@$add 'dd if=/dev/zero bs=1GB count=3 2>/dev/null' | dd of=/dev/null status=progress
        # alt methods
        # nc -vvlnp 12345 >/dev/null
        # dd if=/dev/zero bs=1M count=1K | nc -vvn 10.10.0.2 12345
        #--or
        # iperf -sp 12345
        # iperf -c <address of other computer> -p 12345
        ;;
    "6") # general traffic overview
        if [ -z "$add" ]; then add=$default_dev; fi
        sudo iftop -i $add
        ;;
    "7") # more general traffic overview
        if [ -z "$add" ]; then add=$default_dev; fi
        sudo tcptrack -fr 10 -i $add
        ;;
    "8") # capture packets
        if [ -z "$add" ]; then add=$default_port; fi
        sudo tshark -i lo -n -s0 -f "port $add"
        ;;
    *) # (default 1 / empty) bandwidth monitoring
        if [ -z "$add" ]; then add=$default_dev; fi
        sudo speedometer -l  -r $add -t $add -c -r lo -t lo -m $(( 1024 * 1024 * 3 / 2 ))
        #sudo speedometer -l  -r $add -t $add -c -r tun0 -t tun0 -c -r lo -t lo -m $(( 1024 * 1024 * 3 / 2 ))
        #speedometer -l  -r tun0 -t tun0 -m $(( 1024 * 1024 * 3 / 2 ))
        #speedometer -l  -r lo -t lo -m $(( 1024 * 1024 * 3 / 2 ))
        ;;
esac

Top
©twily.info 2013 - 2024
twily at twily dot info



2 158 799 visits
... ^ v