├── README.md ├── wifiConnect43.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── shively.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── shively.xcuserdatad │ ├── xcdebugger │ └── Breakpoints.xcbkptlist │ └── xcschemes │ ├── wifiConnect43.xcscheme │ └── xcschememanagement.plist └── wifiConnect43 ├── SOLStumbler.h ├── SOLStumbler.m ├── en.lproj ├── InfoPlist.strings └── testViewController.xib ├── main.m ├── testAppDelegate.h ├── testAppDelegate.m ├── testViewController.h ├── testViewController.m ├── wifiConnect43-Info.plist └── wifiConnect43-Prefix.pch /README.md: -------------------------------------------------------------------------------- 1 | This project is verified working with iOS 5.1 2 | Do not attempt to install this project to the simulator or to your device using Xcode. Your device must be jailbroken! 3 | 4 | Buid Steps: 5 | 6 | 1. In testViewController.m, line 35, modify Enter network here to the SSID of the network you wish to associate to. 7 | (optional. if network is wep or wpa protected, edit SOLStumbler.m line 86, change NULL to @"YourWpaKeyHere") 8 | 2. Go to Product > Build For > Archiving 9 | 3. Right click Products > wificonnect43.app and click "Show in Finder" 10 | 4. In the folder Release-iphoneos, move wifiConnect43.app to your Desktop 11 | 5. Move the app to your device using ssh. 12 | 6. Find your device's IP address in the Settings.app. 13 | 7. Execute "scp -rp ~/Desktop/wifiConnect43.app root@{deviceIP}:/Applications/" 14 | 8. Default device password is "alpine" 15 | 9. Restart device 16 | 10. App will be on device and can be run 17 | 18 | If you update the code and want to reinstall you must remove the original app following these steps: 19 | 20 | 1. SSH to device (ex. ssh root@{deviceIP}) 21 | 2. Execute "rm -fr /Applications/wifiConnect43.app" 22 | 3. Execute "reboot" 23 | 4. Then follow build steps above to reinstall 24 | -------------------------------------------------------------------------------- /wifiConnect43.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 08AA176015E6967D0017426F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08AA175F15E6967D0017426F /* UIKit.framework */; }; 11 | 08AA176215E6967D0017426F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08AA176115E6967D0017426F /* Foundation.framework */; }; 12 | 08AA176415E6967D0017426F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08AA176315E6967D0017426F /* CoreGraphics.framework */; }; 13 | 08AA176A15E6967E0017426F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 08AA176815E6967E0017426F /* InfoPlist.strings */; }; 14 | 08AA176C15E6967E0017426F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 08AA176B15E6967E0017426F /* main.m */; }; 15 | 08AA177015E6967E0017426F /* testAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 08AA176F15E6967E0017426F /* testAppDelegate.m */; }; 16 | 08AA177315E6967E0017426F /* testViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08AA177215E6967E0017426F /* testViewController.m */; }; 17 | 08AA177615E6967E0017426F /* testViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 08AA177415E6967E0017426F /* testViewController.xib */; }; 18 | 08AA178215E696DF0017426F /* SOLStumbler.m in Sources */ = {isa = PBXBuildFile; fileRef = 08AA178115E696DF0017426F /* SOLStumbler.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | 08AA175B15E6967D0017426F /* wifiConnect43.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = wifiConnect43.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 08AA175F15E6967D0017426F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 24 | 08AA176115E6967D0017426F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 25 | 08AA176315E6967D0017426F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 26 | 08AA176715E6967E0017426F /* wifiConnect43-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "wifiConnect43-Info.plist"; sourceTree = ""; }; 27 | 08AA176915E6967E0017426F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 28 | 08AA176B15E6967E0017426F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 29 | 08AA176D15E6967E0017426F /* wifiConnect43-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "wifiConnect43-Prefix.pch"; sourceTree = ""; }; 30 | 08AA176E15E6967E0017426F /* testAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = testAppDelegate.h; sourceTree = ""; }; 31 | 08AA176F15E6967E0017426F /* testAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = testAppDelegate.m; sourceTree = ""; }; 32 | 08AA177115E6967E0017426F /* testViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = testViewController.h; sourceTree = ""; }; 33 | 08AA177215E6967E0017426F /* testViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = testViewController.m; sourceTree = ""; }; 34 | 08AA177515E6967E0017426F /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/testViewController.xib; sourceTree = ""; }; 35 | 08AA178015E696DF0017426F /* SOLStumbler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SOLStumbler.h; sourceTree = ""; }; 36 | 08AA178115E696DF0017426F /* SOLStumbler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SOLStumbler.m; sourceTree = ""; }; 37 | /* End PBXFileReference section */ 38 | 39 | /* Begin PBXFrameworksBuildPhase section */ 40 | 08AA175815E6967D0017426F /* Frameworks */ = { 41 | isa = PBXFrameworksBuildPhase; 42 | buildActionMask = 2147483647; 43 | files = ( 44 | 08AA176015E6967D0017426F /* UIKit.framework in Frameworks */, 45 | 08AA176215E6967D0017426F /* Foundation.framework in Frameworks */, 46 | 08AA176415E6967D0017426F /* CoreGraphics.framework in Frameworks */, 47 | ); 48 | runOnlyForDeploymentPostprocessing = 0; 49 | }; 50 | /* End PBXFrameworksBuildPhase section */ 51 | 52 | /* Begin PBXGroup section */ 53 | 08AA175015E6967D0017426F = { 54 | isa = PBXGroup; 55 | children = ( 56 | 08AA176515E6967E0017426F /* wifiConnect43 */, 57 | 08AA175E15E6967D0017426F /* Frameworks */, 58 | 08AA175C15E6967D0017426F /* Products */, 59 | ); 60 | sourceTree = ""; 61 | }; 62 | 08AA175C15E6967D0017426F /* Products */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | 08AA175B15E6967D0017426F /* wifiConnect43.app */, 66 | ); 67 | name = Products; 68 | sourceTree = ""; 69 | }; 70 | 08AA175E15E6967D0017426F /* Frameworks */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 08AA175F15E6967D0017426F /* UIKit.framework */, 74 | 08AA176115E6967D0017426F /* Foundation.framework */, 75 | 08AA176315E6967D0017426F /* CoreGraphics.framework */, 76 | ); 77 | name = Frameworks; 78 | sourceTree = ""; 79 | }; 80 | 08AA176515E6967E0017426F /* wifiConnect43 */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 08AA176E15E6967E0017426F /* testAppDelegate.h */, 84 | 08AA176F15E6967E0017426F /* testAppDelegate.m */, 85 | 08AA177115E6967E0017426F /* testViewController.h */, 86 | 08AA177215E6967E0017426F /* testViewController.m */, 87 | 08AA178015E696DF0017426F /* SOLStumbler.h */, 88 | 08AA178115E696DF0017426F /* SOLStumbler.m */, 89 | 08AA177415E6967E0017426F /* testViewController.xib */, 90 | 08AA176615E6967E0017426F /* Supporting Files */, 91 | ); 92 | path = wifiConnect43; 93 | sourceTree = ""; 94 | }; 95 | 08AA176615E6967E0017426F /* Supporting Files */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 08AA176715E6967E0017426F /* wifiConnect43-Info.plist */, 99 | 08AA176815E6967E0017426F /* InfoPlist.strings */, 100 | 08AA176B15E6967E0017426F /* main.m */, 101 | 08AA176D15E6967E0017426F /* wifiConnect43-Prefix.pch */, 102 | ); 103 | name = "Supporting Files"; 104 | sourceTree = ""; 105 | }; 106 | /* End PBXGroup section */ 107 | 108 | /* Begin PBXNativeTarget section */ 109 | 08AA175A15E6967D0017426F /* wifiConnect43 */ = { 110 | isa = PBXNativeTarget; 111 | buildConfigurationList = 08AA177915E6967E0017426F /* Build configuration list for PBXNativeTarget "wifiConnect43" */; 112 | buildPhases = ( 113 | 08AA175715E6967D0017426F /* Sources */, 114 | 08AA175815E6967D0017426F /* Frameworks */, 115 | 08AA175915E6967D0017426F /* Resources */, 116 | ); 117 | buildRules = ( 118 | ); 119 | dependencies = ( 120 | ); 121 | name = wifiConnect43; 122 | productName = wifiConnect43; 123 | productReference = 08AA175B15E6967D0017426F /* wifiConnect43.app */; 124 | productType = "com.apple.product-type.application"; 125 | }; 126 | /* End PBXNativeTarget section */ 127 | 128 | /* Begin PBXProject section */ 129 | 08AA175215E6967D0017426F /* Project object */ = { 130 | isa = PBXProject; 131 | attributes = { 132 | CLASSPREFIX = test; 133 | LastUpgradeCheck = 0440; 134 | ORGANIZATIONNAME = "Devin Shively"; 135 | }; 136 | buildConfigurationList = 08AA175515E6967D0017426F /* Build configuration list for PBXProject "wifiConnect43" */; 137 | compatibilityVersion = "Xcode 3.2"; 138 | developmentRegion = English; 139 | hasScannedForEncodings = 0; 140 | knownRegions = ( 141 | en, 142 | ); 143 | mainGroup = 08AA175015E6967D0017426F; 144 | productRefGroup = 08AA175C15E6967D0017426F /* Products */; 145 | projectDirPath = ""; 146 | projectRoot = ""; 147 | targets = ( 148 | 08AA175A15E6967D0017426F /* wifiConnect43 */, 149 | ); 150 | }; 151 | /* End PBXProject section */ 152 | 153 | /* Begin PBXResourcesBuildPhase section */ 154 | 08AA175915E6967D0017426F /* Resources */ = { 155 | isa = PBXResourcesBuildPhase; 156 | buildActionMask = 2147483647; 157 | files = ( 158 | 08AA176A15E6967E0017426F /* InfoPlist.strings in Resources */, 159 | 08AA177615E6967E0017426F /* testViewController.xib in Resources */, 160 | ); 161 | runOnlyForDeploymentPostprocessing = 0; 162 | }; 163 | /* End PBXResourcesBuildPhase section */ 164 | 165 | /* Begin PBXSourcesBuildPhase section */ 166 | 08AA175715E6967D0017426F /* Sources */ = { 167 | isa = PBXSourcesBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | 08AA176C15E6967E0017426F /* main.m in Sources */, 171 | 08AA177015E6967E0017426F /* testAppDelegate.m in Sources */, 172 | 08AA177315E6967E0017426F /* testViewController.m in Sources */, 173 | 08AA178215E696DF0017426F /* SOLStumbler.m in Sources */, 174 | ); 175 | runOnlyForDeploymentPostprocessing = 0; 176 | }; 177 | /* End PBXSourcesBuildPhase section */ 178 | 179 | /* Begin PBXVariantGroup section */ 180 | 08AA176815E6967E0017426F /* InfoPlist.strings */ = { 181 | isa = PBXVariantGroup; 182 | children = ( 183 | 08AA176915E6967E0017426F /* en */, 184 | ); 185 | name = InfoPlist.strings; 186 | sourceTree = ""; 187 | }; 188 | 08AA177415E6967E0017426F /* testViewController.xib */ = { 189 | isa = PBXVariantGroup; 190 | children = ( 191 | 08AA177515E6967E0017426F /* en */, 192 | ); 193 | name = testViewController.xib; 194 | sourceTree = ""; 195 | }; 196 | /* End PBXVariantGroup section */ 197 | 198 | /* Begin XCBuildConfiguration section */ 199 | 08AA177715E6967E0017426F /* Debug */ = { 200 | isa = XCBuildConfiguration; 201 | buildSettings = { 202 | ALWAYS_SEARCH_USER_PATHS = NO; 203 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 204 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 205 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 206 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 207 | COPY_PHASE_STRIP = NO; 208 | GCC_C_LANGUAGE_STANDARD = gnu99; 209 | GCC_DYNAMIC_NO_PIC = NO; 210 | GCC_OPTIMIZATION_LEVEL = 0; 211 | GCC_PREPROCESSOR_DEFINITIONS = ( 212 | "DEBUG=1", 213 | "$(inherited)", 214 | ); 215 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 216 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 217 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 218 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 219 | GCC_WARN_UNUSED_VARIABLE = YES; 220 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 221 | SDKROOT = iphoneos; 222 | }; 223 | name = Debug; 224 | }; 225 | 08AA177815E6967E0017426F /* Release */ = { 226 | isa = XCBuildConfiguration; 227 | buildSettings = { 228 | ALWAYS_SEARCH_USER_PATHS = NO; 229 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 230 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 231 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 232 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 233 | COPY_PHASE_STRIP = YES; 234 | GCC_C_LANGUAGE_STANDARD = gnu99; 235 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 236 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 237 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 238 | GCC_WARN_UNUSED_VARIABLE = YES; 239 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 240 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 241 | SDKROOT = iphoneos; 242 | VALIDATE_PRODUCT = YES; 243 | }; 244 | name = Release; 245 | }; 246 | 08AA177A15E6967E0017426F /* Debug */ = { 247 | isa = XCBuildConfiguration; 248 | buildSettings = { 249 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 250 | GCC_PREFIX_HEADER = "wifiConnect43/wifiConnect43-Prefix.pch"; 251 | INFOPLIST_FILE = "wifiConnect43/wifiConnect43-Info.plist"; 252 | PRODUCT_NAME = "$(TARGET_NAME)"; 253 | SDKROOT = iphoneos4.3; 254 | WRAPPER_EXTENSION = app; 255 | }; 256 | name = Debug; 257 | }; 258 | 08AA177B15E6967E0017426F /* Release */ = { 259 | isa = XCBuildConfiguration; 260 | buildSettings = { 261 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 262 | GCC_PREFIX_HEADER = "wifiConnect43/wifiConnect43-Prefix.pch"; 263 | INFOPLIST_FILE = "wifiConnect43/wifiConnect43-Info.plist"; 264 | PRODUCT_NAME = "$(TARGET_NAME)"; 265 | SDKROOT = iphoneos4.3; 266 | WRAPPER_EXTENSION = app; 267 | }; 268 | name = Release; 269 | }; 270 | /* End XCBuildConfiguration section */ 271 | 272 | /* Begin XCConfigurationList section */ 273 | 08AA175515E6967D0017426F /* Build configuration list for PBXProject "wifiConnect43" */ = { 274 | isa = XCConfigurationList; 275 | buildConfigurations = ( 276 | 08AA177715E6967E0017426F /* Debug */, 277 | 08AA177815E6967E0017426F /* Release */, 278 | ); 279 | defaultConfigurationIsVisible = 0; 280 | defaultConfigurationName = Release; 281 | }; 282 | 08AA177915E6967E0017426F /* Build configuration list for PBXNativeTarget "wifiConnect43" */ = { 283 | isa = XCConfigurationList; 284 | buildConfigurations = ( 285 | 08AA177A15E6967E0017426F /* Debug */, 286 | 08AA177B15E6967E0017426F /* Release */, 287 | ); 288 | defaultConfigurationIsVisible = 0; 289 | }; 290 | /* End XCConfigurationList section */ 291 | }; 292 | rootObject = 08AA175215E6967D0017426F /* Project object */; 293 | } 294 | -------------------------------------------------------------------------------- /wifiConnect43.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /wifiConnect43.xcodeproj/project.xcworkspace/xcuserdata/shively.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinshively/wifiAssociate/96cbde5edc954ab135bddb5c4c46fc2380953047/wifiConnect43.xcodeproj/project.xcworkspace/xcuserdata/shively.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /wifiConnect43.xcodeproj/xcuserdata/shively.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 18 | 19 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /wifiConnect43.xcodeproj/xcuserdata/shively.xcuserdatad/xcschemes/wifiConnect43.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /wifiConnect43.xcodeproj/xcuserdata/shively.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | wifiConnect43.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 08AA175A15E6967D0017426F 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /wifiConnect43/SOLStumbler.h: -------------------------------------------------------------------------------- 1 | // 2 | // SOLStumbler.h 3 | // Stumbler 4 | // 5 | // Created by Bryan Bernhart on 1/6/10. 6 | // Copyright Bryan Bernhart 2010. All rights reserved. 7 | // License: GNU General Public License 8 | // 9 | 10 | #import 11 | #import 12 | #include 13 | 14 | @interface SOLStumbler : NSObject { 15 | NSMutableDictionary *networks; //Key: MAC Address (BSSID) 16 | 17 | void *libHandle; 18 | void *airportHandle; 19 | int (*apple80211Open)(void *); 20 | int (*apple80211Bind)(void *, NSString *); 21 | int (*apple80211Close)(void *); 22 | int (*apple80211Associate)(void *, NSDictionary*, NSString*); 23 | int (*apple80211Scan)(void *, NSArray **, void *); 24 | } 25 | 26 | - (NSDictionary *)networks; //returns all 802.11 scanned network(s) 27 | - (NSDictionary *)network:(NSString *) BSSID; //return specific 802.11 network by BSSID (MAC Address) 28 | - (void)scanNetworks; 29 | - (int)numberOfNetworks; 30 | - (int)associateToNetwork:(NSString *)SSID; 31 | 32 | @end -------------------------------------------------------------------------------- /wifiConnect43/SOLStumbler.m: -------------------------------------------------------------------------------- 1 | // 2 | // SOLStumbler.m 3 | // Stumbler 4 | // 5 | // Created by Bryan Bernhart on 1/6/10. 6 | // Copyright 2010 Bryan Bernhart. All rights reserved. 7 | // License: GNU General Public License 8 | // 9 | 10 | #import "SOLStumbler.h" 11 | 12 | @implementation SOLStumbler 13 | 14 | - (id)init 15 | { 16 | self = [super init]; 17 | 18 | networks = [[NSMutableDictionary alloc] init]; 19 | 20 | // libHandle = dlopen("/System/Library/SystemConfiguration/WiFiManager.bundle/WiFiManager",RTLD_LAZY); 21 | libHandle = dlopen("/System/Library/SystemConfiguration/IPConfiguration.bundle/IPConfiguration", RTLD_LAZY); 22 | 23 | char *error; 24 | if (libHandle == NULL && (error = dlerror()) != NULL) { 25 | NSLog(@"%s",error); 26 | exit(1); 27 | } 28 | 29 | apple80211Open = dlsym(libHandle, "Apple80211Open"); 30 | apple80211Bind = dlsym(libHandle, "Apple80211BindToInterface"); 31 | apple80211Close = dlsym(libHandle, "Apple80211Close"); 32 | apple80211Scan = dlsym(libHandle, "Apple80211Scan"); 33 | apple80211Associate = dlsym(libHandle, "Apple80211Associate"); 34 | apple80211Open(&airportHandle); 35 | apple80211Bind(airportHandle, @"en0"); 36 | 37 | return self; 38 | } 39 | 40 | - (NSDictionary *)network:(NSString *) BSSID 41 | { 42 | return [networks objectForKey:@"BSSID"]; 43 | } 44 | 45 | - (NSDictionary *)networks 46 | { 47 | return networks; 48 | } 49 | 50 | - (void)scanNetworks 51 | { 52 | NSLog(@"Scanning WiFi Channels..."); 53 | 54 | NSDictionary *parameters = [[NSDictionary alloc] init]; 55 | NSArray *scan_networks; //is a CFArrayRef of CFDictionaryRef(s) containing key/value data on each discovered network 56 | 57 | apple80211Scan(airportHandle, &scan_networks, parameters); 58 | 59 | for (int i = 0; i < [scan_networks count]; i++) { 60 | [networks setObject:[scan_networks objectAtIndex: i] forKey:[[scan_networks objectAtIndex: i] objectForKey:@"BSSID"]]; 61 | } 62 | NSLog(@"Scanning WiFi Channels Finished."); 63 | } 64 | 65 | -(int)associateToNetwork:(NSString *)SSID 66 | { 67 | NSDictionary *parameters = [[NSDictionary alloc] init]; 68 | NSArray *scan_networks; //is a CFArrayRef of CFDictionaryRef(s) containing key/value data on each discovered network 69 | 70 | apple80211Scan(airportHandle, &scan_networks, parameters); 71 | 72 | for (int i = 0; i < [scan_networks count]; i++) { 73 | [networks setObject:[scan_networks objectAtIndex: i] forKey:[[scan_networks objectAtIndex: i] objectForKey:@"BSSID"]]; 74 | } 75 | 76 | 77 | for (NSDictionary *network in scan_networks) { 78 | if ([network objectForKey:@"SSID_STR"] == SSID) { 79 | 80 | } 81 | } 82 | 83 | for (id key in networks) { 84 | if ([[[networks objectForKey:key] objectForKey:@"SSID_STR"] isEqualToString:SSID]) { 85 | // For connecting to WPA network, replace NULL below with a string containing the key 86 | int associateResult = apple80211Associate(airportHandle, [networks objectForKey:key], NULL); 87 | return associateResult; 88 | } 89 | } 90 | 91 | return -1; 92 | } 93 | 94 | - (int)numberOfNetworks 95 | { 96 | return [networks count]; 97 | } 98 | 99 | - ( NSString * ) description { 100 | 101 | NSMutableString *result = [[NSMutableString alloc] initWithString:@"Networks State: \n"]; 102 | 103 | for (id key in networks){ 104 | 105 | [result appendString:[NSString stringWithFormat:@"%@ (MAC: %@), RSSI: %@, Channel: %@ \n", 106 | [[networks objectForKey: key] objectForKey:@"SSID_STR"], //Station Name 107 | key, //Station BBSID (MAC Address) 108 | [[networks objectForKey: key] objectForKey:@"RSSI"], //Signal Strength 109 | [[networks objectForKey: key] objectForKey:@"CHANNEL"] //Operating Channel 110 | ]]; 111 | } 112 | 113 | return [NSString stringWithString:result]; 114 | } 115 | 116 | - (void) dealloc { 117 | apple80211Close(airportHandle); 118 | [super dealloc]; 119 | } 120 | 121 | 122 | @end -------------------------------------------------------------------------------- /wifiConnect43/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /wifiConnect43/en.lproj/testViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1280 5 | 11C25 6 | 1919 7 | 1138.11 8 | 566.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 916 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | 17 | 18 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 19 | 20 | 21 | PluginDependencyRecalculationVersion 22 | 23 | 24 | 25 | 26 | IBFilesOwner 27 | IBCocoaTouchFramework 28 | 29 | 30 | IBFirstResponder 31 | IBCocoaTouchFramework 32 | 33 | 34 | 35 | 274 36 | {{0, 20}, {320, 460}} 37 | 38 | 39 | 40 | 3 41 | MC43NQA 42 | 43 | 2 44 | 45 | 46 | NO 47 | 48 | IBCocoaTouchFramework 49 | 50 | 51 | 52 | 53 | 54 | 55 | view 56 | 57 | 58 | 59 | 7 60 | 61 | 62 | 63 | 64 | 65 | 0 66 | 67 | 68 | 69 | 70 | 71 | -1 72 | 73 | 74 | File's Owner 75 | 76 | 77 | -2 78 | 79 | 80 | 81 | 82 | 6 83 | 84 | 85 | 86 | 87 | 88 | 89 | testViewController 90 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 91 | UIResponder 92 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 93 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 94 | 95 | 96 | 97 | 98 | 99 | 7 100 | 101 | 102 | 103 | 104 | testViewController 105 | UIViewController 106 | 107 | IBProjectSource 108 | ./Classes/testViewController.h 109 | 110 | 111 | 112 | 113 | 0 114 | IBCocoaTouchFramework 115 | YES 116 | 3 117 | 916 118 | 119 | 120 | -------------------------------------------------------------------------------- /wifiConnect43/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // wifiConnect43 4 | // 5 | // Created by Devin Shively on 8/23/12. 6 | // Copyright (c) 2012 Devin Shively. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "testAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([testAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /wifiConnect43/testAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // testAppDelegate.h 3 | // wifiConnect43 4 | // 5 | // Created by Devin Shively on 8/23/12. 6 | // Copyright (c) 2012 Devin Shively. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class testViewController; 12 | 13 | @interface testAppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) testViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /wifiConnect43/testAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // testAppDelegate.m 3 | // wifiConnect43 4 | // 5 | // Created by Devin Shively on 8/23/12. 6 | // Copyright (c) 2012 Devin Shively. All rights reserved. 7 | // 8 | 9 | #import "testAppDelegate.h" 10 | 11 | #import "testViewController.h" 12 | 13 | @implementation testAppDelegate 14 | 15 | - (void)dealloc 16 | { 17 | [_window release]; 18 | [_viewController release]; 19 | [super dealloc]; 20 | } 21 | 22 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 23 | { 24 | self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 25 | // Override point for customization after application launch. 26 | self.viewController = [[[testViewController alloc] initWithNibName:@"testViewController" bundle:nil] autorelease]; 27 | self.window.rootViewController = self.viewController; 28 | [self.window makeKeyAndVisible]; 29 | return YES; 30 | } 31 | 32 | - (void)applicationWillResignActive:(UIApplication *)application 33 | { 34 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 35 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 36 | } 37 | 38 | - (void)applicationDidEnterBackground:(UIApplication *)application 39 | { 40 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 41 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 42 | } 43 | 44 | - (void)applicationWillEnterForeground:(UIApplication *)application 45 | { 46 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 47 | } 48 | 49 | - (void)applicationDidBecomeActive:(UIApplication *)application 50 | { 51 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 52 | } 53 | 54 | - (void)applicationWillTerminate:(UIApplication *)application 55 | { 56 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /wifiConnect43/testViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // testViewController.h 3 | // wifiConnect43 4 | // 5 | // Created by Devin Shively on 8/23/12. 6 | // Copyright (c) 2012 Devin Shively. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SOLStumbler.h" 11 | 12 | @interface testViewController : UIViewController 13 | @property (nonatomic, retain) UITextView *displayTextView; 14 | @end 15 | -------------------------------------------------------------------------------- /wifiConnect43/testViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // testViewController.m 3 | // wifiConnect43 4 | // 5 | // Created by Devin Shively on 8/23/12. 6 | // Copyright (c) 2012 Devin Shively. All rights reserved. 7 | // 8 | 9 | #import "testViewController.h" 10 | 11 | @interface testViewController () 12 | 13 | @end 14 | 15 | @implementation testViewController 16 | 17 | @synthesize displayTextView = _displayTextView; 18 | 19 | - (void)viewDidLoad 20 | { 21 | [super viewDidLoad]; 22 | // Do any additional setup after loading the view, typically from a nib. 23 | 24 | UIView *dummyView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)]; 25 | 26 | self.displayTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; 27 | [self.view addSubview:self.displayTextView]; 28 | [self.displayTextView setInputView:dummyView]; 29 | 30 | SOLStumbler *sblr = [[SOLStumbler alloc] init]; 31 | [sblr scanNetworks]; 32 | 33 | [self.displayTextView setText:[sblr description]]; 34 | 35 | [self.displayTextView setText:[NSString stringWithFormat:@"%@/n**************/nAssociated with response number: %d", self.displayTextView.text, [sblr associateToNetwork:@"Enter network here"]]]; 36 | } 37 | 38 | - (BOOL)textViewShouldBeginEditing:(UITextView *)textView { 39 | return NO; 40 | } 41 | 42 | - (void)viewDidUnload 43 | { 44 | [super viewDidUnload]; 45 | // Release any retained subviews of the main view. 46 | } 47 | 48 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 49 | { 50 | return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /wifiConnect43/wifiConnect43-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | dshively.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /wifiConnect43/wifiConnect43-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'wifiConnect43' target in the 'wifiConnect43' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | --------------------------------------------------------------------------------