Эх сурвалжийг харах

Kleine Änderung der Cipherstrings (WPA/WPA2).

Rind 1 жил өмнө
parent
commit
b902ebd497
2 өөрчлөгдсөн 43 нэмэгдсэн , 1 устгасан
  1. 26 0
      src/gfanetmon.h
  2. 17 1
      src/gfawifimon.cpp

+ 26 - 0
src/gfanetmon.h

@@ -190,6 +190,18 @@ public:
 		return "";
 	}
 
+	std::string GetWPAGroupCiphersWPA(void) {
+		if(m_groupCiphersWPA.size() > 0)
+			return ConcatStrings(m_groupCiphersWPA);
+		return "";
+	}
+
+	std::string GetWPAPairwiseCiphersWPA(void) {
+		if(m_pairwCiphersWPA.size() > 0)
+			return ConcatStrings(m_pairwCiphersWPA);
+		return "";
+	}
+
 	bool GetConnected(void) const {
 		return m_bConnected;
 	}
@@ -205,6 +217,8 @@ public:
 	std::vector<uint32_t> m_bitRates;
 	std::vector<std::string> m_groupCiphers;
 	std::vector<std::string> m_pairwCiphers;
+	std::vector<std::string> m_groupCiphersWPA;
+	std::vector<std::string> m_pairwCiphersWPA;
 		
 	double freqHz;				// Frequency/channel in Hz
     struct sockaddr	ap_addr;	// MAC address
@@ -366,6 +380,18 @@ public:
 		return "";
 	}
 
+	std::string GetWPAGroupCiphersWPA(int cellidx) {
+		if((cellidx >= 0) && (cellidx < (int)m_scres.size()))
+			return m_scres[cellidx].GetWPAGroupCiphersWPA();
+		return "";
+	}
+
+	std::string GetWPAPairwiseCiphersWPA(int cellidx) {
+		if((cellidx >= 0) && (cellidx < (int)m_scres.size()))
+			return m_scres[cellidx].GetWPAPairwiseCiphersWPA();
+		return "";
+	}
+
 	bool GetConnected(int cellidx) const {
 		if((cellidx >= 0) && (cellidx < (int)m_scres.size()))
 			return m_scres[cellidx].GetConnected();

+ 17 - 1
src/gfawifimon.cpp

@@ -56,6 +56,17 @@ static const char *	iw_ie_cypher_name[] =
 };
 #define	IW_IE_CYPHER_NUM	_countof(iw_ie_cypher_name)
 
+static const char *	iw_ie_cypher_name_wpa[] =
+{
+    "none",
+    "WEP-40",
+    "WPA",
+    "WRAP",
+    "WPA2",
+    "WEP-104"
+};
+#define	IW_IE_CYPHER_WPA_NUM	_countof(iw_ie_cypher_name_wpa)
+
 static bool _FindString(const std::vector<std::string> &arr, const char *pszFind)
 {
 	for(std::string s : arr)
@@ -478,6 +489,9 @@ void CGfaWifiScanResults::SetWPAStrings(unsigned char *iebuf, int buflen)
     {
         std::string s = iw_print_value_name(iebuf[offset + 3], iw_ie_cypher_name, IW_IE_CYPHER_NUM);
     	_PushIfNotExists(m_groupCiphers, s.c_str());
+
+        s = iw_print_value_name(iebuf[offset + 3], iw_ie_cypher_name_wpa, IW_IE_CYPHER_WPA_NUM);
+    	_PushIfNotExists(m_groupCiphersWPA, s.c_str());
     }
     offset += 4;
 
@@ -506,7 +520,9 @@ void CGfaWifiScanResults::SetWPAStrings(unsigned char *iebuf, int buflen)
         {
             std::string s = iw_print_value_name(iebuf[offset + 3], iw_ie_cypher_name, IW_IE_CYPHER_NUM);
 	    	_PushIfNotExists(m_pairwCiphers, s.c_str());
-//	        m_pairwCiphers.push_back(s;
+
+            s = iw_print_value_name(iebuf[offset + 3], iw_ie_cypher_name_wpa, IW_IE_CYPHER_WPA_NUM);
+	    	_PushIfNotExists(m_pairwCiphersWPA, s.c_str());
         }
         offset += 4;
     }