<!doctype html> <html> <head> <?php include 'functions.php'; ?> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php echo mask2cidr("255.255.255.0"); ?> </body> </html>
include 'func/func.php'; include 'func/class.login.php'; // LOGIN START $log = new logmein(); $log->encrypt = true; //set encryption //parameters are(SESSION, name of the table, name of the password field, name of the username field) if ($log->logincheck($_SESSION['loggedin'], "logon", "password", "useremail") == false) { echo '<meta http-equiv="refresh" content="0; URL=index.php">'; } else { //LOGIN END $ips = script_wmi(ipaddress); $masks = script_wmi(netmask); $ip = trim($ips[1]); $mask = trim($masks[1]); $cidr = mask2cidr($mask); $network = network($ip, $mask); $network_scan = $network . "/" . $cidr; $result = scan_netbios($network_scan, $cidr); $result = str_replace("MACAddress", "", $result); $result = str_replace("ComputerName", "", $result); $result = str_replace("Sharing", "", $result); $result = str_replace("'", "", $result); $result = str_replace(",", "", $result); $j = 0; $result = explode('=>', $result); for ($i = 6; $i < sizeof($result); $i++) { $ip_save[$j] = $result[$i]; $i = $i + 2; $groupe_save[$j] = $result[$i]; $i = $i + 1;
logmessage("Configuring default mac address 20:11:22:33:44:55 on interface eth0"); shell_exec("sudo ifconfig eth0 hw ether 20:11:22:33:44:55 2>&1 | sudo tee --append /var/log/raspberrywap.log"); } else { logmessage("Configuring mac address " . $configurationsettings['lanmac'] . " from configuration file on interface eth0"); shell_exec("sudo ifconfig eth0 hw ether " . $configurationsettings['lanmac'] . " 2>&1 | sudo tee --append /var/log/raspberrywap.log"); } logmessage("Bringing interface eth0 up"); shell_exec("sudo ifconfig eth0 up 2>&1 | sudo tee --append /var/log/raspberrywap.log"); logmessage("Configuring interface eth0"); shell_exec("sudo ifup eth0 2>&1 | sudo tee --append /var/log/raspberrywap.log"); logmessage("Removing bridge parameter from hostapd config."); hostapd_addbridge("disable"); logmessage("Starting Access Point Management hostapd"); shell_exec("sudo service hostapd start 2>&1 | sudo tee --append /var/log/raspberrywap.log"); logmessage("Setting ip address " . $configurationsettings['wifiip'] . "/" . mask2cidr($configurationsettings['wifimask']) . " on interface wlan0"); shell_exec("sudo ip addr add " . $configurationsettings['wifiip'] . "/" . mask2cidr($configurationsettings['wifimask']) . " dev wlan0 2>&1 | sudo tee --append /var/log/raspberrywap.log"); logmessage("Enabling ip forwarding"); shell_exec("sudo sysctl -w net.ipv4.ip_forward=1 2>&1 | sudo tee --append /var/log/raspberrywap.log"); logmessage("Enabling ip forwarding restore on boot in rc.local"); shell_exec("sudo sed -i 's/# sysctl -w net.ipv4.ip_forward=1/sysctl -w net.ipv4.ip_forward=1/g' /etc/rc.local"); logmessage("Configuring dnsmasq to start at boot"); shell_exec("sudo update-rc.d dnsmasq defaults 2>&1 | sudo tee --append /var/log/raspberrywap.log"); logmessage("Starting dnsmasq"); shell_exec("sudo service dnsmasq start 2>&1 | sudo tee --append /var/log/raspberrywap.log"); logmessage("Enabling NAT"); shell_exec("sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 2>&1 | sudo tee --append /var/log/raspberrywap.log"); logmessage("Writing iptables to /var/tmp/iptables"); shell_exec("sudo iptables-save > /var/tmp/iptables"); logmessage("Enabling iptables restore on boot in rc.local"); shell_exec("sudo sed -i 's/# iptables-restore < \\/var\\/tmp\\/iptables/iptables-restore < \\/var\\/tmp\\/iptables/g' /etc/rc.local"); echo "<script>\$('#functionstat').text('Router');</script>";