EG Information

Main Index
EG Manual
Disclaimer
Legal Information
Hall of Fame
Hall of Shame
Member Rankings
Members List
Meet the Staff
Hacker's Home Page

Training Missions

Read Me First
Basic Skills
Realistic Scenarios
Cryptography
Software Cracking
Linux ELF Binary Cracking
Logical Thinking
Programming
Captcha Cracking
Patching
Steganography
Deface This Wall
/dev/null
/dev/urandom
/dev/extra

Knowledge Bank

Discussion Forums
Exploit Database New
PasteBin New
RSS Feeds RSS
Articles / Tutorials
Videos
Online EG MP3 Player Radio
Downloads
Tools

Code Resources

Submit Code
Ajax
ASM
Bash
C
CPP
Csharp
Delphi
Haskell
Java
Javascript
Jython
Lisp
mIRC
MySQL
Perl
PHP
Python
QBASIC
VisualBasic

Pimp Us Out!

Review enigmagroup.org on alexa.com

Has Enigma Group Helped You? Then Help Us By Advertising For Us. Place One Of The Following Images On Your Site And Create A Link Back To Enigma Group.

Enigma Group

Enigma Group

Enigma Group

Enigma Group

 

Affiliates

hackhound.org

suck-o.com

hack.org.za

flyninja.net

 

Enigma Group's Code Bank


CLI WAP_Scanner Rev 1

