mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-31 18:58:01 +00:00 
			
		
		
		
	updated wifi_diag_python
This commit is contained in:
		| @@ -19,7 +19,7 @@ class Plot: | |||||||
|         # print("In Plot") |         # print("In Plot") | ||||||
|         pass |         pass | ||||||
|  |  | ||||||
|     def bar(self, datax="", datay=" ", title="Temp", xaxis="xaxis", yaxis="yaxis",figname="temp"): |     def bar(self, datax="", datay=" ", title="Temp", xaxis="yaxis", yaxis="xaxis",figname="temp"): | ||||||
|         # fig = plt.figure() |         # fig = plt.figure() | ||||||
|         self.tmpfile = BytesIO() |         self.tmpfile = BytesIO() | ||||||
|  |  | ||||||
|   | |||||||
| @@ -48,106 +48,106 @@ def htmlobj(text): | |||||||
| def htmlpointview(): | def htmlpointview(): | ||||||
|     pointview = """ |     pointview = """ | ||||||
| <!--For Point view --> | <!--For Point view --> | ||||||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | <meta name="viewport" content="width=device-width, initial-scale=1">\n | ||||||
| <style> | <style>\n | ||||||
| ul, #myUL { | ul, #myUL {\n | ||||||
|   list-style-type: none; |   list-style-type: none;\n | ||||||
| } | }\n | ||||||
|  |  | ||||||
| #myUL { | #myUL {\n | ||||||
|   margin: 0; |   margin: 0;\n | ||||||
|   padding: 0; |   padding: 0;\n | ||||||
| } | }\n | ||||||
|  |  | ||||||
| .box { | .box {\n | ||||||
|   cursor: pointer; |   cursor: pointer;\n | ||||||
|   -webkit-user-select: none; /* Safari 3.1+ */ |   -webkit-user-select: none; /* Safari 3.1+ */\n | ||||||
|   -moz-user-select: none; /* Firefox 2+ */ |   -moz-user-select: none; /* Firefox 2+ */\n | ||||||
|   -ms-user-select: none; /* IE 10+ */ |   -ms-user-select: none; /* IE 10+ */\n | ||||||
|   user-select: none; |   user-select: none;\n | ||||||
| } | }\n | ||||||
|  |  | ||||||
| .box::before { | .box::before {\n | ||||||
|   content: "\\2610"; |   content: "\\2610";\n | ||||||
|   color: black; |   color: black;\n | ||||||
|   display: inline-block; |   display: inline-block;\n | ||||||
|   margin-right: 6px; |   margin-right: 6px;\n | ||||||
| } | }\n | ||||||
|  |  | ||||||
| .check-box::before { | .check-box::before {\n | ||||||
|   content: "\\2611"; |   content: "\\2611";\n | ||||||
|   color: dodgerblue; |   color: dodgerblue;\n | ||||||
| } | }\n | ||||||
|  |  | ||||||
| .nested { | .nested {\n | ||||||
|   display: none; |   display: none;\n | ||||||
| } | }\n | ||||||
|  |  | ||||||
| .active { | .active {\n | ||||||
|   display: block; |   display: block;\n | ||||||
| } | }\n | ||||||
|  |  | ||||||
| * { | * {\n | ||||||
|   box-sizing: border-box; |   box-sizing: border-box;\n | ||||||
| } | }\n | ||||||
|  |  | ||||||
| .column { | .column {\n | ||||||
|   float: left; |   float: left;\n | ||||||
|   width: 100%; |   width: 100%;\n | ||||||
|  |  | ||||||
| } | }\n | ||||||
|  |  | ||||||
| .row::after { | .row::after {\n | ||||||
|   content: ""; |   content: "";\n | ||||||
|   clear: both; |   clear: both;\n | ||||||
|   display: table; |   display: table;\n | ||||||
| } | }\n | ||||||
|  |  | ||||||
| .borderexample { | .borderexample {\n | ||||||
|  border-style:solid; |  border-style:solid;\n | ||||||
|  border-color: hsl(0, 0%, 73%); |  border-color: hsl(0, 0%, 73%);\n | ||||||
| } | }\n | ||||||
| .btn { | .btn {\n | ||||||
|   background-color: DodgerBlue; |   background-color: DodgerBlue;\n | ||||||
|   border: none; |   border: none;\n | ||||||
|   color: white; |   color: white;\n | ||||||
|   padding: 12px 30px; |   padding: 12px 30px;\n | ||||||
|   cursor: pointer; |   cursor: pointer;\n | ||||||
|   font-size: 20px; |   font-size: 20px;\n | ||||||
| } | }\n | ||||||
|  |  | ||||||
| /* Darker background on mouse-over  | /* Darker background on mouse-over */ | ||||||
| .btn:hover { | .btn:hover {\n | ||||||
|   background-color: RoyalBlue; |   background-color: RoyalBlue;\n | ||||||
| } | }\n | ||||||
| </style> | </style>\n | ||||||
| </head> | </head>\n | ||||||
| """ | """ | ||||||
|     html.write(str(pointview)) |     html.write(str(pointview)) | ||||||
|  |  | ||||||
| def htmlTableSummary(Summary): | def htmlTableSummary(Summary): | ||||||
|     tableSummary = "<body><!-- This is heading and Summary --><h2> About: </h2> \ |     tableSummary = "<body><!-- This is heading and Summary --><h2> About: </h2> \n \ | ||||||
|     <p>"+str(Summary)+"</p> \n" |     <p>"+str(Summary)+"</p> \n" | ||||||
|  |  | ||||||
|     html.write(str(tableSummary)) |     html.write(str(tableSummary)) | ||||||
|  |  | ||||||
| def myUL(): | def myUL(): | ||||||
|     html.write("<ul id='myUL'>") |     html.write("<ul id='myUL'> \n") | ||||||
|  |  | ||||||
|  |  | ||||||
| def htmlSpanBox(Table): | def htmlSpanBox(Table): | ||||||
|     tablespan = "<li><span class= 'box borderexample'>"+str(Table)+"</span> <ul class='nested'> " |     tablespan = "<li><span class= 'box borderexample'>"+str(Table)+"</span> <ul class='nested'> \n" | ||||||
|     html.write(tablespan) |     html.write(tablespan) | ||||||
|  |  | ||||||
| def htmlSpanBox1(): | def htmlSpanBox1(): | ||||||
|     tablespan = "<li><span class='box'> Table </span> <ul class='nested'> " |     tablespan = "<li><span class='box'> Table </span> <ul class='nested'> \n" | ||||||
|     html.write(tablespan) |     html.write(tablespan) | ||||||
|  |  | ||||||
| def htmltable(Heading,data,image1,image2,image3): | def htmltable(Heading,data,image1,image2,image3,summary): | ||||||
|     # htmlBreak(1) |     # htmlBreak(1) | ||||||
|     htmlSpanBox(Heading) |     htmlSpanBox(Heading) | ||||||
|     htmlTableSummary("This is table summary below Objective \n") |     htmlTableSummary(str(summary)+"\n") | ||||||
|     htmlSpanBox1() |     # htmlSpanBox1() | ||||||
|     html.write("<li><span> ") |     html.write("<li><span> ") | ||||||
|     html.write(str(data)) |     html.write(str(data)) | ||||||
|     html.write("</span></li> ") |     html.write("</span></li> ") | ||||||
| @@ -223,10 +223,8 @@ def htmlSpace(space): | |||||||
|     </style>""" |     </style>""" | ||||||
|     html.write(Space) |     html.write(Space) | ||||||
|  |  | ||||||
| def htmlText(text, title): | def htmlText(text): | ||||||
|     title = "<h2" + str(title) + "</h2>" |  | ||||||
|     data = "<p>" + str(text) + "<p/>" |     data = "<p>" + str(text) + "<p/>" | ||||||
|     html.write(title) |  | ||||||
|     html.write(data) |     html.write(data) | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -76,19 +76,19 @@ def PacketHistogram(subtype_list, Managementls, Controlls, Data_framels, count): | |||||||
|     NewPerList = per_list |     NewPerList = per_list | ||||||
|     # NewPerList.append(sum(NewPerList)) |     # NewPerList.append(sum(NewPerList)) | ||||||
|  |  | ||||||
|     print(len(subtype_list),len(NewSubList),len(pack_list),print(NewPerList)) |     # print(len(subtype_list),len(NewSubList),len(pack_list),print(NewPerList)) | ||||||
|     df_Type = pd.DataFrame(({"Type": Type_list, "Subtype": NewSubList, "Packet to packet": pack_list, "Percentage": NewPerList})) |     df_Type = pd.DataFrame(({" Type ": Type_list, " Subtype ": NewSubList, " Total Packets ": pack_list, "Percentage": NewPerList})) | ||||||
|  |  | ||||||
|  |  | ||||||
|     # print("df_Type",df_Type) |     # print("df_Type",df_Type) | ||||||
|  |  | ||||||
|     df_Type = df_Type.to_html() |     df_Type = df_Type.to_html(index=False) | ||||||
|     # NewPerList.pop() |     # NewPerList.pop() | ||||||
|     # NewSubList.pop() |     # NewSubList.pop() | ||||||
|     plot = Plot() |     plot = Plot() | ||||||
|     path = plot.bar(datax=NewSubList,datay=NewPerList,title="Type/SubType plot",xaxis="Subtype",yaxis="Percentage",figname="Type") |     path = plot.bar(datax=NewSubList,datay=NewPerList,title="Type/SubType plot",xaxis="Subtype",yaxis="Percentage",figname="Type") | ||||||
|  |  | ||||||
|     htmltable(" Packet Type histogram", df_Type, str(path), "0", "0") |     htmltable(" Packet Type histogram", df_Type, str(path), "0", "0","Summary ") | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -121,12 +121,12 @@ def RateHistogram(DataRate, PhyType, SignalStrength, count): | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     df_Rate = pd.DataFrame({"Rate MBPS": [i for i in dictRate.keys()], "Packet to packet": [j for j in dictRate.values()], "Percentage": [k for k in perUniqueData]}) |     df_Rate = pd.DataFrame({" Rate MBPS ": [i for i in dictRate.keys()], " Total Packets ": [j for j in dictRate.values()], " Percentage ": [k for k in perUniqueData]}) | ||||||
|  |  | ||||||
|     df_Rate = df_Rate.T |     # df_Rate = df_Rate.T | ||||||
|     df_Rate.columns = df_Rate.iloc[0] |     # df_Rate.columns = df_Rate.iloc[0] | ||||||
|     df_Rate = df_Rate.drop(df_Rate.iloc[0].index.name) |     # df_Rate = df_Rate.drop(df_Rate.iloc[0].index.name) | ||||||
|     df_Rate = df_Rate.to_html() |     df_Rate = df_Rate.to_html(index=False) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -139,7 +139,7 @@ def RateHistogram(DataRate, PhyType, SignalStrength, count): | |||||||
|                     figname="rate") |                     figname="rate") | ||||||
|  |  | ||||||
|  |  | ||||||
|     htmltable(" Encoding rate histogram.", df_Rate, str(path), "0", "0") |     htmltable(" Encoding rate histogram.", df_Rate, str(path), "0", "0","Summary ") | ||||||
|  |  | ||||||
|  |  | ||||||
|     # This is for Phy Histogram |     # This is for Phy Histogram | ||||||
| @@ -156,16 +156,16 @@ def RateHistogram(DataRate, PhyType, SignalStrength, count): | |||||||
|     for d in countUniquePhy: |     for d in countUniquePhy: | ||||||
|         perUniquePhy.append(round((d * 100) / count, 2)) |         perUniquePhy.append(round((d * 100) / count, 2)) | ||||||
|  |  | ||||||
|     df_Phy = pd.DataFrame({"Phy": [i for i in dictPhy.keys()], "Packet to Packet": [j for j in dictPhy.values()],"Percentage": [k for k in perUniquePhy]}) |     df_Phy = pd.DataFrame({" PHY ": [i for i in dictPhy.keys()], " Total Packets ": [j for j in dictPhy.values()]," Percentage ": [k for k in perUniquePhy]}) | ||||||
|  |  | ||||||
|     # print("df_Phy",df_Phy) |     # print("df_Phy",df_Phy) | ||||||
|  |  | ||||||
|     # df_Phy = df_Phy.to_html() |     # df_Phy = df_Phy.to_html() | ||||||
|  |  | ||||||
|     df_Phy = df_Phy.T |     # df_Phy = df_Phy.T | ||||||
|     df_Phy.columns = df_Phy.iloc[0] |     # df_Phy.columns = df_Phy.iloc[0] | ||||||
|     df_Phy = df_Phy.drop(df_Phy.iloc[0].index.name) |     # df_Phy = df_Phy.drop(df_Phy.iloc[0].index.name) | ||||||
|     df_Phy = df_Phy.to_html() |     df_Phy = df_Phy.to_html(index=False) | ||||||
|  |  | ||||||
|     dictphys = [i for i in dictPhy.keys()] |     dictphys = [i for i in dictPhy.keys()] | ||||||
|  |  | ||||||
| @@ -176,7 +176,7 @@ def RateHistogram(DataRate, PhyType, SignalStrength, count): | |||||||
|     path = plot2.bar(datax=dictphys, datay=perUniquePhy, title="Phy plot", xaxis="Subtype", yaxis="Percentage", |     path = plot2.bar(datax=dictphys, datay=perUniquePhy, title="Phy plot", xaxis="Subtype", yaxis="Percentage", | ||||||
|                     figname="Phy") |                     figname="Phy") | ||||||
|  |  | ||||||
|     htmltable(" Phy Histogram.",df_Phy,str(path),"0","0") |     htmltable(" Phy Histogram.",df_Phy,str(path),"0","0","Summary ") | ||||||
|  |  | ||||||
|     # This is for Signal Histogram |     # This is for Signal Histogram | ||||||
|     uniqueSignal = np.unique(SignalStrength) |     uniqueSignal = np.unique(SignalStrength) | ||||||
| @@ -199,38 +199,213 @@ def RateHistogram(DataRate, PhyType, SignalStrength, count): | |||||||
|     #                        "Percentage": [k for k in perUniqueSignal]}) |     #                        "Percentage": [k for k in perUniqueSignal]}) | ||||||
|  |  | ||||||
|     # pd.DataFrame.reset_index(drop=True,inplace=True) |     # pd.DataFrame.reset_index(drop=True,inplace=True) | ||||||
|     print([k for k in dictSig.keys()]) |     # print([k for k in dictSig.keys()]) | ||||||
|     print([i for i in dictSig.values()]) |     # print([i for i in dictSig.values()]) | ||||||
|     print("perUniqueSignal",perUniqueSignal) |     # print("perUniqueSignal",perUniqueSignal) | ||||||
|  |  | ||||||
|     # pd.DataFrame |     # pd.DataFrame | ||||||
|     df_Sig = pd.DataFrame({"Signal":[k for k in dictSig.keys()],"Packet":[i for i in dictSig.values()],"Percentage":[j for j in perUniqueSignal]}) |     df_Sig = pd.DataFrame({" Signal ":[k for k in dictSig.keys()]," Total Packets ":[i for i in dictSig.values()]," Percentage ":[j for j in perUniqueSignal]}) | ||||||
|  |  | ||||||
|     df_Sig = df_Sig.T |     # df_Sig = df_Sig.T | ||||||
|     df_Sig.columns = df_Sig.iloc[0] |     # df_Sig.columns = df_Sig.iloc[0] | ||||||
|     df_Sig = df_Sig.drop(df_Sig.iloc[0].index.name) |     # df_Sig = df_Sig.drop(df_Sig.iloc[0].index.name) | ||||||
|     # df_Sig.columns.name = None |     # df_Sig.columns.name = None | ||||||
|     # df_Sig.index.name = "Signal" |     # df_Sig.index.name = "Signal" | ||||||
|     print("df_Sig",df_Sig) |     # print("df_Sig",df_Sig) | ||||||
|     # print("df_Sig",df_Sig) |     # print("df_Sig",df_Sig) | ||||||
|  |  | ||||||
|     # df_Sig = df_Sig.to_html() |     # df_Sig = df_Sig.to_html() | ||||||
|  |  | ||||||
|     # df_Sig = df_Sig.transpose() |     # df_Sig = df_Sig.transpose() | ||||||
|     df_Sig = df_Sig.to_html() |     df_Sig = df_Sig.to_html(index=False) | ||||||
|  |  | ||||||
|     # perUniqueSignal.pop() |     # perUniqueSignal.pop() | ||||||
|     dictSigs = [i for i in dictSig.keys()] |     dictSigs = [i for i in dictSig.keys()] | ||||||
|     # dictSigs.pop() |     # dictSigs.pop() | ||||||
|  |  | ||||||
|     plot3 = Plot() |     plot3 = Plot() | ||||||
|     path = plot2.bar(datax=dictSigs, datay=perUniqueSignal, title="Signal plot", xaxis="Signal", yaxis="Percentage", |     path = plot3.bar(datax=dictSigs, datay=perUniqueSignal, title="Signal plot", xaxis="Signal", yaxis="Percentage", | ||||||
|                      figname="Signal") |                      figname="Signal") | ||||||
|     htmltable(" Signal Histogram.", df_Sig, str(path), "0", "0") |     htmltable(" Signal Histogram.", df_Sig, str(path), "0", "0","Summary ") | ||||||
|  |  | ||||||
|     # print(dictSigs,perUniqueSignal) |     # print(dictSigs,perUniqueSignal) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | def PHY_BW_MCS_NCS(MCSIndex, vMCS, Bandwidth, vBW, PHY, vPHY, Spatial_Stream, vNCS,  count): | ||||||
|  |  | ||||||
|  |     countUniqueMCSIndex = [] | ||||||
|  |     countUniqueBandwidth = [] | ||||||
|  |     countUniquePHY = [] | ||||||
|  |     countUniqueSpatial_stream = [] | ||||||
|  |  | ||||||
|  |     perUniqueMCS = [] | ||||||
|  |     perUniqueBW = [] | ||||||
|  |     perUniquePHY = [] | ||||||
|  |     perUniqueNCS = [] | ||||||
|  |  | ||||||
|  |     uniqueMCSIndex = np.unique(MCSIndex) | ||||||
|  |     uniqueBandwidth = ((np.unique(Bandwidth))) | ||||||
|  |     # uniquePHY = ((np.unique(PHY))) | ||||||
|  |     uniqueSpatial_stream = ((np.unique(Spatial_Stream))) | ||||||
|  |  | ||||||
|  |     for countMCS in uniqueMCSIndex: | ||||||
|  |         countUniqueMCSIndex.append(MCSIndex.count(countMCS)) | ||||||
|  |  | ||||||
|  |     for cnt in countUniqueMCSIndex: | ||||||
|  |         perUniqueMCS.append(round((cnt * 100) / count, 2)) | ||||||
|  |  | ||||||
|  |     dictMCS = dict(zip(uniqueMCSIndex,countUniqueMCSIndex)) | ||||||
|  |     df_MCS = pd.DataFrame({" MCS ": [k for k in dictMCS.keys()], " Total Packets ": [i for i in dictMCS.values()]," Percentage ":[j for j in perUniqueMCS]}) | ||||||
|  |     # df_MCS = df_MCS.T | ||||||
|  |     # df_MCS.columns = df_MCS.iloc[0] | ||||||
|  |     # df_MCS = df_MCS.drop(df_MCS.iloc[0].index.name) | ||||||
|  |     # print("df_MCS", df_MCS) | ||||||
|  |  | ||||||
|  |     df_MCS = df_MCS.to_html(index=False) | ||||||
|  |     dictMCSs = [i for i in dictMCS.keys()] | ||||||
|  |     plot4 = Plot() | ||||||
|  |     path = plot4.bar(datax=dictMCSs, datay=perUniqueMCS, title="MCS plot", xaxis="MCS", yaxis="Percentage", | ||||||
|  |                      figname="MCS") | ||||||
|  |     PacketInfo = ("Data packets having MCS field: "+str(vMCS)+"<br>") | ||||||
|  |     htmltable("Data MCS Histogram.", df_MCS, str(path), "0", "0",PacketInfo) | ||||||
|  |  | ||||||
|  |     # print(uniqueMCSIndex, countUniqueMCSIndex) | ||||||
|  |  | ||||||
|  |     for countBandwidth in uniqueBandwidth: | ||||||
|  |         countUniqueBandwidth.append(Bandwidth.count(countBandwidth)) | ||||||
|  |  | ||||||
|  |     for cnt in countUniqueBandwidth: | ||||||
|  |         perUniqueBW.append(round((cnt * 100) / count, 2)) | ||||||
|  |  | ||||||
|  |     dictBW = dict(zip(uniqueBandwidth, countUniqueBandwidth)) | ||||||
|  |     df_BW = pd.DataFrame({" Bandwidth ": [k for k in dictBW.keys()], " Total Packets ": [i for i in dictBW.values()]," Percentage ":[j for j in perUniqueBW]}) | ||||||
|  |     # df_BW = df_BW.T | ||||||
|  |     # df_BW.columns = df_BW.iloc[0] | ||||||
|  |     # df_BW = df_BW.drop(df_BW.iloc[0].index.name) | ||||||
|  |     # print("df_BW", df_BW) | ||||||
|  |  | ||||||
|  |     df_BW = df_BW.to_html(index=False) | ||||||
|  |     dictBWs = [i for i in dictBW.keys()] | ||||||
|  |     plot5 = Plot() | ||||||
|  |     path = plot5.bar(datax=dictBWs, datay=perUniqueBW, title="Bandwidth plot", xaxis="Bandwidth", yaxis="Percentage", | ||||||
|  |                      figname="Bandwidth") | ||||||
|  |  | ||||||
|  |     PacketInfo = ("Data packets having BW field: " + str(vBW) + "<br>") | ||||||
|  |     htmltable("Data Bandwidth Histogram.", df_BW, str(path), "0", "0",PacketInfo) | ||||||
|  |  | ||||||
|  |     # print(uniqueBandwidth, countUniqueBandwidth) | ||||||
|  |  | ||||||
|  |     """ | ||||||
|  |     #For PHY | ||||||
|  |     for countPHY in uniquePHY: | ||||||
|  |         countUniquePHY.append(PHY.count(countPHY)) | ||||||
|  |          | ||||||
|  |     for cnt in countUniquePHY: | ||||||
|  |         perUniquePHY.append(round((cnt * 100) / count, 2)) | ||||||
|  |      | ||||||
|  |     dictPHY = dict(zip(uniquePHY, countUniquePHY)) | ||||||
|  |     df_PHY = pd.DataFrame({"PHY": [k for k in dictPHY.keys()], "Packet": [i for i in dictPHY.values()],"Percentage":[j for j in perUniquePHY]}) | ||||||
|  |     df_PHY = df_PHY.T | ||||||
|  |     df_PHY.columns = df_PHY.iloc[0] | ||||||
|  |     df_PHY = df_PHY.drop(df_PHY.iloc[0].index.name) | ||||||
|  |     print("df_PHY", df_PHY) | ||||||
|  |     """ | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     for countNCS in uniqueSpatial_stream: | ||||||
|  |         countUniqueSpatial_stream.append(Spatial_Stream.count(countNCS)) | ||||||
|  |  | ||||||
|  |     for cnt in countUniqueSpatial_stream: | ||||||
|  |         perUniqueNCS.append(round((cnt * 100) / count, 2)) | ||||||
|  |  | ||||||
|  |     dictNCS = dict(zip(uniqueSpatial_stream, countUniqueSpatial_stream)) | ||||||
|  |     df_NCS = pd.DataFrame({" NSS ": [k for k in dictNCS.keys()], " Total Packets ": [i for i in dictNCS.values()]," Percentage ":[j for j in perUniqueNCS]}) | ||||||
|  |  | ||||||
|  |     # df_NCS = df_NCS.T | ||||||
|  |     # df_NCS.columns = df_NCS.iloc[0] | ||||||
|  |     # df_NCS = df_NCS.drop(df_NCS.iloc[0].index.name) | ||||||
|  |     # print("df_NCS", df_NCS) | ||||||
|  |     # df_NCS = df_NCS.T | ||||||
|  |     df_NCS = df_NCS.to_html(index=False) | ||||||
|  |     dictNCSs = [i for i in dictNCS.keys()] | ||||||
|  |     plot6 = Plot() | ||||||
|  |     path = plot6.bar(datax=dictNCSs, datay=perUniqueNCS, title="NCS plot", xaxis="Spatial stream", yaxis="Percentage", | ||||||
|  |                      figname="NSS") | ||||||
|  |     PacketInfo = ("Data packets having NSS field: " + str(vNCS) + "<br>") | ||||||
|  |     htmltable("Data NSS Histogram.", df_NCS, str(path), "0", "0",PacketInfo) | ||||||
|  |  | ||||||
|  | def RateAMPDU(AMPDU,count): | ||||||
|  |     countAMPDU = [] | ||||||
|  |     # print("IN AMPDU") | ||||||
|  |     # print("AMPDU: ",AMPDU) | ||||||
|  |  | ||||||
|  |     countUniqueAMPDU = [] | ||||||
|  |  | ||||||
|  |     perUniqueAMPDU = [] | ||||||
|  |     chainCountAMPDU = [] | ||||||
|  |  | ||||||
|  |     uniqueAMPDU = np.unique(AMPDU) | ||||||
|  |     uniqueAMPDU = [i for i in uniqueAMPDU] | ||||||
|  |  | ||||||
|  |     # print("uniqueAMPDU",uniqueAMPDU) | ||||||
|  |     # | ||||||
|  |     # print("len(uniqueAMPDU)",len(uniqueAMPDU)) | ||||||
|  |  | ||||||
|  |     for countAMPDU in uniqueAMPDU: | ||||||
|  |         countUniqueAMPDU.append(AMPDU.count(countAMPDU)) | ||||||
|  |  | ||||||
|  |     # print("countUniqueAMPDU",countUniqueAMPDU) | ||||||
|  |     # print("len(countUniqueAMPDU)",len(countUniqueAMPDU)) | ||||||
|  |  | ||||||
|  |     chainUniqueAMPDU = np.unique(countUniqueAMPDU) | ||||||
|  |     chainUniqueAMPDU = [i for i in chainUniqueAMPDU] | ||||||
|  |  | ||||||
|  |     # print("chainUniqueAMPDU", chainUniqueAMPDU) | ||||||
|  |     # print("len(chainUniqueAMPDU)", len(chainUniqueAMPDU)) | ||||||
|  |  | ||||||
|  |     for Acount in chainUniqueAMPDU: | ||||||
|  |         chainCountAMPDU.append(countUniqueAMPDU.count(Acount)) | ||||||
|  |  | ||||||
|  |     # print(" len(chainCountAMPDU): ", len(chainCountAMPDU)) | ||||||
|  |     # print("chainCountAMPDU",chainCountAMPDU) | ||||||
|  |  | ||||||
|  |     UniqueChainCountAMPDU = np.unique(chainCountAMPDU) | ||||||
|  |     UniqueChainCountAMPDU = [i for i in UniqueChainCountAMPDU] | ||||||
|  |  | ||||||
|  |     listAMPDU = [] | ||||||
|  |     for un in UniqueChainCountAMPDU: | ||||||
|  |         listAMPDU.append(chainCountAMPDU.count(un)) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     print(chainUniqueAMPDU,chainCountAMPDU) | ||||||
|  |     dictAMPDU = dict(zip(chainUniqueAMPDU,chainCountAMPDU)) | ||||||
|  |  | ||||||
|  |     for acnt in chainCountAMPDU: | ||||||
|  |         perUniqueAMPDU.append(round((acnt * 100) / count, 4)) | ||||||
|  |     # | ||||||
|  |     # print("dictAMPDU",dictAMPDU) | ||||||
|  |     # | ||||||
|  |     # print("len(perUniqueAMPDU)",len(perUniqueAMPDU)) | ||||||
|  |     # print("perUniqueAMPDU",perUniqueAMPDU) | ||||||
|  |     # | ||||||
|  |     df_AMPDU = pd.DataFrame({" Chain count ": [k for k in dictAMPDU.keys()], " Total Packets ": [i for i in dictAMPDU.values()], | ||||||
|  |                            " Percentage ": [j for j in perUniqueAMPDU]}) | ||||||
|  |     # df_AMPDU = df_AMPDU.T | ||||||
|  |     # df_AMPDU.columns = df_AMPDU.iloc[0] | ||||||
|  |     # df_AMPDU = df_AMPDU.drop(df_AMPDU.iloc[0].index) | ||||||
|  |     # df_AMPDU = df_AMPDU.T | ||||||
|  |     df_AMPDU = df_AMPDU.to_html(index=False) | ||||||
|  |     # dictAMPDUs = [i for i in dictAMPDU.keys()] | ||||||
|  |     # | ||||||
|  |     plot6 = Plot() | ||||||
|  |     path = plot6.bar(datax=chainUniqueAMPDU, datay=perUniqueAMPDU, title="AMPDU plot", xaxis="packet Chain", yaxis="Percentage", | ||||||
|  |                      figname="AMPDU") | ||||||
|  |     PacketInfo = ("EMPTY") | ||||||
|  |     htmltable("AMPDU chain count Histogram.", df_AMPDU, str(path), "0", "0", PacketInfo) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| class shark: | class shark: | ||||||
| @@ -240,25 +415,27 @@ class shark: | |||||||
|         # self.FilePath = "C:\Candela\Scripts\Lanforge scripts\lanforge-scripts-master\wifi_diag\wifi_diag.pcapng" |         # self.FilePath = "C:\Candela\Scripts\Lanforge scripts\lanforge-scripts-master\wifi_diag\wifi_diag.pcapng" | ||||||
|         # self.FilePath = "wifi_diag.pcap" |         # self.FilePath = "wifi_diag.pcap" | ||||||
|         # self.FilePath = "C:\candela\pcap\wifi.pcapng" |         # self.FilePath = "C:\candela\pcap\wifi.pcapng" | ||||||
|         self.FilePath = "C:\candela\pcap\\ac1_28Sept.pcapng" |         # self.FilePath = "C:\candela\pcap\\ac_28Sept.pcapng" | ||||||
|         # self.FilePath = "C:\Candela\My_Scripts\WIFI_diag11ax\wifi.pcapng" |         # self.FilePath = "C:\candela\pcap\\11ax.pcapng" | ||||||
|         # self.FilePath = "wifi_diag.pcap" |         # self.FilePath = "C:\candela\pcap\\11ax_cap2_Copy.pcapng" | ||||||
|  |         # self.FilePath = "C:\candela\pcap\sta1.pcap" | ||||||
|  |         self.FilePath = output | ||||||
|  |  | ||||||
|         self.cap = pyshark.FileCapture(self.FilePath) |         self.cap = pyshark.FileCapture(self.FilePath) | ||||||
|         print("Strt time stamp :",datetime.datetime.now()) |         # print("Strt time stamp :",datetime.datetime.now()) | ||||||
|  |  | ||||||
|     def Extract(self): |     def Extract(self): | ||||||
|  |  | ||||||
|         type_list = {"0": "Management frame", "1": "Control Frame", "2": "Data frame"} |         type_list = {"0": "Management frame", "1": "Control Frame", "2": "Data frame"} | ||||||
|         subtype_list = {"80": "Beacon frame", "d0": "Action", "b4": "Request-to-send", "d4": "Acknowledgement", \ |         subtype_list = {"80": "Beacon frame", "d0": "Action", "b4": "Request-to-send", "d4": "Acknowledgement", \ | ||||||
|                         "88": "QoS Data", "84": "Block Ack Req", "94": "Block Ack Req", "08": "Data", \ |                         "88": "QoS Data", "84": "Block Ack Req", "94": "Block Ack Req", \ | ||||||
|                         "40": "Probe Request", "50": "Probe Response", "b0": "Authentication", |                         "40": "Probe Request", "50": "Probe Response", "b0": "Authentication", | ||||||
|                         "a2": "Disassociate", "a8": "QoS Data + CF-Poll", "c8":"QoS Null function", \ |                         "a2": "Disassociate", "a8": "QoS Data + CF-Poll", "c8":"QoS Null function", \ | ||||||
|                         "10": "Association Response", "00": "Association Request", "c4": "Clear-to-send", \ |                         "10": "Association Response", "00": "Association Request", "c4": "Clear-to-send", \ | ||||||
|                         "98": "QoS Data + CF-Acknowledgment", "24": "Trigger", "28": "Data + CF-Poll" ,\ |                         "98": "QoS Data + CF-Acknowledgment", "24": "Trigger", "28": "Data + CF-Poll" ,\ | ||||||
|                         "d8": "Unknown", "54": "VHT/HE NDP Announcement", "e8": "QoS CF-Poll", \ |                         "d8": "Unknown", "54": "VHT/HE NDP Announcement", "e8": "QoS CF-Poll", \ | ||||||
|                         "b8" : "QoS Data + CF-Ack + CF-Poll", "18": "Data + CF-Ack", "48" : "Null function", \ |                         "b8" : "QoS Data + CF-Ack + CF-Poll", "18": "Data + CF-Ack", "48" : "Null function", \ | ||||||
|                         "69" : "CF-Poll" |                         "69" : "CF-Poll", "08": "Data" | ||||||
|                         } |                         } | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -271,19 +448,12 @@ class shark: | |||||||
|  |  | ||||||
|  |  | ||||||
|         MCSIndex = [] |         MCSIndex = [] | ||||||
|         uniqueMCSIndex = [] |  | ||||||
|         countUniqueMCSIndex = [] |  | ||||||
|         MCSIndex |  | ||||||
|  |  | ||||||
|         Bandwidth = [] |         Bandwidth = [] | ||||||
|         countUniqueBandwidth = [] |  | ||||||
|  |  | ||||||
|         PHY = [] |         PHY = [] | ||||||
|         countUniquePHY = [] |  | ||||||
|  |  | ||||||
|         Spatial_Stream = [] |         Spatial_Stream = [] | ||||||
|         countUniqueSpatial_stream = [] |         AMPDU = [] | ||||||
|  |  | ||||||
|  |         vDataType = 0 | ||||||
|         count = 0 |         count = 0 | ||||||
|         vWLAN_RADIO = 0 |         vWLAN_RADIO = 0 | ||||||
|         vsignalstrength = 0 |         vsignalstrength = 0 | ||||||
| @@ -291,6 +461,16 @@ class shark: | |||||||
|         vdatarate = 0 |         vdatarate = 0 | ||||||
|         vWLAN = 0 |         vWLAN = 0 | ||||||
|  |  | ||||||
|  |         vNotPHY = 0 | ||||||
|  |         vNotBW = 0 | ||||||
|  |         vNotMCS = 0 | ||||||
|  |         vNOTNCS = 0 | ||||||
|  |         vMCS = 0 | ||||||
|  |         vPHY = 0 | ||||||
|  |         vBW = 0 | ||||||
|  |         vNCS = 0 | ||||||
|  |         vAMPDU = 0 | ||||||
|  |         vNotAMPD = 0 | ||||||
|         """ Comment    |         """ Comment    | ||||||
|         """ |         """ | ||||||
|  |  | ||||||
| @@ -326,11 +506,21 @@ class shark: | |||||||
|         for packet in self.cap: |         for packet in self.cap: | ||||||
|             count += 1 |             count += 1 | ||||||
|  |  | ||||||
|             # print(count) |             # print("Count :",end= " ") | ||||||
|  |             print(count) | ||||||
|  |  | ||||||
|  |  | ||||||
|             try: |             try: | ||||||
|                 WLAN_RADIO = packet.wlan_radio |                 WLAN_RADIO = packet.wlan_radio | ||||||
|  |                 wlan_radio_Fields_keys = [] | ||||||
|  |                 wlan_radio_Fields_values = [] | ||||||
|  |  | ||||||
|  |                 for keys, values in packet.wlan_radio._all_fields.items(): | ||||||
|  |                     # print(keys, ":", values) | ||||||
|  |                     wlan_radio_Fields_keys.append(keys) | ||||||
|  |                     wlan_radio_Fields_values.append(values) | ||||||
|  |                 # print("---------------------------------------------") | ||||||
|  |  | ||||||
|                 vWLAN_RADIO = 1 |                 vWLAN_RADIO = 1 | ||||||
|                 try: |                 try: | ||||||
|                     signalstrength = WLAN_RADIO.signal_dbm |                     signalstrength = WLAN_RADIO.signal_dbm | ||||||
| @@ -356,12 +546,24 @@ class shark: | |||||||
|  |  | ||||||
|             try: |             try: | ||||||
|                 RADIOTAP = packet.radiotap |                 RADIOTAP = packet.radiotap | ||||||
|  |                 # radiotap_field_keys = [] | ||||||
|  |                 # radiotap_field_values = [] | ||||||
|  |                 # | ||||||
|  |                 # for keys, values in packet.radiotap._all_fields.items(): | ||||||
|  |                 #     print(keys, ":", values) | ||||||
|  |                 #     radiotap_field_keys.append(keys) | ||||||
|  |                 #     radiotap_field_values.append(values) | ||||||
|  |  | ||||||
|  |                 # print("*****************RADIOTAP**************************") | ||||||
|             except: |             except: | ||||||
|                 # print("RADIOTAP NOT FOUND") |                 # print("RADIOTAP NOT FOUND") | ||||||
|                 pass |                 pass | ||||||
|  |  | ||||||
|             try: |             try: | ||||||
|                 WLAN = packet.wlan |                 WLAN = packet.wlan | ||||||
|  |                 # for keys, values in packet.wlan._all_fields.items(): | ||||||
|  |                 #     print(keys, ":", values) | ||||||
|  |                 # print("***********************************************") | ||||||
|                 vWLAN = 1 |                 vWLAN = 1 | ||||||
|             except: |             except: | ||||||
|                 pass |                 pass | ||||||
| @@ -369,7 +571,6 @@ class shark: | |||||||
|  |  | ||||||
|  |  | ||||||
|             PacketCount = (packet.number) |             PacketCount = (packet.number) | ||||||
|             # print("PacketCount: ", PacketCount) |  | ||||||
|  |  | ||||||
|  |  | ||||||
|             if vWLAN == 1: |             if vWLAN == 1: | ||||||
| @@ -396,8 +597,100 @@ class shark: | |||||||
|                         print("Control Frame", subtype, subtype_raw) |                         print("Control Frame", subtype, subtype_raw) | ||||||
|  |  | ||||||
|                 elif (type_raw == "2"): |                 elif (type_raw == "2"): | ||||||
|  |  | ||||||
|                     try: |                     try: | ||||||
|  |                         vDataType += 1 | ||||||
|  |  | ||||||
|  |  | ||||||
|                         Data_framels.append(subtype_list[subtype_raw]) |                         Data_framels.append(subtype_list[subtype_raw]) | ||||||
|  |                         checkType =  packet.wlan_radio._all_fields["wlan_radio.phy"] | ||||||
|  |  | ||||||
|  |  | ||||||
|  |                         try: | ||||||
|  |  | ||||||
|  |                             if "wlan_radio.11ac.bandwidth" and "wlan_radio.11ac.mcs" and "wlan_radio.11ac.nss" in wlan_radio_Fields_keys: | ||||||
|  |                                 print("in 11ac") | ||||||
|  |                                 try: | ||||||
|  |  | ||||||
|  |                                     if "wlan_radio.11ac.bandwidth" in wlan_radio_Fields_keys: | ||||||
|  |                                         Bandwidth.append(packet.wlan_radio._all_fields["wlan_radio.11ac.bandwidth"].showname_value) | ||||||
|  |                                         vBW += 1 | ||||||
|  |                                         # print("11 ac bandwidth") | ||||||
|  |  | ||||||
|  |  | ||||||
|  |                                     if "wlan_radio.11ac.mcs" in wlan_radio_Fields_keys: | ||||||
|  |                                         MCSIndex.append(packet.wlan_radio._all_fields["wlan_radio.11ac.mcs"].showname_value) | ||||||
|  |                                         vMCS += 1 | ||||||
|  |                                         # print("11 ac MCS") | ||||||
|  |  | ||||||
|  |  | ||||||
|  |                                     if "wlan_radio.11ac.nss" in wlan_radio_Fields_keys: | ||||||
|  |                                         Spatial_Stream.append(packet.wlan_radio._all_fields["wlan_radio.11ac.nss"].showname_value) | ||||||
|  |                                         vNCS += 1 | ||||||
|  |                                         # print("11 ac NSS") | ||||||
|  |  | ||||||
|  |  | ||||||
|  |                                 except: | ||||||
|  |                                     print("wlan_radio.11ac.bandwidth  or wlan_radio.11ac.mcs or wlan_radio.11ac.nss not found") | ||||||
|  |  | ||||||
|  |                             try: | ||||||
|  |                                 # print("in 11ax") | ||||||
|  |                                 radiotap_field_keys = [] | ||||||
|  |                                 radiotap_field_values = [] | ||||||
|  |  | ||||||
|  |                                 for keys, values in packet.radiotap._all_fields.items(): | ||||||
|  |                                     # print(keys, ":", values) | ||||||
|  |                                     radiotap_field_keys.append(keys) | ||||||
|  |                                     radiotap_field_values.append(values) | ||||||
|  |  | ||||||
|  |                                 if "radiotap.he.data_3.data_mcs" and "radiotap.he.data_5.data_bw_ru_allocation" and "radiotap.he.data_6.nsts" in radiotap_field_keys: | ||||||
|  |  | ||||||
|  |                                     print("in 11ax inside") | ||||||
|  |                                     try: | ||||||
|  |                                         if "radiotap.he.data_3.data_mcs" in radiotap_field_keys: | ||||||
|  |                                             # print("in 11ax radiotap") | ||||||
|  |                                             MCSIndex.append(packet.radiotap._all_fields["radiotap.he.data_3.data_mcs"].showname_value) | ||||||
|  |                                             vMCS += 1 | ||||||
|  |                                     except: | ||||||
|  |                                         print("MCS not found in ax") | ||||||
|  |  | ||||||
|  |                                     try: | ||||||
|  |                                         if "radiotap.he.data_5.data_bw_ru_allocation" in radiotap_field_keys: | ||||||
|  |                                             # print("in BW radiotap 11ax") | ||||||
|  |                                             Bandwidth.append(packet.radiotap._all_fields["radiotap.he.data_5.data_bw_ru_allocation"].showname_value) | ||||||
|  |                                             vBW += 1 | ||||||
|  |  | ||||||
|  |                                     except: | ||||||
|  |                                         print("BW not found in ax") | ||||||
|  |  | ||||||
|  |                                     try: | ||||||
|  |                                         if "radiotap.he.data_6.nsts" in radiotap_field_keys: | ||||||
|  |                                             # print("in 11ax radiotap nsts") | ||||||
|  |                                             Spatial_Stream.append(packet.radiotap._all_fields["radiotap.he.data_6.nsts"].showname_value) | ||||||
|  |                                             vNCS += 1 | ||||||
|  |  | ||||||
|  |  | ||||||
|  |                                     except: | ||||||
|  |                                         print("NSTS not found in ax") | ||||||
|  |                             except: | ||||||
|  |                                 print("radiotap.he.data_3.data_mcs  or radiotap.he.data_5.data_bw_ru_allocation or radiotap.he.data_6.nsts not found") | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |                             if "wlan_radio.a_mpdu_aggregate_id" in wlan_radio_Fields_keys: | ||||||
|  |                                 AMPDU.append((packet.wlan_radio._all_fields["wlan_radio.a_mpdu_aggregate_id"].showname_value)) | ||||||
|  |                                 vAMPDU += 1 | ||||||
|  |  | ||||||
|  |  | ||||||
|  |                             if "wlan_radio.phy" in wlan_radio_Fields_keys: | ||||||
|  |                                 PHY.append(packet.wlan_radio._all_fields["wlan_radio.phy"].showname_value) | ||||||
|  |                                 vPHY += 1 | ||||||
|  |  | ||||||
|  |  | ||||||
|  |                         except: | ||||||
|  |                             pass | ||||||
|  |                             # print("comming out through try in except") | ||||||
|  |  | ||||||
|  |  | ||||||
|                     except: |                     except: | ||||||
|                         print("Data frame", subtype, subtype_raw) |                         print("Data frame", subtype, subtype_raw) | ||||||
| @@ -408,18 +701,6 @@ class shark: | |||||||
|                 print("Packet Number :",count,":"," WLAN NOT FOUND") |                 print("Packet Number :",count,":"," WLAN NOT FOUND") | ||||||
|  |  | ||||||
|             vWLAN = 0 |             vWLAN = 0 | ||||||
|             if vWLAN_RADIO == 1: |  | ||||||
|                 # print("vWLAN Found") |  | ||||||
|  |  | ||||||
|                 wlan_radio_Fields_keys = [] |  | ||||||
|                 wlan_radio_Fields_values = [] |  | ||||||
|  |  | ||||||
|                 for keys, values in packet.wlan_radio._all_fields.items(): |  | ||||||
|                     # print(keys, ":", values) |  | ||||||
|                     wlan_radio_Fields_keys.append(keys) |  | ||||||
|                     wlan_radio_Fields_values.append(values) |  | ||||||
|  |  | ||||||
|  |  | ||||||
|             if vdatarate == 1: |             if vdatarate == 1: | ||||||
|                 DataRate.append(datarate) |                 DataRate.append(datarate) | ||||||
|  |  | ||||||
| @@ -429,81 +710,108 @@ class shark: | |||||||
|             if vsignalstrength == 1: |             if vsignalstrength == 1: | ||||||
|                 SignalStrength.append(signalstrength) |                 SignalStrength.append(signalstrength) | ||||||
|  |  | ||||||
|                 vWLAN_RADIO = 0 |  | ||||||
|             else: |  | ||||||
|                 print("Packet Number :",count," WLAN RADIO NOT FOUND") |  | ||||||
|  |  | ||||||
|             try: |             try: | ||||||
|                 vMCS = 0 |  | ||||||
|                 {"MCSIndex":['0 (BPSK 1/2)','1 (QPSK 1/2)','2 (QPSK 3/4)','4 (16-QAM 3/4)','5 (64-QAM 2/3)']} |                 print("\r"+count,":",packet.wlan_radio._all_fields.items()) | ||||||
|                 {"Spatial_stream":["2"]} |  | ||||||
|                 {} |  | ||||||
|                 if "wlan_radio.11ac.bandwidth" and "wlan_radio.11ac.bandwidth" and "wlan_radio.phy" and \ |                 # if "wlan_radio.11ac.bandwidth" and "wlan_radio.11ac.bandwidth" and "wlan_radio.phy" and \ | ||||||
|                         "wlan_radio.11ac.mcs" and "wlan_radio.11ac.nss" in wlan_radio_Fields_keys: |                 #         "wlan_radio.11ac.mcs" and "wlan_radio.11ac.nss" in wlan_radio_Fields_keys: | ||||||
|                     # print(dir(packet.wlan_radio._all_fields["wlan_radio.phy"])) |                     # print(dir(packet.wlan_radio._all_fields["wlan_radio.phy"])) | ||||||
|                     # print(packet.wlan_radio._all_fields["wlan_radio.phy"].showname_value) #for PHY |                     # print(packet.wlan_radio._all_fields["wlan_radio.phy"].showname_value) #for PHY | ||||||
|                     # print(packet.wlan_radio._all_fields["wlan_radio.11ac.bandwidth"].showname_value) #for BW |                     # print(packet.wlan_radio._all_fields["wlan_radio.11ac.bandwidth"].showname_value) #for BW | ||||||
|                     # print(packet.wlan_radio._all_fields["wlan_radio.11ac.mcs"].showname_value) #for MCS |                     # print(packet.wlan_radio._all_fields["wlan_radio.11ac.mcs"].showname_value) #for MCS | ||||||
|                     # print(packet.wlan_radio._all_fields["wlan_radio.11ac.nss"].showname_value) #for Spatial streams |                     # print(packet.wlan_radio._all_fields["wlan_radio.11ac.nss"].showname_value) #for Spatial streams | ||||||
|                     PHY.append(packet.wlan_radio._all_fields["wlan_radio.phy"].showname_value) |  | ||||||
|                     Bandwidth.append(packet.wlan_radio._all_fields["wlan_radio.11ac.bandwidth"].showname_value) |                 # if "wlan_radio.phy" in wlan_radio_Fields_keys: | ||||||
|                     MCSIndex.append(packet.wlan_radio._all_fields["wlan_radio.11ac.mcs"].showname_value) |                 #     PHY.append(packet.wlan_radio._all_fields["wlan_radio.phy"].showname_value) | ||||||
|                     Spatial_Stream.append(packet.wlan_radio._all_fields["wlan_radio.11ac.nss"].showname_value) |                 #     vPHY +=1 | ||||||
|                     vMCS = 1 |                 # else: | ||||||
|  |                 #     vNotPHY +=1 | ||||||
|  |                 #     # print("PHY NF") | ||||||
|  |                 # | ||||||
|  |                 # if "wlan_radio.11ac.bandwidth" in wlan_radio_Fields_keys: | ||||||
|  |                 #     Bandwidth.append(packet.wlan_radio._all_fields["wlan_radio.11ac.bandwidth"].showname_value) | ||||||
|  |                 #     vBW +=1 | ||||||
|  |                 # else: | ||||||
|  |                 #     vNotBW += 1 | ||||||
|  |                 #     # print("Bandwidth NF") | ||||||
|  |                 # | ||||||
|  |                 # if "wlan_radio.11ac.mcs" in wlan_radio_Fields_keys: | ||||||
|  |                 #     MCSIndex.append(packet.wlan_radio._all_fields["wlan_radio.11ac.mcs"].showname_value) | ||||||
|  |                 #     vMCS +=1 | ||||||
|  |                 # else: | ||||||
|  |                 #     vNotMCS +=1 | ||||||
|  |                 #     # print("MCS Index NF") | ||||||
|  |                 # | ||||||
|  |                 # if "wlan_radio.11ac.nss" in wlan_radio_Fields_keys: | ||||||
|  |                 #     Spatial_Stream.append(packet.wlan_radio._all_fields["wlan_radio.11ac.nss"].showname_value) | ||||||
|  |                 #     vNCS += 1 | ||||||
|  |                 # else: | ||||||
|  |                 #     vNOTNCS += 1 | ||||||
|  |                 #     # print("Spatial stream NF") | ||||||
|             except: |             except: | ||||||
|                 pass |                 pass | ||||||
|  |  | ||||||
|  |         # print("Here") | ||||||
|         # print("MCSIndex",len(MCSIndex),MCSIndex) |         # print("MCSIndex",len(MCSIndex),MCSIndex) | ||||||
|         # print("Bandwidth",len(Bandwidth),Bandwidth) |         # print("Bandwidth",len(Bandwidth),Bandwidth) | ||||||
|         # print("PHY",len(PHY),PHY) |         # print("PHY",len(PHY),PHY) | ||||||
|         # print("Spatial_Stream",len(Spatial_Stream),Spatial_Stream) |         # print("Spatial_Stream",len(Spatial_Stream),Spatial_Stream) | ||||||
|  |         if vAMPDU != 0: | ||||||
|  |             RateAMPDU(AMPDU,count) | ||||||
|  |  | ||||||
|         uniqueMCSIndex = np.unique(MCSIndex) |         # print("Data Frames: ",vDataType) | ||||||
|         uniqueBandwidth = ((np.unique(Bandwidth))) |  | ||||||
|         uniquePHY = ((np.unique(PHY))) |  | ||||||
|         uniqueSpatial_stream = ((np.unique(Spatial_Stream))) |  | ||||||
|         exit() |  | ||||||
|  |  | ||||||
|         print("After appending time stamp :", datetime.datetime.now()) |         # if vax11 == 1: | ||||||
|         # print(count) |         #     print("vNOTNCS :", vNOTNCS, "vNotBW :", vNotBW, "vNotMCS:", vNotMCS, "vNotPHY:", vNotPHY) | ||||||
|  |         #     PHY_BW_MCS_NCS_11ax(MCSIndex, vMCS, vNotMCS, Bandwidth, vBW, vNotBW, PHY, vPHY, vNotPHY, count) | ||||||
|  |         # else: | ||||||
|  |         # print("vNotBW :",vNotBW,"vNotMCS:",vNotMCS,"vNotPHY:",vNotPHY) | ||||||
|  |         PHY_BW_MCS_NCS(MCSIndex, vMCS, Bandwidth, vBW, PHY, vPHY, Spatial_Stream, vNCS,  count) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         # print("After appending time stamp :", datetime.datetime.now()) | ||||||
|         RateHistogram(DataRate, PhyType, SignalStrength, count) |         RateHistogram(DataRate, PhyType, SignalStrength, count) | ||||||
|         print("After RateHist time stamp :", datetime.datetime.now()) |         # print("After RateHist time stamp :", datetime.datetime.now()) | ||||||
|         PacketHistogram(subtype_list, Managementls, Controlls, Data_framels, count) |         PacketHistogram(subtype_list, Managementls, Controlls, Data_framels, count) | ||||||
|         print("After PacketHist time stamp :", datetime.datetime.now()) |         # print("After PacketHist time stamp :", datetime.datetime.now()) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||||
|  |  | ||||||
|  |  | ||||||
|     # parser = argparse.ArgumentParser(description="To create a single pcap file combining multiple pcap files") |     parser = argparse.ArgumentParser(description="To create a single pcap file combining multiple pcap files") | ||||||
|     # # parser.add_argument("-o", "--output", type=str, help="Enter the output pcap file name") |     # parser.add_argument("-o", "--output", type=str, help="Enter the output pcap file name") | ||||||
|     # parser.add_argument("-i", "--input", type=str, |     parser.add_argument("-i", "--input", type=str, | ||||||
|     #                     help="Enter the Name of the pcap files which needs to be combined") |                         help="Enter the Name of the pcap files which needs to be combined") | ||||||
|     # |  | ||||||
|     # args = None |     args = None | ||||||
|     # |  | ||||||
|     # try: |     try: | ||||||
|     #     args = parser.parse_args() |         args = parser.parse_args() | ||||||
|     #     output = "wifi_diag.pcap" |         output = "wifi_diag.pcap" | ||||||
|     # |  | ||||||
|     #     if (args.input is not None): |         if (args.input is not None): | ||||||
|     #         input = args.input  # 'C:\candela\pcap\\11ax.pcapng','C:\candela\pcap\sta1.pcap' |             input = args.input  # 'C:\candela\pcap\\11ax.pcapng','C:\candela\pcap\sta1.pcap' | ||||||
|     #         input = input.split(",") |             input = input.split(",") | ||||||
|     #         print(input) |             print(input) | ||||||
|     # |  | ||||||
|     #     # if (args.input is None): |         # if (args.input is None): | ||||||
|     #     #     input = "11ax.pcapng", "sta1.pcap" |         #     input = "11ax.pcapng", "sta1.pcap" | ||||||
|     # |  | ||||||
|     # except Exception as e: |     except Exception as e: | ||||||
|     #     logging.exception(e) |         logging.exception(e) | ||||||
|     #     exit(2) |         exit(2) | ||||||
|     # |  | ||||||
|     # with open(output, 'wb') as wfd: |     with open(output, 'wb') as wfd: | ||||||
|     #     print("input", input) |         print("input", input) | ||||||
|     #     for f in (input): |         for f in (input): | ||||||
|     #         with open(f, 'rb') as fd: |             with open(f, 'rb') as fd: | ||||||
|     #             shutil.copyfileobj(fd, wfd) |                 shutil.copyfileobj(fd, wfd) | ||||||
|  |  | ||||||
|     htmlstart() |     htmlstart() | ||||||
|     downloadBtn() |     downloadBtn() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 SushantBawiskar
					SushantBawiskar