[OpenWrt-Devel] [PATCH] packages: fix airmon-ng output in multi bssid mode

Tom Psyborg pozega.tomislav at gmail.com
Mon Feb 8 00:23:55 EST 2016


Create a patch that removes the output of unnecessary interface
informations which occur if the radio broadcasts more than one ssid to
speed up the operation and provide clean output. Also removes scanProcesses
function to get rid of the busybox output garbage.

Signed-off-by: Tomislav Požega <pozega.tomislav at gmail.com>
---
Removing the scanProcesses function should not affect the operations since
the function is intended for distributions that use external
network-managers and daemons. Same fix is required in CC branch.

Patch

diff -purN
a/feeds/packages/net/aircrack-ng/patches/001-airmon-ng_multi_bssid_fix.patch
b/feeds/packages/net/aircrack-ng/patches/001-airmon-ng_multi_bssid_fix.patch
---
a/feeds/packages/net/aircrack-ng/patches/001-airmon-ng_multi_bssid_fix.patch
1970-01-01
01:00:00.000000000 +0100
+++
b/feeds/packages/net/aircrack-ng/patches/001-airmon-ng_multi_bssid_fix.patch
2016-02-08
03:21:30.743649000 +0100
@@ -0,0 +1,105 @@
+--- a/scripts/airmon-ng 2014-10-31 21:39:43.000000000 +0100
++++ b/scripts/airmon-ng 2016-02-08 03:13:34.221319763 +0100
+@@ -101,67 +101,6 @@ getDriver() {
+
+ }
+
+-scanProcesses() {
+-    if [ -f "`which service 2>&1`" ] && [ x"$1" = "xkill" ]
+-    then
+-     service network-manager stop 2>/dev/null >/dev/null
+- service avahi-daemon stop 2>/dev/null >/dev/null
+-    fi
+-
+-    match=`ps -A -o comm= | grep $PROCESSES | grep -v grep | wc -l`
+-    if [ $match -gt 0 -a x"$1" != "xkill" ]
+-    then
+-        printf "\n\n"
+-        echo "Found $match processes that could cause trouble."
+-        echo "If airodump-ng, aireplay-ng or airtun-ng stops working
after"
+-        echo "a short period of time, you may want to kill (some of)
them!"
+-        echo -e "\nPID\tName"
+-    else
+-        if [ x"$1" != "xkill" ]
+-        then
+-            return
+-        fi
+-    fi
+-
+-    if [ $match -gt 0 -a x"$1" = "xkill" ]
+-    then
+-        echo "Killing all those processes..."
+-    fi
+-
+-    i=1
+-    while [ $i -le $match ]
+-    do
+-        pid=`ps -A -o pid= -o comm= | grep $PROCESSES | grep -v grep |
head -n $i | tail -n 1 | awk '{print $1}'`
+-        pname=`ps -A -o pid= -o comm= | grep $PROCESSES | grep -v grep |
head -n $i | tail -n 1 | awk '{print $2}'`
+-        if [ x"$1" != "xkill" ]
+-        then
+-            printf "$pid\t$pname\n"
+-        else
+-            kill $pid
+-        fi
+-        i=$(($i+1))
+-    done
+-}
+-
+-checkProcessesIface() {
+-    if [ x"$1" = "x" ]
+-    then
+-        return
+-    fi
+-
+-    match2=`ps -o comm= -p 1 2>&1 | grep $PS_ERROR | grep -v grep | wc -l`
+-    if [ $match2 -gt 0 ]
+-    then
+- return
+-    fi
+-
+-    for i in `ps auxw | grep $1 | grep -v "grep" | grep -v "airmon-ng" |
awk '{print $2}'`
+-    do
+-        pname=`ps -o comm= -p $i`
+-        echo "Process with PID $i ($pname) is running on interface $1"
+-    done
+-}
+-
+ getStack() {
+     if [ x"$1" = "x" ]
+     then
+@@ -505,22 +444,15 @@ iwpriv > /dev/null 2> /dev/null ||
+
+ if [ x"$1" = "xcheck" ] || [ x"$1" = "xstart" ]
+ then
+-    scanProcesses
+-    for iface in `iwconfig 2>/dev/null | egrep
'(IEEE|ESSID|802\.11|WLAN)' | sed 's/^\([a-zA-Z0-9_.]*\) .*/\1/' | grep -v
wifi`
++    for iface in `iwconfig 2>/dev/null | egrep
'(IEEE|ESSID|802\.11|WLAN)' | sed 's/^\([a-zA-Z0-9_-]*\) .*/\1/' | grep -v
wifi`
+     do
+-#         getModule $iface
+-#         getDriver $iface
+-        checkProcessesIface $iface
+-    done
+
+-    if [ x"$2" = "xkill" ]
+-    then
+-        scanProcesses "$2"
+-    fi
+     if [ x"$1" = "xcheck" ]
+     then
+         exit
+     fi
++
++    done
+ fi
+
+ printf "\n\n"
+@@ -605,7 +537,7 @@ then
+ sleep 1s
+ fi
+
+-for iface in `iwconfig 2>/dev/null | egrep '(IEEE|ESSID|802\.11|WLAN)' |
sed 's/^\([a-zA-Z0-9_.]*\) .*/\1/' | grep -v wifi`
++for iface in `iwconfig 2>/dev/null | egrep '(IEEE|ESSID|802\.11|WLAN)' |
sed 's/^\([a-zA-Z0-9_-]*\) .*/\1/' | grep -v wifi`
+ do
+  getModule  $iface
+  getDriver  $iface
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20160208/2693d810/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list