By: BinaryShinigami  -  Date Submitted: 2010-10-19 14:59:46

  1. /* I know the interface is ugly and not very usable at the moment, the point is to learn from the code, the usable prettyful one will be Rev 2*/
  2.  
  3. #include <iostream>
  4. #include <Windows.h>
  5. #include <wlanapi.h> //Wifi functions
  6. #include <strsafe.h> //Safe String Conversion, Wanted to make sure this is Unicode compat. so it adds a little more work
  7.  
  8. #pragma comment(lib, "wlanapi.lib")
  9.  
  10. using namespace std;
  11.  
  12. /** A command line interface WAP scanner built with MSVC using the unicode character set. If you do not recognize the functions or members
  13.  * its probably because they are the unicode versions for MSVC
  14.  * @author BinaryShinigami
  15.  */
  16.  
  17. int wmain(int argc, WCHAR **argv)
  18. {
  19. HANDLE wifiHandle = 0;
  20. DWORD wifiVersion = 0;
  21. PWLAN_INTERFACE_INFO_LIST pInterfaceInfoList = 0;
  22. PWLAN_INTERFACE_INFO pInterfaceInfo = 0;
  23. PWLAN_AVAILABLE_NETWORK_LIST pNetworkList = 0;
  24. PWLAN_AVAILABLE_NETWORK pNetwork = 0;
  25. GUID guidSelectedInterface;
  26. DWORD nInterface;
  27. bool bIsRunning = true;
  28.  
  29. //Get a handle to use with the Native Wifi API functions
  30. if (WlanOpenHandle(2, NULL, &wifiVersion, &wifiHandle) != ERROR_SUCCESS)
  31. {
  32. wcout <<L"Unable to get wifi Handle!" <<endl;
  33. return 0;
  34. }
  35.  
  36. //Enumerate Network Interfaces to get the one we want to use.
  37. if (WlanEnumInterfaces(wifiHandle, NULL,&pInterfaceInfoList) != ERROR_SUCCESS)
  38. {
  39. wcout <<L"Unable to enumerate interface list!" <<endl;
  40. return 0;
  41. }
  42.  
  43. wcout <<L"Interfaces Found: " <<pInterfaceInfoList->dwNumberOfItems <<endl <<endl <<L"Listing Interfaces: " <<endl;
  44. for (unsigned int i = 0; i < pInterfaceInfoList->dwNumberOfItems; i++)
  45. {
  46. pInterfaceInfo = (PWLAN_INTERFACE_INFO)&pInterfaceInfoList->InterfaceInfo[i];
  47. wcout <<L"Interface Number: " <<i <<endl;
  48. wcout <<L"Interface Description: " <<pInterfaceInfo->strInterfaceDescription <<endl;
  49. wcout <<L"Interface State: ";
  50. switch (pInterfaceInfo->isState)
  51. {
  52.  
  53. case wlan_interface_state_not_ready:
  54. wcout <<L"Not Ready" <<endl;
  55. break;
  56. case wlan_interface_state_connected:
  57. wcout <<L"Connected" <<endl;
  58. break;
  59. case wlan_interface_state_ad_hoc_network_formed:
  60. wcout <<L"In Ad Hoc Network" <<endl;
  61. break;
  62. case wlan_interface_state_disconnecting:
  63. wcout <<L"Disconnecting" <<endl;
  64. break;
  65. case wlan_interface_state_disconnected:
  66. wcout <<L"Disconnected" <<endl;
  67. break;
  68. case wlan_interface_state_associating:
  69. wcout <<L"Associating" <<endl;
  70. break;
  71. case wlan_interface_state_discovering:
  72. wcout<<L"Discovering Networks" <<endl;
  73. break;
  74. case wlan_interface_state_authenticating:
  75. wcout <<L"Authenticating Network" <<endl;
  76. break;
  77. default:
  78. wcout <<L"WTF! Unknown State, Your Computer Is Fucked!" <<endl;
  79.  
  80. }
  81. }
  82.  
  83. wcout <<"Please select an interface to utilize for scanning: ";
  84. wcin >>nInterface;
  85.  
  86. while (nInterface >= pInterfaceInfoList->dwNumberOfItems)
  87. {
  88. wcout <<"Invalid Interface Number! Please Try Again: ";
  89. wcin >>nInterface;
  90. }
  91.  
  92. guidSelectedInterface = pInterfaceInfoList->InterfaceInfo[nInterface].InterfaceGuid; //Pull the GUID of the interface we want to use.
  93.  
  94. //We are done with the interface list free it
  95. WlanFreeMemory(pInterfaceInfoList);
  96.  
  97. //Keep listing the available wifi networks ^_^
  98. while (bIsRunning) {
  99. if (WlanGetAvailableNetworkList(wifiHandle, &guidSelectedInterface, 0, NULL, &pNetworkList) != ERROR_SUCCESS)
  100. {
  101. wcout <<L"Error! Quitting!" <<endl;
  102. WlanCloseHandle(wifiHandle,NULL);
  103. return 0;
  104. }
  105.  
  106. wcout <<L"Networks Found: " <<pNetworkList->dwNumberOfItems <<endl <<endl;
  107.  
  108. for(unsigned int i = 0; i < pNetworkList->dwNumberOfItems; i++)
  109. {
  110. pNetwork = (PWLAN_AVAILABLE_NETWORK)&pNetworkList->Network[i];
  111. //WCHAR wcSSID[DOT11_SSID_MAX_LENGTH] = { 0 };
  112.  
  113. wcout <<L"Network SSID: ";
  114.  
  115. //Convert the UCHAR SSID to a Unicode (WCHAR) ssid
  116. for (unsigned int a = 0; a < pNetwork->dot11Ssid.uSSIDLength; a++)
  117. wcout <<(wchar_t)pNetwork->dot11Ssid.ucSSID[a];
  118. wcout <<endl;
  119. //This block may cause some problems, will come back for future look if it causes errors.
  120.  
  121. wcout <<L"Network Type: ";
  122. if (pNetwork->dot11BssType == dot11_BSS_type_infrastructure)
  123. {
  124. wcout <<L"Infrastructure" <<endl;
  125. }
  126. else if (pNetwork->dot11BssType == dot11_BSS_type_independent)
  127. {
  128. wcout <<L"Ad-Hoc" <<endl;
  129. }
  130. else
  131. {
  132. wcout <<L"Any" <<endl;
  133. }
  134.  
  135. wcout <<L"Network Connectable: ";
  136. if (pNetwork->bNetworkConnectable) {
  137. wcout <<L"True" <<endl;
  138. }
  139. else {
  140. wcout << L"False" <<endl;
  141. }
  142.  
  143. wcout <<L"Signal Quality: " <<pNetwork->wlanSignalQuality <<endl;
  144.  
  145. wcout <<L"Auth Algorithm: ";
  146. switch (pNetwork->dot11DefaultAuthAlgorithm)
  147. {
  148. case DOT11_AUTH_ALGO_80211_OPEN:
  149. wcout <<L"None -- Open" <<endl;
  150. break;
  151. case DOT11_AUTH_ALGO_80211_SHARED_KEY:
  152. wcout <<L"WEP" <<endl;
  153. break;
  154. case DOT11_AUTH_ALGO_WPA:
  155. wcout <<L"WPA" <<endl;
  156. break;
  157. case DOT11_AUTH_ALGO_WPA_PSK:
  158. wcout <<L"WPA-PSK" <<endl;
  159. break;
  160. case DOT11_AUTH_ALGO_RSNA:
  161. wcout <<L"RSNA" <<endl;
  162. break;
  163. case DOT11_AUTH_ALGO_RSNA_PSK:
  164. wcout <<L"RSNA-PSK" <<endl;
  165. break;
  166. case DOT11_AUTH_ALGO_IHV_START:
  167. case DOT11_AUTH_ALGO_IHV_END:
  168. wcout <<L"IHV Proprietary" <<endl;
  169. break;
  170. default:
  171. wcout <<L"Unknown Algorithhm" <<endl;
  172.  
  173. }
  174.  
  175. wcout <<L"Cipher Algorithm: ";
  176. switch (pNetwork->dot11DefaultCipherAlgorithm)
  177. {
  178. case DOT11_CIPHER_ALGO_NONE:
  179. wcout <<L"None" <<endl;
  180. break;
  181. case DOT11_CIPHER_ALGO_WEP40:
  182. wcout <<L"WEP40" <<endl;
  183. break;
  184. case DOT11_CIPHER_ALGO_TKIP:
  185. wcout <<L"TKIP" <<endl;
  186. break;
  187. case DOT11_CIPHER_ALGO_CCMP:
  188. wcout <<L"CCMP" <<endl;
  189. break;
  190. case DOT11_CIPHER_ALGO_WEP104:
  191. wcout <<L"WEP104" <<endl;
  192. break;
  193. case DOT11_CIPHER_ALGO_WPA_USE_GROUP:
  194. wcout <<L"WPA-Group OR RSN-Group" <<endl;
  195. break;
  196. case DOT11_CIPHER_ALGO_WEP:
  197. wcout <<L"WEP-Any" <<endl;
  198. break;
  199. case DOT11_CIPHER_ALGO_IHV_START:
  200. case DOT11_CIPHER_ALGO_IHV_END:
  201. wcout <<L"IHV-Proprietary" <<endl;
  202. break;
  203. default:
  204. wcout <<L"Unknown" <<endl;
  205. }
  206.  
  207. wcout <<endl;
  208.  
  209. }
  210.  
  211. WlanFreeMemory(pNetworkList); //Free the memory, no fucking memory leaks for me :p
  212. wcout <<endl;
  213. }
  214.  
  215. //Close the wifi handle
  216. WlanCloseHandle(wifiHandle,NULL);
  217.  
  218. wcin.get();
  219. }
