From abe6d3060c1a19f2d9a763a16ed5015542748ba3 Mon Sep 17 00:00:00 2001 From: WM Date: Sat, 27 Jan 2018 17:32:38 -0500 Subject: [PATCH] Modules fixes (#9) --- SSLsplit/module.info | 2 +- SSLsplit/scripts/autostart_sslsplit.sh | 1 + SSLsplit/scripts/sslsplit.sh | 4 +- ettercap/module.info | 2 +- ettercap/scripts/dependencies.sh | 14 ++++-- ngrep/module.info | 2 +- ngrep/scripts/dependencies.sh | 6 ++- nmap/api/module.php | 65 ++++++++++++-------------- nmap/module.info | 2 +- nmap/scripts/dependencies.sh | 6 ++- p0f/module.info | 2 +- p0f/scripts/dependencies.sh | 4 ++ tcpdump/module.info | 2 +- tcpdump/scripts/dependencies.sh | 6 ++- wps/js/module.js | 4 +- wps/module.info | 2 +- wps/scripts/dependencies.sh | 8 +++- 17 files changed, 79 insertions(+), 53 deletions(-) diff --git a/SSLsplit/module.info b/SSLsplit/module.info index e509560..4b8fd7d 100644 --- a/SSLsplit/module.info +++ b/SSLsplit/module.info @@ -6,5 +6,5 @@ "tetra" ], "title": "SSLsplit", - "version": "1.0" + "version": "1.1" } \ No newline at end of file diff --git a/SSLsplit/scripts/autostart_sslsplit.sh b/SSLsplit/scripts/autostart_sslsplit.sh index 01c6ade..cf1b8bb 100755 --- a/SSLsplit/scripts/autostart_sslsplit.sh +++ b/SSLsplit/scripts/autostart_sslsplit.sh @@ -9,6 +9,7 @@ MYTIME=`date +%s` killall sslsplit echo '1' > /proc/sys/net/ipv4/ip_forward +iptables-save > /pineapple/modules/SSLsplit/rules/saved iptables -X iptables -F iptables -t nat -F diff --git a/SSLsplit/scripts/sslsplit.sh b/SSLsplit/scripts/sslsplit.sh index 8ead9f0..a009bce 100755 --- a/SSLsplit/scripts/sslsplit.sh +++ b/SSLsplit/scripts/sslsplit.sh @@ -11,6 +11,7 @@ killall sslsplit if [ "$1" = "start" ]; then echo '1' > /proc/sys/net/ipv4/ip_forward + iptables-save > /pineapple/modules/SSLsplit/rules/saved iptables -X iptables -F iptables -t nat -F @@ -37,5 +38,6 @@ elif [ "$1" = "stop" ]; then iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT - + + iptables-restore < /pineapple/modules/SSLsplit/rules/saved fi diff --git a/ettercap/module.info b/ettercap/module.info index 54a5050..72709fa 100644 --- a/ettercap/module.info +++ b/ettercap/module.info @@ -6,5 +6,5 @@ "tetra" ], "title": "ettercap", - "version": "1.4" + "version": "1.5" } \ No newline at end of file diff --git a/ettercap/scripts/dependencies.sh b/ettercap/scripts/dependencies.sh index 38a57e2..bdc61b5 100755 --- a/ettercap/scripts/dependencies.sh +++ b/ettercap/scripts/dependencies.sh @@ -14,13 +14,13 @@ if [ "$1" = "install" ]; then if [ "$2" = "internal" ]; then opkg install ettercap - sed -i "/redir_command_on = \"iptables/ s/# *//" /etc/ettercap/etter.conf - sed -i "/redir_command_off = \"iptables/ s/# *//" /etc/ettercap/etter.conf + sed -i "/redir_command_on = \"iptables/ s/# *//" /etc/ettercap/etter.conf + sed -i "/redir_command_off = \"iptables/ s/# *//" /etc/ettercap/etter.conf - sed -i 's/^\(ec_uid = \).*/\10/' /etc/ettercap/etter.conf - sed -i 's/^\(ec_gid = \).*/\10/' /etc/ettercap/etter.conf + sed -i 's/^\(ec_uid = \).*/\10/' /etc/ettercap/etter.conf + sed -i 's/^\(ec_gid = \).*/\10/' /etc/ettercap/etter.conf - echo 1 > /proc/sys/net/ipv4/ip_forward + echo 1 > /proc/sys/net/ipv4/ip_forward elif [ "$2" = "sd" ]; then opkg install ettercap --dest sd @@ -34,6 +34,10 @@ if [ "$1" = "install" ]; then echo 1 > /proc/sys/net/ipv4/ip_forward fi + + if [ ! -f /usr/lib/libpcap.so ] && [ -f /usr/lib/libpcap.so.1.3 ]; then + ln -s /usr/lib/libpcap.so /usr/lib/libpcap.so.1.3 + fi touch /etc/config/ettercap echo "config ettercap 'module'" > /etc/config/ettercap diff --git a/ngrep/module.info b/ngrep/module.info index 87be5ad..be6a9f1 100644 --- a/ngrep/module.info +++ b/ngrep/module.info @@ -6,5 +6,5 @@ "tetra" ], "title": "ngrep", - "version": "1.4" + "version": "1.5" } \ No newline at end of file diff --git a/ngrep/scripts/dependencies.sh b/ngrep/scripts/dependencies.sh index c0b9cf0..311c54e 100755 --- a/ngrep/scripts/dependencies.sh +++ b/ngrep/scripts/dependencies.sh @@ -12,12 +12,16 @@ touch /tmp/ngrep.progress if [ "$1" = "install" ]; then if [ "$2" = "internal" ]; then - opkg update + opkg update opkg install ngrep elif [ "$2" = "sd" ]; then opkg update opkg install ngrep --dest sd fi + + if [ ! -f /usr/lib/libpcap.so ] && [ -f /usr/lib/libpcap.so.1.3 ]; then + ln -s /usr/lib/libpcap.so /usr/lib/libpcap.so.1.3 + fi touch /etc/config/ngrep echo "config ngrep 'module'" > /etc/config/ngrep diff --git a/nmap/api/module.php b/nmap/api/module.php index 2ba1ae3..d594b93 100644 --- a/nmap/api/module.php +++ b/nmap/api/module.php @@ -7,10 +7,10 @@ class nmap extends Module public function route() { switch ($this->request->action) { - case 'refreshInfo': - $this->refreshInfo(); - break; - case 'refreshOutput': + case 'refreshInfo': + $this->refreshInfo(); + break; + case 'refreshOutput': $this->refreshOutput(); break; case 'refreshStatus': @@ -37,33 +37,30 @@ class nmap extends Module case 'deleteHistory': $this->deleteHistory(); break; - case 'downloadHistory': - $this->downloadHistory(); - break; + case 'downloadHistory': + $this->downloadHistory(); + break; } } - protected function checkDependency($dependencyName) - { - return ((exec("which {$dependencyName}") == '' ? false : true) && ($this->uciGet("nmap.module.installed"))); - } + protected function checkDependency($dependencyName) + { + return ((exec("which {$dependencyName}") == '' ? false : true) && ($this->uciGet("nmap.module.installed"))); + } - protected function getDevice() - { - return trim(exec("cat /proc/cpuinfo | grep machine | awk -F: '{print $2}'")); - } + protected function getDevice() + { + return trim(exec("cat /proc/cpuinfo | grep machine | awk -F: '{print $2}'")); + } - protected function refreshInfo() - { - $moduleInfo = @json_decode(file_get_contents("/pineapple/modules/nmap/module.info")); - $this->response = array('title' => $moduleInfo->title, 'version' => $moduleInfo->version); - } + protected function refreshInfo() + { + $moduleInfo = @json_decode(file_get_contents("/pineapple/modules/nmap/module.info")); + $this->response = array('title' => $moduleInfo->title, 'version' => $moduleInfo->version); + } private function handleDependencies() { - if (!file_exists("/usr/lib/libpcap.so.1.3") && file_exists("/usr/lib/libpcap.so")) { - symlink("/usr/lib/libpcap.so", "/usr/lib/libpcap.so.1.3"); - } if(!$this->checkDependency("nmap")) { $this->execBackground("/pineapple/modules/nmap/scripts/dependencies.sh install ".$this->request->destination); @@ -88,17 +85,17 @@ class nmap extends Module } } - private function scanStatus() - { - if (!$this->checkRunning("nmap")) - { - $this->response = array('success' => true); - } - else - { - $this->response = array('success' => false); - } - } + private function scanStatus() + { + if (!$this->checkRunning("nmap")) + { + $this->response = array('success' => true); + } + else + { + $this->response = array('success' => false); + } + } private function togglenmap() { diff --git a/nmap/module.info b/nmap/module.info index 3858736..45e2afa 100644 --- a/nmap/module.info +++ b/nmap/module.info @@ -6,5 +6,5 @@ "tetra" ], "title": "nmap", - "version": "1.5" + "version": "1.6" } \ No newline at end of file diff --git a/nmap/scripts/dependencies.sh b/nmap/scripts/dependencies.sh index ecbc74a..e392662 100755 --- a/nmap/scripts/dependencies.sh +++ b/nmap/scripts/dependencies.sh @@ -12,12 +12,16 @@ touch /tmp/nmap.progress if [ "$1" = "install" ]; then if [ "$2" = "internal" ]; then - opkg update + opkg update opkg install nmap elif [ "$2" = "sd" ]; then opkg update opkg install nmap --dest sd fi + + if [ ! -f /usr/lib/libpcap.so ] && [ -f /usr/lib/libpcap.so.1.3 ]; then + ln -s /usr/lib/libpcap.so /usr/lib/libpcap.so.1.3 + fi touch /etc/config/nmap echo "config nmap 'module'" > /etc/config/nmap diff --git a/p0f/module.info b/p0f/module.info index 41b5c2f..7a21af6 100644 --- a/p0f/module.info +++ b/p0f/module.info @@ -6,5 +6,5 @@ "tetra" ], "title": "p0f", - "version": "1.0" + "version": "1.1" } \ No newline at end of file diff --git a/p0f/scripts/dependencies.sh b/p0f/scripts/dependencies.sh index c7cb1a6..71c7a01 100755 --- a/p0f/scripts/dependencies.sh +++ b/p0f/scripts/dependencies.sh @@ -18,6 +18,10 @@ if [ "$1" = "install" ]; then opkg update opkg install p0f --dest sd fi + + if [ ! -f /usr/lib/libpcap.so ] && [ -f /usr/lib/libpcap.so.1.3 ]; then + ln -s /usr/lib/libpcap.so /usr/lib/libpcap.so.1.3 + fi touch /etc/config/p0f echo "config p0f 'module'" > /etc/config/p0f diff --git a/tcpdump/module.info b/tcpdump/module.info index 5cb3ba6..d30e40d 100644 --- a/tcpdump/module.info +++ b/tcpdump/module.info @@ -6,5 +6,5 @@ "tetra" ], "title": "tcpdump", - "version": "1.4" + "version": "1.5" } \ No newline at end of file diff --git a/tcpdump/scripts/dependencies.sh b/tcpdump/scripts/dependencies.sh index 8f9e812..ae74f08 100755 --- a/tcpdump/scripts/dependencies.sh +++ b/tcpdump/scripts/dependencies.sh @@ -12,12 +12,16 @@ touch /tmp/tcpdump.progress if [ "$1" = "install" ]; then if [ "$2" = "internal" ]; then - opkg update + opkg update opkg install tcpdump elif [ "$2" = "sd" ]; then opkg update opkg install tcpdump --dest sd fi + + if [ ! -f /usr/lib/libpcap.so ] && [ -f /usr/lib/libpcap.so.1.3 ]; then + ln -s /usr/lib/libpcap.so /usr/lib/libpcap.so.1.3 + fi touch /etc/config/tcpdump echo "config tcpdump 'module'" > /etc/config/tcpdump diff --git a/wps/js/module.js b/wps/js/module.js index b72ff7f..541f400 100644 --- a/wps/js/module.js +++ b/wps/js/module.js @@ -485,7 +485,7 @@ registerController('wps_OptionsController', ['$api', '$scope', '$rootScope', fun angular.forEach($scope.reaverAdvancedOptions, function(value, key) { if(value.check != false) - return_value += value.check + " " + value.val; + return_value += value.check + " " + value.val + " "; }); return return_value; @@ -507,7 +507,7 @@ registerController('wps_OptionsController', ['$api', '$scope', '$rootScope', fun angular.forEach($scope.bullyAdvancedOptions, function(value, key) { if(value.check != false) - return_value += value.check + " " + value.val; + return_value += value.check + " " + value.val + " "; }); return return_value; diff --git a/wps/module.info b/wps/module.info index b127fd9..e6c3d95 100644 --- a/wps/module.info +++ b/wps/module.info @@ -6,5 +6,5 @@ "tetra" ], "title": "wps", - "version": "1.2" + "version": "1.4" } \ No newline at end of file diff --git a/wps/scripts/dependencies.sh b/wps/scripts/dependencies.sh index 3d76a6a..0929345 100755 --- a/wps/scripts/dependencies.sh +++ b/wps/scripts/dependencies.sh @@ -12,7 +12,7 @@ touch /tmp/wps.progress if [ "$1" = "install" ]; then if [ "$2" = "internal" ]; then - opkg update + opkg update opkg install reaver opkg install bully @@ -24,6 +24,10 @@ if [ "$1" = "install" ]; then opkg install bully --dest sd fi + + if [ ! -f /usr/lib/libpcap.so ] && [ -f /usr/lib/libpcap.so.1.3 ]; then + ln -s /usr/lib/libpcap.so /usr/lib/libpcap.so.1.3 + fi touch /etc/config/wps echo "config wps 'module'" > /etc/config/wps @@ -32,6 +36,8 @@ if [ "$1" = "install" ]; then uci commit wps.module.installed elif [ "$1" = "remove" ]; then + opkg remove reaver + opkg remove bully rm -rf /etc/config/wps fi