Skip to content

Commit

Permalink
Location Spoofer (#22)
Browse files Browse the repository at this point in the history
* Location Spoofer

* Fix build

* Change appraoch

* Try

* no message

* no message

* Tidy up swizzling

* no message

* Stash

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* Revert "no message"

This reverts commit bc9e08e.

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* Rely on super when not spoofed

* no message

* no message

* no message

* Add additional swizzle call

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* Revert

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* Try this

* no message

* no message

* no message

* no message

* Force on

* no message

* Try this

* no message

* no message

* Working location spoofer

* La casa de papel

* no message

* Update lat/long's

* First stab at routes

* Add lisbon

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* no message

* Stash

* no message

* no message

* no message

* no message

* no message

* no message

* no message
  • Loading branch information
bstillitano authored Sep 30, 2021
1 parent beede2e commit 790d03d
Show file tree
Hide file tree
Showing 23 changed files with 7,421 additions and 40 deletions.
20 changes: 11 additions & 9 deletions Scyther Playground/Scyther Playground.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
CA73FCF425D690D2007FA627 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CA73FCF225D690D2007FA627 /* LaunchScreen.storyboard */; };
CA73FCFF25D690D2007FA627 /* Scyther_PlaygroundTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA73FCFE25D690D2007FA627 /* Scyther_PlaygroundTests.swift */; };
CA73FD0A25D690D2007FA627 /* Scyther_PlaygroundUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA73FD0925D690D2007FA627 /* Scyther_PlaygroundUITests.swift */; };
CA73FDDD25DA22E8007FA627 /* Scyther in Frameworks */ = {isa = PBXBuildFile; productRef = CA73FDDC25DA22E8007FA627 /* Scyther */; };
CA9F8FC225DE08E5000FA677 /* Environments.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA9F8FC125DE08E5000FA677 /* Environments.swift */; };
CA9F8FC725DE0A88000FA677 /* RedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA9F8FC625DE0A88000FA677 /* RedViewController.swift */; };
CA9F8FCF25DE0B5F000FA677 /* BlueViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA9F8FCE25DE0B5F000FA677 /* BlueViewController.swift */; };
CA9F8FD425DE0EFF000FA677 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA9F8FD325DE0EFF000FA677 /* Button.swift */; };
CA9F8FD925DE0F6D000FA677 /* ButtonPreviews.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA9F8FD825DE0F6D000FA677 /* ButtonPreviews.swift */; };
CAA2982027029BB90020FDBB /* Scyther in Frameworks */ = {isa = PBXBuildFile; productRef = CAA2981F27029BB90020FDBB /* Scyther */; };
CABAC83926F7542000BA8CFD /* Keychain.swift in Sources */ = {isa = PBXBuildFile; fileRef = CABAC83826F7542000BA8CFD /* Keychain.swift */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -71,7 +71,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
CA73FDDD25DA22E8007FA627 /* Scyther in Frameworks */,
CAA2982027029BB90020FDBB /* Scyther in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -169,7 +169,7 @@
);
name = "Scyther Playground";
packageProductDependencies = (
CA73FDDC25DA22E8007FA627 /* Scyther */,
CAA2981F27029BB90020FDBB /* Scyther */,
);
productName = "Scyther Playground";
productReference = CA73FCE425D690D2007FA627 /* Scyther Playground.app */;
Expand Down Expand Up @@ -244,7 +244,7 @@
);
mainGroup = CA73FCDB25D690D2007FA627;
packageReferences = (
CA73FDDB25DA22E8007FA627 /* XCRemoteSwiftPackageReference "Scyther" */,
CAA2981E27029BB90020FDBB /* XCRemoteSwiftPackageReference "scyther" */,
);
productRefGroup = CA73FCE525D690D2007FA627 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -476,6 +476,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "Scyther Playground/Scyther Playground.entitlements";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = G4W688LHXL;
INFOPLIST_FILE = "Scyther Playground/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -499,6 +500,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "Scyther Playground/Scyther Playground.entitlements";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = G4W688LHXL;
INFOPLIST_FILE = "Scyther Playground/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -635,20 +637,20 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
CA73FDDB25DA22E8007FA627 /* XCRemoteSwiftPackageReference "Scyther" */ = {
CAA2981E27029BB90020FDBB /* XCRemoteSwiftPackageReference "scyther" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/bstillitano/Scyther.git";
repositoryURL = "https://github.com/bstillitano/scyther";
requirement = {
branch = "feature/keychain-browser";
branch = "feature/location-spoofer";
kind = branch;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
CA73FDDC25DA22E8007FA627 /* Scyther */ = {
CAA2981F27029BB90020FDBB /* Scyther */ = {
isa = XCSwiftPackageProductDependency;
package = CA73FDDB25DA22E8007FA627 /* XCRemoteSwiftPackageReference "Scyther" */;
package = CAA2981E27029BB90020FDBB /* XCRemoteSwiftPackageReference "scyther" */;
productName = Scyther;
};
/* End XCSwiftPackageProductDependency section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"pins": [
{
"package": "Scyther",
"repositoryURL": "https://github.com/bstillitano/Scyther.git",
"repositoryURL": "https://github.com/bstillitano/scyther",
"state": {
"branch": "feature/keychain-browser",
"revision": "9ed42a41a8ed34cff021af11c0f7131946bc6eeb",
"branch": "feature/location-spoofer",
"revision": "d4817830c368cfbdd5179938fd088b80abca6769",
"version": null
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CA73FCE325D690D2007FA627"
BuildableName = "Scyther Playground.app"
BlueprintName = "Scyther Playground"
ReferencedContainer = "container:Scyther Playground.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CA73FCF925D690D2007FA627"
BuildableName = "Scyther PlaygroundTests.xctest"
BlueprintName = "Scyther PlaygroundTests"
ReferencedContainer = "container:Scyther Playground.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CA73FD0425D690D2007FA627"
BuildableName = "Scyther PlaygroundUITests.xctest"
BlueprintName = "Scyther PlaygroundUITests"
ReferencedContainer = "container:Scyther Playground.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CA73FCE325D690D2007FA627"
BuildableName = "Scyther Playground.app"
BlueprintName = "Scyther Playground"
ReferencedContainer = "container:Scyther Playground.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CA73FCE325D690D2007FA627"
BuildableName = "Scyther Playground.app"
BlueprintName = "Scyther Playground"
ReferencedContainer = "container:Scyther Playground.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
1 change: 1 addition & 0 deletions Scyther Playground/Scyther Playground/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Created by Brandon Stillitano on 12/2/21.
//

import CoreLocation
import Scyther
import UIKit
import UserNotifications
Expand Down
5 changes: 5 additions & 0 deletions Scyther Playground/Scyther Playground/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>We need your location to spoof it.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>We need your location to spoof it.</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
Expand All @@ -43,6 +47,7 @@
<true/>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
Expand Down
30 changes: 29 additions & 1 deletion Scyther Playground/Scyther Playground/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
// Created by Brandon Stillitano on 12/2/21.
//

import MapKit
import Security
import Scyther
import UIKit

class ViewController: UIViewController {
class ViewController: UIViewController, MKMapViewDelegate
{
// MARK: - Data
private let locationManager: CLLocationManager = CLLocationManager()

// MARK: - UI Elements
var tableView: UITableView = UITableView()
var mapView: MKMapView = MKMapView()

override func viewDidLoad() {
super.viewDidLoad()
Expand All @@ -29,13 +35,28 @@ class ViewController: UIViewController {
tableView.dataSource = self
tableView.rowHeight = UITableView.automaticDimension
self.view.addSubview(tableView)

//Setup MapView
locationManager.delegate = self
locationManager.allowsBackgroundLocationUpdates = true
locationManager.requestAlwaysAuthorization()
mapView.delegate = self
mapView.showsUserLocation = true
mapView.setUserTrackingMode(.follow, animated: true)
self.view.addSubview(mapView)
}

func setupConstraints() {
//Setup Table View Constraints
tableView.snp.makeConstraints { (make) in
make.edges.equalToSuperview()
}

//Setup MapView Constraints
mapView.snp.makeConstraints { (make) in
make.center.equalToSuperview()
make.width.height.equalTo(350)
}
}
}

Expand Down Expand Up @@ -211,3 +232,10 @@ extension ViewController {
Scyther.instance.developerOptions.append(blueOption)
}
}

extension ViewController: CLLocationManagerDelegate {
func mapView(_ mapView: MKMapView, didUpdate userLocation: MKUserLocation) {
let region = MKCoordinateRegion.init(center: userLocation.coordinate, span: MKCoordinateSpan.init(latitudeDelta: 0.01, longitudeDelta: 0.01))
mapView.setRegion(region, animated: true)
}
}
2 changes: 1 addition & 1 deletion Sources/Scyther/Extensions/String+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public extension String {
let json = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [String: Any]
return json
} catch {
print("Something went wrong")
logMessage("Something went wrong")
}
}
return nil
Expand Down
27 changes: 27 additions & 0 deletions Sources/Scyther/Extensions/Swizzle.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// File.swift
//
//
// Created by Brandon Stillitano on 27/9/21.
//

import Foundation

internal let swizzle: (AnyClass, Selector, Selector) -> () = { forClass, originalSelector, swizzledSelector in
if let originalMethod = class_getInstanceMethod(forClass, originalSelector),
let swizzledMethod = class_getInstanceMethod(forClass, swizzledSelector) {
method_exchangeImplementations(originalMethod, swizzledMethod)
}
}

internal let unswizzle: (AnyClass, Selector, Selector) -> () = { forClass, originalSelector, swizzledSelector in
guard let originalMethod = class_getInstanceMethod(forClass, originalSelector),
let swizzledMethod = class_getInstanceMethod(forClass, swizzledSelector) else {
return
}
if class_addMethod(forClass, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(swizzledMethod)) {
class_replaceMethod(forClass, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod))
} else {
method_exchangeImplementations(swizzledMethod, originalMethod)
}
}
Loading

0 comments on commit 790d03d

Please sign in to comment.