Return to cpp category list

Who Visited EnigmaGroup Today?

1386 Guests, 225 Users (218 Spiders)
Edika, tgm001, TheCheeseDemon, plex, rockcraft, Pabz, recoveryToolbox, saraf, soufiaane, sickmind, cat1vo, mjneat, famous0123, Galagatron, dark_void, CJ_Omaha, junaid_junaid59, JohnJohnJohn, ssmaslov, psychomarine, Dregoon, Patrickk, Aska, Beat_Slayer, M0rdak, Ausome1, Imre, Vreality2007, mmndglxuwn, m0rt, unholyblood, iterrumzz, VurbTrurb, Mayonoula, MAMWOURBROR, mutabor, gobinda, cossyDrybrich, Razin, zaCruBumas8, hunja, johny34, pantoufle, bagy, arctica, hackarchives, UsedDeteKef, Peculator, Fadhilat606, TheTrueMonarch, Pascall01, hackaday, Tjm, arndevil, flairvelocity, lol, alphbond, kdivanov, elizbethallis6, Rik, bn11, BorgBot, SHASHANK101hello, 4poc4lyptic, ksajxai, nbmorri1, electro-technic, شمالي عرعر, lamb, AutobotPrime, Underleaf, The End, tomtombomb, killobyte, snowgirlx, so_saucey, zerolife, Althor, Cramps, Hekser, Hyperborn, cyber-guard, jhgrunn, cobra, Partisan, MAZI_, cyborg, GenbreedX, moel77, cliptoX, pwnpwnlolz, letshavepie, Mrwormz, yshiau, mirmo, roozyoppomo, soft_devil, cls777, scoobywan, Reiversed, joshua, st3alth, Afrika, PaiffDryday, venter, Anthony12796, sh3llcod3, 8FIGURE, Rannim, Evil1, maloaboy, BACanON, SlayingDragons, Repuhlsive, IvanDimitriev, lolzsec, 1RiB, mzungudo, Micro_Geek, iMaxx, aciboummamymn, k0unterkulcher, somebody777, m14m16, GoododotAlcob, negasora, Rastii, UninueMem, Swifsolja, ad.conquest, ngolatkar, Infinity8, Jigoku, thesupervisor, p0is0n5ting, kernel_mod, AKL, GothicLogic, themastersinner, dnatrixene135, ChewBigRed, kalak55, sejem, cve916, pollolololo, triecturn, Violatedsmurf, Ops, jmp, xsiemich, generalisimo, strudels, ga3ttpom, KingOfBritains, epoch_qwert, suten, FriskyKat, Ryuske, Adonis Achilles, ubqbcdzzhf, 3vil, Nightraven, US£RNAM£, Weindittewcon, Batesheelocot, GSmyrlis, MaxMeier, Elite.America, rabbidmind, Psiber_Syn, phoenix22, imittyerrotte, peewster, cyberturtle, ctb, dexgeda, sdw, Pizza, White_widdow, devarian, finesse, Nature112091777, Danc7171, Alphadragon, Estadagause, 53QR10U5, Xargos, Alkomage, hardlock, Barry Gonzoles, MineDweller, Gkjt, N4g4c3N, [I]nfectedbug, wimsteege, aqr5zdcw, xin214, Bugshuppy, SnoopSky, Hessesian, voodooKobra, sKcarr, IROverRated, W1F1G3NJU75U, Baddy, ziadmosaan, gamble86, realzs, CruelDemon, Shinju, aVoid, aquiredanonymity, kukumumu, web_request, callmeneon, KissMyDAFFODIL, Feld Grau, Abhinav2107, prabhataditya, mbuyiselo, shumer, phenom216, princennamdi, huskyboiza, ninety-nine
 
Enigma Group