Skip to content

Instantly share code, notes, and snippets.

View enigmaticape's full-sized avatar

Enigmatic Ape enigmaticape

View GitHub Profile
Type : 8 Version : 1 Octets :
Type : 20 Version : 1 Octets :
Type : 1 Version : 1 Octets : 0
Type : 11 Version : 1 Octets : 0
Type : 14 Version : 1 Octets : 82
Type : 15 Version : 1 Octets : 0
Type : 16 Version : 1 Octets : 0
Type : 25 Version : 1 Octets : 3
Type : 10 Version : 1 Octets : 4+
Type : 3 Version : 1 Octets : 1.2
@enigmaticape
enigmaticape / gist:26fb131f7379a20c7718
Created May 22, 2014 16:17
Quick, dirty and really painfully ugly way to parse the data fields out of an app store receipt.
#import <Foundation/Foundation.h>
typedef struct _ASNObject {
NSInteger index;
uint8_t type;
NSUInteger datap;
NSUInteger length;
NSUInteger next;
} ASNObject;
{
environment = Sandbox;
receipt = {
"adam_id" = 0;
"application_version" = "1.2";
"bundle_id" = "com.enigmaticape.Phoreal";
"download_id" = 0;
"in_app" = (
);
"original_application_version" = "1.0";
- (id) parseReceiptData:(NSData *)receipt_data OnAppStoreUsingURL:(NSURL *) store_URL {
NSDictionary * request_contents = @{
@"receipt-data" : [receipt_data base64EncodedStringWithOptions:0]
};
NSError * error = nil;
NSData * request_data = (
[NSJSONSerialization
SMTWiFiStatus * wstatus = [SMTWiFiStatus new];
NSLog(@"Wifi Enabled : %@", [wstatus isWiFiEnabled ] ? @"Yes" : @"No");
NSLog(@"Wifi Connected : %@", [wstatus isWiFiConnected] ? @"Yes" : @"No");
NSLog(@"Wifi BSSID : %@", [wstatus BSSID]);
NSLog(@"Wifi SSID : %@", [wstatus SSID ]);
#import <Foundation/Foundation.h>
#import <ifaddrs.h>
#import <net/if.h>
#import <SystemConfiguration/CaptiveNetwork.h>
@interface SMTWiFiStatus : NSObject
- (BOOL) isWiFiEnabled;
- (BOOL) isWiFiConnected;
Name : lo0, sa_family : 18
Name : lo0, sa_family : 30
Name : lo0, sa_family : 2
Name : lo0, sa_family : 30
Name : pdp_ip0, sa_family : 18
Name : pdp_ip0, sa_family : 2
Name : en0, sa_family : 18
Name : en0, sa_family : 30
Name : en0, sa_family : 2
Name : awdl0, sa_family : 18
Name : lo0, sa_family : 18
Name : lo0, sa_family : 30
Name : lo0, sa_family : 2
Name : lo0, sa_family : 30
Name : pdp_ip0, sa_family : 18
Name : pdp_ip0, sa_family : 2
Name : en0, sa_family : 18
Name : awdl0, sa_family : 18
Name : awdl0, sa_family : 30
Name : lo0, sa_family : 18
Name : lo0, sa_family : 30
Name : lo0, sa_family : 2
Name : lo0, sa_family : 30
Name : pdp_ip0, sa_family : 18
Name : pdp_ip0, sa_family : 2
Name : en0, sa_family : 18
Name : awdl0, sa_family : 18
@enigmaticape
enigmaticape / oneweirdtrick.c
Created May 21, 2014 18:35
Determine if Wi-Fi is enabled on iOS with this one weird trick.
struct ifaddrs *interfaces;
if(!getifaddrs(&interfaces)) {
for( struct ifaddrs *interface = interfaces; interface; interface=interface->ifa_next) {
BOOL up = (interface->ifa_flags & IFF_UP) == IFF_UP;
if ( up ) {
NSLog(
@"Name : %s, sa_family : %d",
interface->ifa_name,
interface->ifa_addr->sa_family