Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timestamp and other (very minor) "cleanup" #27

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Icon.icns
Binary file not shown.
2 changes: 1 addition & 1 deletion iPhoneTracking-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>Icon.png</string>
<string>Icon.icns</string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand Down
4 changes: 4 additions & 0 deletions iPhoneTracking.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
00F0B7F4135A97350017896A /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 00F0B7F3135A97350017896A /* Icon.png */; };
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
256AC3DA0F4B6AC300CF3369 /* iPhoneTrackingAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* iPhoneTrackingAppDelegate.m */; };
4226580B1364DE7B007F9FAF /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4226580A1364DE7B007F9FAF /* Icon.icns */; };
59C0BD6D135A545200378314 /* readme.asciidoc in Resources */ = {isa = PBXBuildFile; fileRef = 59C0BD6C135A545200378314 /* readme.asciidoc */; };
59F0A2FF135922A600098746 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 59F0A2FE135922A500098746 /* WebKit.framework */; };
59F0A3081359237800098746 /* index.html in Resources */ = {isa = PBXBuildFile; fileRef = 59F0A3071359237800098746 /* index.html */; };
Expand All @@ -36,6 +37,7 @@
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
4226580A1364DE7B007F9FAF /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = "<group>"; };
59C0BD6C135A545200378314 /* readme.asciidoc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = readme.asciidoc; sourceTree = "<group>"; wrapsLines = 1; };
59F0A2FE135922A500098746 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
59F0A3071359237800098746 /* index.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = index.html; sourceTree = "<group>"; };
Expand Down Expand Up @@ -133,6 +135,7 @@
isa = PBXGroup;
children = (
00F0B7F3135A97350017896A /* Icon.png */,
4226580A1364DE7B007F9FAF /* Icon.icns */,
59F0A63B135A4FDB00098746 /* Credits.html */,
8D1107310486CEB800E47090 /* iPhoneTracking-Info.plist */,
59F0A3071359237800098746 /* index.html */,
Expand Down Expand Up @@ -223,6 +226,7 @@
59F0A63D135A4FDC00098746 /* Credits.html in Resources */,
59C0BD6D135A545200378314 /* readme.asciidoc in Resources */,
00F0B7F4135A97350017896A /* Icon.png in Resources */,
4226580B1364DE7B007F9FAF /* Icon.icns in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
13 changes: 6 additions & 7 deletions iPhoneTrackingAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ - (void)loadLocationDB
NSString* backupPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/MobileSync/Backup/"];

NSFileManager *fm = [NSFileManager defaultManager];
NSArray* backupContents = [[NSFileManager defaultManager] directoryContentsAtPath:backupPath];
NSArray* backupContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:backupPath error:nil];

NSMutableArray* fileInfoList = [NSMutableArray array];
for (NSString *childName in backupContents) {
Expand Down Expand Up @@ -185,16 +185,15 @@ - (BOOL)tryToLoadLocationDB:(NSString*) locationDBPath forDevice:(NSString*) dev

const float latitude = [latitude_number floatValue];
const float longitude = [longitude_number floatValue];
const float timestamp = [timestamp_number floatValue];

// The timestamps seem to be based off 2001-01-01 strangely, so convert to the
// standard Unix form using this offset
const float iOSToUnixOffset = (31*365.25*24*60*60);
const float unixTimestamp = (timestamp+iOSToUnixOffset);

if ((latitude==0.0)&&(longitude==0.0)) {
continue;
}

// The timestamps are based off 2001-01-01 because that's "NSDate" reference time,
// so convert to the standard Unix form using the offset from "NSTimeInvervalSince1970"
//const float unixTimestamp = (timestamp+NSTimeIntervalSince1970);
const float unixTimestamp = [[NSDate dateWithTimeIntervalSinceReferenceDate:[timestamp_number floatValue]] timeIntervalSince1970];

const float weekInSeconds = (7*24*60*60);
const float timeBucket = (floor(unixTimestamp/weekInSeconds)*weekInSeconds);
Expand Down
4 changes: 2 additions & 2 deletions parsembdb.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ + (NSDictionary*) getFileListForPath:(NSString*)path

char* hexArray = "0123456789abcdef";

NSNumber* filecount = getint(data, &offset, 4); // 4-byte count of records
/*NSNumber* filecount = */getint(data, &offset, 4); // 4-byte count of records
while (offset < dataLength) {
// 26 byte record, made up of ...
char* fileID_string = malloc(41);
Expand All @@ -198,7 +198,7 @@ + (NSDictionary*) getFileListForPath:(NSString*)path
offset = offset + 20;
NSNumber* mbdb_offset = getint(data, &offset, 4); // 4-byte offset field
mbdb_offset = [NSNumber numberWithInteger: ([mbdb_offset integerValue] + 6)]; // Add 6 to get past prolog
NSNumber* mode = getint(data, &offset, 2); // 2-byte mode field
/*NSNumber* mode = */getint(data, &offset, 2); // 2-byte mode field
[mbdx setObject:fileID_nsString forKey: mbdb_offset];
}

Expand Down