from os import listdir, path
from os.path import isfile, join, getsize

my_mac = "1B:E4:56:B6:FB:00"

my_pos = dict()
for i in range(200):
    my_pos[i] = list()

log_files = [f for f in listdir("LOGS_BSSID") if isfile(join("LOGS_BSSID", f))]

for f in log_files:
    log = open(path.join("LOGS_BSSID", f)).read().splitlines()
    for i, line in enumerate(log):
        if my_mac in line:
            my_pos[i] += (f,)
            if getsize(path.join("LOGS_BSSID", f)) < 15000:
                print(f)
print(my_pos)


res = {"165":list(), "240":list(), "243":list()}
for key in res:
    log = open(path.join("LOGS_BSSID", "log_B{}.log".format(key))).read().splitlines()
    for line in log:
        res[key]=list(set(line[9:].split(",") + res[key]))
for borne in res[list(res.keys())[0]]:
    if borne in res[list(res.keys())[1]] and borne in res[list(res.keys())[2]] and borne != my_mac:
        print(res.keys(), borne)

res = {"188":list(), "153":list(), "324":list()}
for key in res:
    log = open(path.join("LOGS_BSSID", "log_B{}.log".format(key))).read().splitlines()
    for line in log:
        res[key]=list(set(line[9:].split(",") + res[key]))
for borne in res[list(res.keys())[0]]:
    if borne in res[list(res.keys())[1]] and borne in res[list(res.keys())[2]] and borne != my_mac:
        print(res.keys(), borne)
