From 94d82b9aa29f5b84d1a82e95b5f7b4b81e36e38a Mon Sep 17 00:00:00 2001 From: Harvie Date: Mon, 24 May 2010 23:51:53 +0200 Subject: [PATCH] Some bash scripts from high-school... wtf are they for? --- bash/rudna.net/madwifi-deb.sh | 9 ++++++ bash/rudna.net/madwifi-install.sh | 27 +++++++++++++++++ bash/rudna.net/nettest.sh | 48 +++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100755 bash/rudna.net/madwifi-deb.sh create mode 100755 bash/rudna.net/madwifi-install.sh create mode 100755 bash/rudna.net/nettest.sh diff --git a/bash/rudna.net/madwifi-deb.sh b/bash/rudna.net/madwifi-deb.sh new file mode 100755 index 0000000..85cd547 --- /dev/null +++ b/bash/rudna.net/madwifi-deb.sh @@ -0,0 +1,9 @@ +#!/bin/sh +apt-get update; +apt-get install apt dpkg; +apt-get install doc-debian debian-policy debmake devscripts fakeroot dh-make debhelper; +apt-get install make g++ gcc perl autoconf automake sed libc6-dev pbuilder; + +tar -xvvzf "$1".tar.gz; +cd "$1"; + diff --git a/bash/rudna.net/madwifi-install.sh b/bash/rudna.net/madwifi-install.sh new file mode 100755 index 0000000..3224a7c --- /dev/null +++ b/bash/rudna.net/madwifi-install.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#Harvie's MAAADWiFi module instalation script +#2oo8 +#No freakin' rightz reserved! + +cd /usr/src +rm -rf madwifi-source* + +apt-get build-dep madwifi-source + +echo Downloading+Building madwifi-source. plz w8...; +apt-get source -b madwifi-source +if [[ $? > 0 ]]; then + echo 'apt-get source ERROR... Sorry dude ;('; + return 1; +fi; + +echo Instaling madwifi module. plz w8...; +dpkg -i madwifi-source*.deb +if [[ $? > 0 ]]; then + echo 'dpkg -i ERROR... Sorry dude ;('; + return 1; +fi; + +echo "Madwifi gracefully orgasmed. You're da best *NIXadmin on the world."; +echo "Chuck Norris is proud of you..."; +echo; diff --git a/bash/rudna.net/nettest.sh b/bash/rudna.net/nettest.sh new file mode 100755 index 0000000..387e485 --- /dev/null +++ b/bash/rudna.net/nettest.sh @@ -0,0 +1,48 @@ +#!/bin/bash +#Poustime pod r00tem! +testbtotal=268943360; #wc -c test.bin + +list_victims() { + #tahle funkce zjisti a vypise IP/hostname testovanych boxu - na radku jeden + echo fsdfdf + echo strep #dostupna + test.bin k dispozici + echo 127.0.0.1 #dostupna + echo 192.168.2.1 #nedostupna sit + echo lollol #neexistujici dns +} + +ping_perc() { + perc=0; + for i in $(seq 0 99); do + ping -c 1 -w 0.7 "$1" &> /dev/null; + ret="$?"; + if [[ "$ret" == 0 ]]; then + perc=$[$perc+1]; + fi; + if [[ "$ret" == 2 ]]; then + echo 0; return 0; + fi; + done; + echo "$perc"; + return "$perc"; +} + +for victim in $(list_victims); do + #victim + echo -n "$victim - "; + #ping + echo -n "ping responses: "; + pings=$(ping_perc "$victim"); + echo -n "$pings%, "; + #test.bin + echo -n "test.bin: " + bytes=$(curl "http://$victim/test.bin" --stderr /dev/null|wc -c); + downloaded=$[$bytes*100/$testbtotal]; + echo -n "$downloaded% downloaded, "; + #endvictim + echo -n "; "; +done; + +echo; + +#rozsahu, ty pingnout -c 100, potom z nich stahnout test.bin, do nagiosu potom poslat zpravu spoj $ESSID ma $ODEZVA odezvu, $LOSS, rychlost $WGET_AVG -- 2.30.2