def packetHandler(pkt): pprint.pprint(pkt) global start if pkt.haslayer(Dot11Beacon): radioTap = pkt.getlayer(Dot11) temp = radioTap.getlayer(Dot11Elt) if temp: if temp.info == xtics['essid']: # essid bssid = radioTap.addr2 # bssid channel = str(func.get_channel(temp.payload.payload.info)) # channel # detection rogue xtics['bssid'] = xtics['bssid'].lower() if (xtics['channel'] == channel) and (xtics['bssid'] == bssid): #print('authorized AP') pass else: if xtics['channel'] != channel: xtics['entropy'] -= (-(1.0/14) * math.log(1.0/14, 2)) if xtics['bssid'] != bssid: xtics['entropy'] -= (-(1.0/14) * math.log(1.0/14, 2)) # checking entropy value if xtics['entropy'] < entropy: execution_time = time.time() - start # log data => aps, exec, memory, entropy db.log(0, execution_time, func.get_usage(), xtics['entropy'], 2, distance) xtics['entropy'] = entropy sys.exit(0) start = time.time()
def packetHandler(pkt): #pprint.pprint(pkt) global start if pkt.haslayer(Dot11Beacon): radioTap = pkt.getlayer(Dot11) temp = radioTap.getlayer(Dot11Elt) if temp: if temp.info == xtics['essid']: # essid bssid = radioTap.addr2 # bssid channel = str(func.get_channel( temp.payload.payload.info)) # channel #print(pkt.show()) #hexdump(pkt) #pkt.psdump('packetFormat') #sys.exit() # detection rogue xtics['bssid'] = xtics['bssid'].lower() if (xtics['channel'] == channel) and (xtics['bssid'] == bssid): #print('authorized AP') pass else: if xtics['channel'] != channel: xtics['entropy'] -= func.lossEntropy() if xtics['bssid'] != bssid: xtics['entropy'] -= func.lossEntropy() # checking entropy value if xtics['entropy'] < entropy: #print('Rogue detected') #print(bssid + '\t' + channel) execution_time = time.time() - start #print(execution_time) #print('[2] ' + str(start)) # log data => aps, exec, memory, entropy db.log(0, execution_time, func.get_usage(), xtics['entropy']) #get_usage() #print('\n') xtics['entropy'] = entropy start = time.time()
collisions = 0 def usage(): print("Usage: python " + sys.argv[0] + " [counter: integer] [scenario: integer]") if __name__ == "__main__": if len(sys.argv) != 3: usage() sys.exit(1) for C in range(int(sys.argv[1])): X = int(time.time()) Y = X * 1000 M = Y * 1000 generatedNo = int(((X * (Y - C) - M + math.factorial(C)) % bits) + 1 / (C + 1)) print(str(generatedNo) + ": " + str(func.get_usage()) + "%") try: gen_set.index(generatedNo) except ValueError: gen_set.append(generatedNo) continue # collision found collisions += 1 print("Collisions detected: " + str(collisions))
if ap_info['encryption_key'] == data['encryption_key']: entropy += (-(1.0/14) * math.log(1.0/14, 2)) if ap_info['pairwise_ciphers'] == data['pairwise_ciphers']: entropy += (-(1.0/14) * math.log(1.0/14, 2)) if ap_info['frequency'] == data['frequency']: entropy += (-(1.0/14) * math.log(1.0/14, 2)) if ap_info['rsn_ie'] == data['rsn_ie']: entropy += (-(1.0/14) * math.log(1.0/14, 2)) if ap_info['bit_rates'] == data['bit_rates']: entropy += (-(1.0/14) * math.log(1.0/14, 2)) if ap_info['fm'] == data['fm']: entropy += (-(1.0/14) * math.log(1.0/14, 2)) if ap_info['authentication_suites'] == data['authentication_suites']: entropy += (-(1.0/14) * math.log(1.0/14, 2)) if ap_info['channel'] == data['channel']: entropy += (-(1.0/14) * math.log(1.0/14, 2)) if ap_info['mode'] == data['mode']: entropy += (-(1.0/14) * math.log(1.0/14, 2)) if entropy != ap_info['entropy']: execution_time = time.time() - start db.log(aps, execution_time, func.get_usage(), entropy, 0, distance)