diff --git a/FruityWifi/conf/hostapd-secure.conf b/FruityWifi/conf/hostapd-secure.conf
index 149e340..18c25f1 100644
--- a/FruityWifi/conf/hostapd-secure.conf
+++ b/FruityWifi/conf/hostapd-secure.conf
@@ -1,4 +1,5 @@
-ctrl_interface=/var/run/hostapd-phy0
+ctrl_interface=/var/run/hostapd
+
driver=nl80211
wmm_ac_bk_cwmin=4
wmm_ac_bk_cwmax=10
@@ -39,9 +40,6 @@ tx_queue_data0_burst=1.5
hw_mode=g
channel=6
-
-
-
logger_syslog=127
logger_syslog_level=2
logger_stdout=127
@@ -50,7 +48,6 @@ logger_stdout_level=2
#ht_capab=[HT20][SHORT-GI-20][SHORT-GI-40][RX-STBC1][DSSS_CCK-40]
interface=wlan0
-ctrl_interface=/var/run/hostapd-phy0
disassoc_low_ack=1
auth_algs=1
#wpa=0
diff --git a/FruityWifi/conf/hostapd.conf b/FruityWifi/conf/hostapd.conf
index 233e178..50efcf7 100644
--- a/FruityWifi/conf/hostapd.conf
+++ b/FruityWifi/conf/hostapd.conf
@@ -1,4 +1,5 @@
-ctrl_interface=/var/run/hostapd-phy0
+ctrl_interface=/var/run/hostapd
+
driver=nl80211
wmm_ac_bk_cwmin=4
wmm_ac_bk_cwmax=10
@@ -39,9 +40,6 @@ tx_queue_data0_burst=1.5
hw_mode=g
channel=6
-
-
-
logger_syslog=127
logger_syslog_level=2
logger_stdout=127
@@ -50,7 +48,6 @@ logger_stdout_level=2
#ht_capab=[HT20][SHORT-GI-20][SHORT-GI-40][RX-STBC1][DSSS_CCK-40]
interface=wlan0
-ctrl_interface=/var/run/hostapd-phy0
disassoc_low_ack=1
auth_algs=1
wpa=0
@@ -59,6 +56,3 @@ ssid=FruityWifi
wmm_enabled=1
bssid=00:00:00:00:00:00
ignore_broadcast_ssid=0
-
-
-
diff --git a/FruityWifi/conf/pool-ssid.conf b/FruityWifi/conf/pool-ssid.conf
new file mode 100644
index 0000000..e69de29
diff --git a/FruityWifi/conf/pool-station.conf b/FruityWifi/conf/pool-station.conf
new file mode 100644
index 0000000..e69de29
diff --git a/FruityWifi/conf/ssid.conf b/FruityWifi/conf/ssid.conf
new file mode 100644
index 0000000..e69de29
diff --git a/FruityWifi/www/functions.php b/FruityWifi/www/functions.php
index 730c7b3..c078697 100644
--- a/FruityWifi/www/functions.php
+++ b/FruityWifi/www/functions.php
@@ -1,6 +1,6 @@
/*
- Copyright (C) 2013-2015 xtr4nge [_AT_] gmail.com
+ Copyright (C) 2013-2016 xtr4nge [_AT_] gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -45,53 +45,53 @@ function exec_fruitywifi($exec) {
$exec_mode = "sudo";
if ($exec_mode == "danger") {
-
- $bin_exec = "/usr/share/fruitywifi/bin/danger";
- exec("$bin_exec \"" . $exec . "\"", $output);
- return $output;
-
+
+ $bin_exec = "/usr/share/fruitywifi/bin/danger";
+ exec("$bin_exec \"" . $exec . "\"", $output);
+ return $output;
+
} else if ($exec_mode == "sudo") {
-
- $bin_exec = "/usr/bin/sudo";
- exec("$bin_exec sh -c \"$exec\"", $output);
- return $output;
-
+
+ $bin_exec = "/usr/bin/sudo";
+ exec("$bin_exec sh -c \"$exec\"", $output);
+ return $output;
+
} else {
- return false;
+ return false;
}
}
function exec_fruitywifi_env($exec) {
- # Construct our new PATH.
- $RBENV_ROOT="/root/.rbenv";
- $ROOT_PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
- $ROOT_PATH="$RBENV_ROOT/shims:$RBENV_ROOT/bin:$ROOT_PATH";
+ # Construct our new PATH.
+ $RBENV_ROOT="/root/.rbenv";
+ $ROOT_PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
+ $ROOT_PATH="$RBENV_ROOT/shims:$RBENV_ROOT/bin:$ROOT_PATH";
$exec_mode = "sudo";
if ($exec_mode == "danger") {
-
- $bin_exec = "/usr/share/fruitywifi/bin/danger";
- exec("$bin_exec \"" . $exec . "\"", $output);
- return $output;
+
+ $bin_exec = "/usr/share/fruitywifi/bin/danger";
+ exec("$bin_exec \"" . $exec . "\"", $output);
+ return $output;
} else if ($exec_mode == "sudo") {
-
- $bin_exec = "/usr/bin/sudo";
- exec("$bin_exec env PATH=\"$ROOT_PATH\" sh -c \"$exec\"", $output);
- return $output;
-
+
+ $bin_exec = "/usr/bin/sudo";
+ exec("$bin_exec env PATH=\"$ROOT_PATH\" sh -c \"$exec\"", $output);
+ return $output;
+
} else {
- return false;
+ return false;
}
}
function setToken() {
- $token = sha1(microtime(true).mt_rand(10000,90000));
- return $token;
+ $token = sha1(microtime(true).mt_rand(10000,90000));
+ return $token;
}
function module_deb($mod_name) {
@@ -103,53 +103,64 @@ function module_deb($mod_name) {
//print_r($output);
if(empty($output)) {
- //echo "none...";
- return 0;
+ //echo "none...";
+ return 0;
} else {
- $installed = explode(" ", trim($output[1]));
- $candidate = explode(" ", trim($output[2]));
+ $installed = explode(" ", trim($output[1]));
+ $candidate = explode(" ", trim($output[2]));
- if( $installed[1] == $candidate[1] ) {
- //echo "installed...";
- return 1;
- } else if( $installed[1] == "(none)" ) {
- //echo "install...";
- return 2;
- } else {
- //echo "upgrade...";
- return 3;
- }
+ if( $installed[1] == $candidate[1] ) {
+ //echo "installed...";
+ return 1;
+ } else if( $installed[1] == "(none)" ) {
+ //echo "install...";
+ return 2;
+ } else {
+ //echo "upgrade...";
+ return 3;
+ }
}
}
function start_monitor_mode($iface) {
-
- $bin_danger = "/usr/share/fruitywifi/bin/danger";
-
// START MONITOR MODE (mon0)
$iface_mon0 = exec("/sbin/ifconfig |grep mon0");
if ($iface_mon0 == "") {
- $exec = "/usr/bin/sudo /usr/sbin/airmon-ng start $iface";
- //exec("$bin_danger \"" . $exec . "\"", $output); //DEPRECATED
- exec_fruitywifi($exec);
+ //$exec = "/usr/sbin/airmon-ng start $iface";
+
+ $exec = "rfkill unblock wifi; sudo rfkill unblock all";
+ exec_fruitywifi($exec);
+
+ $phy = getPHY($iface);
+ $exec = "iw phy $phy interface add mon0 type monitor";
+ exec_fruitywifi($exec);
+
+ $exec = "ifconfig mon0 up";
+ exec_fruitywifi($exec);
+
}
-
}
function stop_monitor_mode($iface) {
-
- $bin_danger = "/usr/share/fruitywifi/bin/danger";
-
- // START MONITOR MODE (mon0)
+ // STOP MONITOR MODE (mon0)
$iface_mon0 = exec("/sbin/ifconfig |grep mon0");
if ($iface_mon0 != "") {
- $exec = "/usr/bin/sudo /usr/sbin/airmon-ng stop mon0";
- //exec("$bin_danger \"" . $exec . "\"", $output); //DEPRECATED
- exec_fruitywifi($exec);
+ $exec = "/usr/sbin/airmon-ng stop mon0";
+ exec_fruitywifi($exec);
}
+}
+function getPHY($iface) {
+ $exec = "iw dev | egrep 'phy|Interface' | tr '\\\n' '|' | tr '\\\t' ' ' | sed 's/| Interface//g'";
+ exec($exec, $output);
+ $temp = explode("|", $output[0]);
+ for ($i=0; $i < count($temp); $i++) {
+ $sub = explode(" ", $temp[$i]);
+ if ($sub[1] == $iface) return trim(str_replace("#","",$sub[0]));
+ }
+ return "-";
}
function open_file($filename) {
@@ -174,14 +185,14 @@ function start_iface($iface, $ip, $gw) {
//if ($iface_mon0 == "") {
$exec = "/usr/bin/sudo /sbin/ifconfig $iface $ip";
//exec("$bin_danger \"" . $exec . "\"", $output); //DEPRECATED
- exec_fruitywifi($exec);
- //}
+ exec_fruitywifi($exec);
+ //}
- if (trim($gw) != "") {
- $exec = "/usr/bin/sudo /sbin/route add default gw $gw";
- //exec("$bin_danger \"" . $exec . "\"", $output); //DEPRECATED
- exec_fruitywifi($exec);
- }
+ if (trim($gw) != "") {
+ $exec = "/usr/bin/sudo /sbin/route add default gw $gw";
+ //exec("$bin_danger \"" . $exec . "\"", $output); //DEPRECATED
+ exec_fruitywifi($exec);
+ }
}
@@ -194,7 +205,7 @@ function stop_iface($iface, $ip, $gw) {
//if ($iface_mon0 != "") {
$exec = "/usr/bin/sudo /sbin/ifconfig $iface 0.0.0.0";
//exec("$bin_danger \"" . $exec . "\"", $output); //DEPRECATED
- exec_fruitywifi($exec);
+ exec_fruitywifi($exec);
//}
}
diff --git a/FruityWifi/www/page_config_adv.php b/FruityWifi/www/page_config_adv.php
index 38022cc..3c56d20 100644
--- a/FruityWifi/www/page_config_adv.php
+++ b/FruityWifi/www/page_config_adv.php
@@ -1,6 +1,6 @@
/*
- Copyright (C) 2013-2015 xtr4nge [_AT_] gmail.com
+ Copyright (C) 2013-2016 xtr4nge [_AT_] gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -40,8 +40,6 @@
include "functions.php";
-//$bin_danger = "/usr/share/fruitywifi/bin/danger"; //DEPRECATED
-
// Checking POST & GET variables...
if ($regex == 1) {
regex_standard($_POST["filename"], "msg.php", $regex_extra);
@@ -67,17 +65,7 @@
$filename = $_POST['filename'];
$newdata = $_POST['newdata'];
-/*
-if ($newdata != "") { $newdata = ereg_replace(13, "", $newdata);
- $fw = fopen($filename, 'w') or die('Could not open file.');
- $fb = fwrite($fw,stripslashes($newdata)) or die('Could not write to file');
- fclose($fw);
- $fileMessage = $strings["config-updated"]." " . $filename . "
";
-}
-*/
?>
-
-
// -------------- IN | OUT ------------------
@@ -168,11 +156,9 @@
// -------------- SUPPLICANT ------------------
if(isset($_POST["supplicant_ssid"]) and isset($_POST["supplicant_psk"])) {
$exec = "sed -i 's/supplicant_ssid=.*/supplicant_ssid=\\\"".$_POST["supplicant_ssid"]."\\\";/g' ./config/config.php";
- //exec("$bin_danger \"" . $exec . "\"" ); //DEPRECATED
exec_fruitywifi($exec);
$exec = "sed -i 's/supplicant_psk=.*/supplicant_psk=\\\"".$_POST["supplicant_psk"]."\\\";/g' ./config/config.php";
- //exec("$bin_danger \"" . $exec . "\"" ); //DEPRECATED
exec_fruitywifi($exec);
$supplicant_ssid = $_POST["supplicant_ssid"];
@@ -184,15 +170,12 @@
if(isset($_POST["pass_old"]) and isset($_POST["pass_new"])) {
include "users.php";
if ( ($users["admin"] == md5($_POST["pass_old"])) and ($_POST["pass_new"] == $_POST["pass_new_repeat"])) {
- $exec = "sed -i 's/\\\=\\\"".md5($_POST["pass_old"])."\\\"/\\\=\\\"".md5($_POST["pass_new"])."\\\"/g' ./users.php";
- //echo $exec;
- //exit;
- //exec("$bin_danger \"" . $exec . "\"" ); //DEPRECATED
- exec_fruitywifi($exec);
-
- $pass_msg = 1;
+ $exec = "sed -i 's/\\\=\\\"".md5($_POST["pass_old"])."\\\"/\\\=\\\"".md5($_POST["pass_new"])."\\\"/g' ./users.php";
+ exec_fruitywifi($exec);
+
+ $pass_msg = 1;
} else {
- $pass_msg = 2;
+ $pass_msg = 2;
}
}
@@ -209,13 +192,9 @@
?>
-#echo $io_out_iface;
-#echo $io_in_iface;
-
$ifaces = exec("/sbin/ifconfig -a | cut -c 1-8 | sort | uniq -u |grep -v lo|sed ':a;N;$!ba;s/\\n/|/g'");
$ifaces = str_replace(" ","",$ifaces);
$ifaces = explode("|", $ifaces);
-
?>
@@ -227,71 +206,71 @@
-
-
-
- |
-
-
-
- |
+
+
+
+ |
+
+
+
+ |
@@ -419,19 +398,19 @@
@@ -441,20 +420,20 @@
-
+
- Additional Interfaces
+ Monitor Interface
-
+
@@ -484,16 +463,16 @@
@@ -504,8 +483,8 @@
Domain Setup
@@ -516,17 +495,17 @@
Password
@@ -537,8 +516,8 @@
Token
diff --git a/install-FruityWifi.sh b/install-FruityWifi.sh
index 8df6c45..becd10d 100755
--- a/install-FruityWifi.sh
+++ b/install-FruityWifi.sh
@@ -39,7 +39,7 @@ adduser --disabled-password --quiet --system --home /var/run/fruitywifi --no-cre
echo "[fruitywifi user has been created]"
echo
-apt-get -y install gettext make intltool build-essential automake autoconf uuid uuid-dev php5-curl php5-cli dos2unix curl sudo unzip lsb-release
+apt-get -y install gettext make intltool build-essential automake autoconf uuid uuid-dev php5-curl php5-cli dos2unix curl sudo unzip lsb-release python-scapy tcpdump
cmd=`gcc --version|grep "4.7"`
if [[ $cmd == "" ]]