예제 #1
0
파일: networks.py 프로젝트: Kismon/kismon
				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()
예제 #2
0
                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()