function copyLogsHistory()
{
    global $bin_cp;
    global $bin_mv;
    global $mod_logs;
    global $mod_logs_history;
    global $bin_echo;
    if (0 < filesize($mod_logs)) {
        $exec = "{$bin_cp} {$mod_logs} {$mod_logs_history}/" . gmdate("Ymd-H-i-s") . ".log";
        exec_fruitywifi($exec);
        $exec = "{$bin_echo} '' > {$mod_logs}";
        //exec_fruitywifi($exec);
    }
}
Example #2
0
function stop_iface($iface, $ip, $gw)
{
    $bin_danger = "/usr/share/fruitywifi/bin/danger";
    // START MONITOR MODE (mon0)
    $iface_mon0 = exec("/sbin/ifconfig |grep 'wlan0mon|mon0'");
    //if ($iface_mon0 != "") {
    $exec = "/usr/bin/sudo /sbin/ifconfig {$iface} 0.0.0.0";
    //exec("$bin_danger \"" . $exec . "\"", $output); //DEPRECATED
    exec_fruitywifi($exec);
    //}
}
Example #3
0
        $exec = "/bin/sed -i 's/opt_responder\\[\\\"".$tmp[$i]."\\\"\\]\\[0\\].*/opt_responder\\[\\\"".$tmp[$i]."\\\"\\]\\[0\\] = 0;/g' options_config.php";
        //exec("/usr/share/FruityWifi/bin/danger \"" . $exec . "\"", $output); //DEPRECATED
        $output = exec_fruitywifi($exec);
        
        $exec = "/bin/sed -i 's/^".$tmp[$i].".*/".$tmp[$i]." = Off/g' Responder-master/Responder.conf";
        //exec("/usr/share/FruityWifi/bin/danger \"" . $exec . "\"", $output); //DEPRECATED
        $output = exec_fruitywifi($exec);
        
    }

    $tmp = $_POST["options"];
    for ($i=0; $i< count($tmp); $i++) {
        
        $exec = "/bin/sed -i 's/opt_responder\\[\\\"".$tmp[$i]."\\\"\\]\\[0\\].*/opt_responder\\[\\\"".$tmp[$i]."\\\"\\]\\[0\\] = 1;/g' options_config.php";
        //exec("/usr/share/FruityWifi/bin/danger \"" . $exec . "\"", $output); //DEPRECATED
        exec_fruitywifi($exec);
        
        $exec = "/bin/sed -i 's/^".$tmp[$i].".*/".$tmp[$i]." = On/g' Responder-master/Responder.conf";
        //exec("/usr/share/FruityWifi/bin/danger \"" . $exec . "\"", $output); //DEPRECATED
        exec_fruitywifi($exec);
        
    }

    header('Location: ../index.php?tab=1');
    exit;

}

header('Location: ../index.php');

?>
Example #4
0
    $exec = "{$bin_rm} " . $mod_logs_history . $logfile . ".log";
    exec_fruitywifi($exec);
}
// SET MODE
if ($_POST["change_iface"] == "1") {
    $mod_iface = $ss_iface;
    $exec = "/bin/sed -i 's/mod_iface.*/mod_iface = \\\"" . $mod_iface . "\\\";/g' _info_.php";
    $output = exec_fruitywifi($exec);
}
if ($_POST["change_macaddress"] == "1") {
    $ss_mode = $service;
    $exec = "/bin/sed -i 's/ss_macaddress.*/ss_macaddress = \\\"" . $macaddress . "\\\";/g' _info_.php";
    $output = exec_fruitywifi($exec);
    $ss_macaddress = $macaddress;
    $exec = "/bin/sed -i 's/ss_time.*/ss_time = \\\"" . $check_time . "\\\";/g' _info_.php";
    $output = exec_fruitywifi($exec);
    $ss_time = $check_time;
}
?>

<div class="rounded-top" align="left"> &nbsp; <b><?php 
echo $mod_alias;
?>
</b> </div>
<div class="rounded-bottom">

    &nbsp; version <?php 
echo $mod_version;
?>
<br>
    <?php 
