From 3717cd2a490e0eafd3c5e7e2f7e15bc5c8437149 Mon Sep 17 00:00:00 2001 From: Dheryta Jaisinghani Date: Wed, 8 Jun 2016 17:48:07 +0530 Subject: [PATCH] Quantify Causes Updated --- CausalAnalysis-Datasets/Quantify-Causes.py | 13 +++- CausalAnalysis-Datasets/Quantify-Causes.sh | 3 +- CausalAnalysis-Datasets/Quantify-Causes.sh~ | 67 +++++++++++++++++++++ 3 files changed, 80 insertions(+), 3 deletions(-) create mode 100755 CausalAnalysis-Datasets/Quantify-Causes.sh~ diff --git a/CausalAnalysis-Datasets/Quantify-Causes.py b/CausalAnalysis-Datasets/Quantify-Causes.py index 5b0fe05..abd8c34 100755 --- a/CausalAnalysis-Datasets/Quantify-Causes.py +++ b/CausalAnalysis-Datasets/Quantify-Causes.py @@ -66,10 +66,12 @@ #ssids_count= len(ssidTable) #ssid_details= len(ssidTable[0]) -ssidreader=csv.reader(ssids_file,delimiter=',',quotechar='\n') +ssidreader=csv.reader(ssids,delimiter=',',quotechar='\n') for row in ssidreader: availableSSIDs=availableSSIDs.join(','.join(row)) +print "Available SSIDs" % availableSSIDs + current=-1 mac_state=0 #0-unassociated 1-associated mac_bssid="EMPTY" #no bssid @@ -251,7 +253,8 @@ if (currentFrameSSID == "EMPTY" and (currentFrameSA == mac and currentFrameSubType == "0x04" )): c0=c0+1 - elif (currentFrameSSID != "EMPTY" and (currentFrameSA == mac and currentFrameSubType == "0x04" )): + elif (currentFrameSSID != "EMPTY" and (currentFrameSA == mac and currentFrameSubType == "0x04" )): + print currentFrameSSID if ( currentFrameSSID in availableSSIDs): c1=c1+1 else: @@ -335,6 +338,7 @@ if (currentFrameSSID == "EMPTY" and (currentFrameSA == mac and currentFrameSubType == "0x04" )): probeRequestCount[waiting_for_probe][0]=probeRequestCount[waiting_for_probe][0]+1 elif (currentFrameSSID != "EMPTY" and (currentFrameSA == mac and currentFrameSubType == "0x04" )): + print currentFrameSSID if ( currentFrameSSID in availableSSIDs): probeRequestCount[waiting_for_probe][1]=probeRequestCount[waiting_for_probe][1]+1 else: @@ -355,6 +359,9 @@ while (countUnicast <=3 and temp < frames_count and (currentFrameSA == mac and currentFrameSubType == "0x04" )): if(currentFrameSSID==mac_ssid and currentFrameSubType == "0x04" and currentFrameSA == mac): countUnicast=countUnicast + 1 + if ( countUnicast >= 3 and currentFrameSSID in availableSSIDs): + waiting_for_probe=1 + probeRequestCount[waiting_for_probe][1]=countUnicast currentFrameSubType=framesTable[temp][1] currentFrameSSID=framesTable[temp][2] currentFrameSA=framesTable[temp][7] @@ -395,6 +402,7 @@ if (currentFrameSSID == "EMPTY" and (currentFrameSA == mac and currentFrameSubType == "0x04" )): probeRequestCount[waiting_for_probe][0]=probeRequestCount[waiting_for_probe][0]+1 elif (currentFrameSSID != "EMPTY" and (currentFrameSA == mac and currentFrameSubType == "0x04" )): + print currentFrameSSID if ( currentFrameSSID in availableSSIDs): probeRequestCount[waiting_for_probe][1]=probeRequestCount[waiting_for_probe][1]+1 else: @@ -409,6 +417,7 @@ if (currentFrameSSID == "EMPTY"): probeRequestCount[waiting_for_probe][0]=probeRequestCount[waiting_for_probe][0]+1 else: + print currentFrameSSID if ( currentFrameSSID in availableSSIDs): probeRequestCount[waiting_for_probe][1]=probeRequestCount[waiting_for_probe][1]+1 else: diff --git a/CausalAnalysis-Datasets/Quantify-Causes.sh b/CausalAnalysis-Datasets/Quantify-Causes.sh index d426f34..00f1db2 100755 --- a/CausalAnalysis-Datasets/Quantify-Causes.sh +++ b/CausalAnalysis-Datasets/Quantify-Causes.sh @@ -63,5 +63,6 @@ fi i=`expr $i + 1` done - +echo "Sanitizing $output_folder$output_file" +`$codePath/RemoveExtras.sh` diff --git a/CausalAnalysis-Datasets/Quantify-Causes.sh~ b/CausalAnalysis-Datasets/Quantify-Causes.sh~ new file mode 100755 index 0000000..d426f34 --- /dev/null +++ b/CausalAnalysis-Datasets/Quantify-Causes.sh~ @@ -0,0 +1,67 @@ +#!/bin/sh +< /tmp/fileToProcess.csv` + echo "Filtering Beacon Frames" + `awk -F"," 'BEGIN{OFS=",";} {if ($7=="0x08") print $8,$9}' $pcap_file > /tmp/beacons.csv` + + python $codePath/Quantify-Causes.py /tmp/fileToProcess.csv /tmp/beacons.csv $SA $ssid_file >> $output_folder$output_file +fi +i=`expr $i + 1` +done + + +