data[head[x]] = column x += 1 crypts = [] for crypt in data["Encryption"].split(","): crypts.append(crypt.lower().replace("-","_")) self.networks[data["BSSID"]] = { "type": data["NetType"], "channel": int(data["Channel"]), "firsttime": timestring2timestamp(data["FirstTime"]), "lasttime": timestring2timestamp(data["LastTime"]), "lat": float(data["GPSBestLat"]), "lon": float(data["GPSBestLon"]), "manuf": "", "ssid": data["ESSID"], "cryptset": encode_cryptset(crypts) } locale.setlocale(locale.LC_TIME, '') f.close() def timestring2timestamp(timestring): return int(time.mktime(time.strptime(timestring))) def timestamp2timestring(timestamp): return time.strftime("%a %b %d %H:%M:%S %Y", time.gmtime(timestamp)) if __name__ == "__main__": from test import networks networks()
crypts.append(crypt.lower().replace("-", "_")) self.networks[data["BSSID"]] = { "type": data["NetType"], "channel": int(data["Channel"]), "firsttime": timestring2timestamp(data["FirstTime"]), "lasttime": timestring2timestamp(data["LastTime"]), "lat": float(data["GPSBestLat"]), "lon": float(data["GPSBestLon"]), "manuf": "", "ssid": data["ESSID"], "cryptset": encode_cryptset(crypts), "crypt": ",".join(crypts) } locale.setlocale(locale.LC_TIME, '') f.close() def timestring2timestamp(timestring): return int(time.mktime(time.strptime(timestring))) def timestamp2timestring(timestamp): return time.strftime("%a %b %d %H:%M:%S %Y", time.gmtime(timestamp)) if __name__ == "__main__": from test import networks networks()