Example #5
0
function cleanTAP()
{
    global $tap1_iface;
    global $tap2_iface;
    global $bin_ifconfig;
    global $tap2_set;
    // CLEAN
    $exec = "/etc/init.d/dhcpcd stop";
    exec_fruitywifi($exec);
    killRegex("dhcpcd.+{$tap2_iface}");
    $exec = "{$bin_ifconfig} {$tap1_iface} down";
    exec_fruitywifi($exec);
    $exec = "{$bin_ifconfig} {$tap1_iface} 0.0.0.0";
    exec_fruitywifi($exec);
    if ($tap2_set != "3") {
        // TAP2 SET: CURRENT
        $exec = "{$bin_ifconfig} {$tap2_iface} down";
        exec_fruitywifi($exec);
        $exec = "{$bin_ifconfig} {$tap2_iface} 0.0.0.0";
        exec_fruitywifi($exec);
    }
}
function killRegex($regex)
{
    $exec = "ps aux|grep -E '{$regex}' | grep -v grep | awk '{print \$2}'";
    exec($exec, $output);
    if (count($output) > 0) {
        $exec = "kill " . $output[0];
        exec_fruitywifi($exec);
    }
}
Example #7
0
function checkPool()
{
    $filename = '/usr/share/fruitywifi/conf/pool-station.conf';
    if (!file_exists($filename)) {
        $exec = "touch {$filename}";
        exec_fruitywifi($exec);
    }
    $filename = '/usr/share/fruitywifi/conf/pool-ssid.conf';
    if (!file_exists($filename)) {
        $exec = "touch {$filename}";
        exec_fruitywifi($exec);
    }
    $filename = '/usr/share/fruitywifi/conf/ssid.conf';
    if (!file_exists($filename)) {
        $exec = "touch {$filename}";
        exec_fruitywifi($exec);
    }
}
Example #8
0
function copyLogsHistory() {
	
	global $bin_cp;
	global $bin_mv;
	global $mod_logs;
	global $mod_logs_history;
	global $bin_echo;
	
	if ( 0 < filesize( $mod_logs ) ) {
		$exec = "$bin_cp $mod_logs $mod_logs_history/".gmdate("Ymd-H-i-s").".log";
		exec_fruitywifi($exec);
		
		$exec = "$bin_echo '' > $mod_logs";
		exec_fruitywifi($exec);
	}
}
Example #9
0
 public function setConfigModule($module, $param, $value)
 {
     //include_once "functions.php";
     $exec = "/bin/sed -i 's/{$param}=.*/{$param}=\\\"" . $value . "\\\";/g' /usr/share/fruitywifi/www/modules/{$module}/_info_.php";
     exec_fruitywifi($exec);
     echo json_encode($value);
 }
Example #10
0
 public function getScanStation()
 {
     include "functions.php";
     include "../../../config/config.php";
     $data = open_file("/usr/share/fruitywifi/logs/dhcp.leases");
     $out = explode("\n", $data);
     $leases = [];
     for ($i = 0; $i < count($out); $i++) {
         $temp = explode(" ", $out[$i]);
         $leases[$temp[1]] = array($temp[2], $temp[3]);
     }
     unset($out);
     unset($data);
     $exec = "iw dev {$io_in_iface} station dump | sed -e 's/^\\t/|/g' | tr '\\n' ' ' | sed -e 's/Sta/\\nSta/g' | tr '\\t' ' '";
     $out = exec_fruitywifi($exec);
     $output = [];
     for ($i = 0; $i < count($out); $i++) {
         $station = [];
         $temp = explode("|", $out[$i]);
         if ($temp[0] != "") {
             foreach ($temp as &$value) {
                 unset($sub);
                 if (strpos($value, 'Station ') !== false) {
                     $value = str_replace("Station ", "", $value);
                     $value = explode(" ", $value);
                     $mac = $value[0];
                     $value = "station: " . $value[0];
                     $key_mac = $value[0];
                 }
                 $sub = explode(": ", $value);
                 //$station[] = $sub;
                 //$station[] = array($sub[0] => $sub[1]);
                 $station[$sub[0]] = $sub[1];
             }
             if (array_key_exists($mac, $leases)) {
                 //$station[] = array("ip" => $leases[$mac][0]);
                 //$station[] = array("hostname" => $leases[$mac][1]);
                 $station["ip"] = $leases[$mac][0];
                 $station["hostname"] = $leases[$mac][1];
             } else {
                 //$station[] = array("ip" => "");
                 //$station[] = array("hostname" => "");
                 $station["ip"] = "";
                 $station["hostname"] = "";
             }
             //$output[] = $station;
             $output[] = $station;
         }
     }
     echo json_encode($output);
 }
Example #11
0
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/ 
?>
<?php 
include "../_info_.php";
$type = $_POST['type'];
$newdata = $_POST['newdata'];
if ($type == "logs") {
    $filename = $mod_logs;
    $fh = fopen($filename, "r");
    //or die("Could not open file.");
    $data = fread($fh, filesize($filename));
    //or die("Could not read file.");
    fclose($fh);
    $dump = explode("\n", $data);
    //$dump = implode("\n",array_reverse($data_array));
    echo json_encode(array_reverse($dump));
}
if ($type == "inject") {
    if ($newdata != "") {
        $newdata = ereg_replace(13, "", $newdata);
        $exec = "/bin/echo '{$newdata}' > /usr/share/fruitywifi/www/modules/sslstrip/includes/inject.txt";
        //exec("/usr/share/fruitywifi/bin/danger \"" . $exec . "\"", $output); //DEPRECATED
        $output = exec_fruitywifi($exec);
    }
    $exec = "cat /usr/share/fruitywifi/www/modules/sslstrip/includes/inject.txt";
    //exec("/usr/share/fruitywifi/bin/danger \"" . $exec . "\"", $dump); //DEPRECATED
    $dump = exec_fruitywifi($exec);
    echo json_encode($dump);
}