[GH-ISSUE #1] Research Swizzle with InterposeKit #1

Open
opened 2026-03-03 19:10:50 +03:00 by kerem · 2 comments
Owner

Originally created by @NghiaTranUIT on GitHub (Oct 22, 2020).
Original GitHub issue: https://github.com/ProxymanApp/atlantis/issues/1

Originally assigned to: @NghiaTranUIT on GitHub.

Description

InterposeKit is a modern framework that provides better swizzle functions. It's crucial for atlantis since we have to swizzle the original methods from NSURLConnection or NSURLSession in order to capture the request/response on the fly.

Acceptance Criteria

  • Research InterposeKit and integrate to the app
  • Write the first example to capture HTTP traffic from the example app
Originally created by @NghiaTranUIT on GitHub (Oct 22, 2020). Original GitHub issue: https://github.com/ProxymanApp/atlantis/issues/1 Originally assigned to: @NghiaTranUIT on GitHub. ### Description InterposeKit is a modern framework that provides better swizzle functions. It's crucial for **atlantis** since we have to swizzle the original methods from NSURLConnection or NSURLSession in order to capture the request/response on the fly. ### Acceptance Criteria - Research InterposeKit and integrate to the app - Write the first example to capture HTTP traffic from the example app
Author
Owner

@NghiaTranUIT commented on GitHub (Oct 22, 2020):

Swizzle works fine:

class Person: NSObject {

    let name: String

    init(name: String) {
        self.name = name
    }

    @objc dynamic func sayHi() {
        print("Hi: \(name)")
    }
}

class ViewController: UIViewController {

    private var interposer: Interpose!
    override func viewDidLoad() {
        super.viewDidLoad()
        do {
            interposer = try Interpose(Person.self) {
                try $0.hook(
                    #selector(Person.sayHi),
                    methodSignature: (@convention(c) (AnyObject, Selector) -> Void).self,
                    hookSignature: (@convention(block) (AnyObject) -> Void).self) {
                        store in { `self` in
                            print("Hi: Nghia v2")
                        }
                }
            }

            let person = Person(name: "Nghia Tran")
            person.sayHi()

        } catch let error {
            print(error)
        }
    }
}

<!-- gh-comment-id:714366909 --> @NghiaTranUIT commented on GitHub (Oct 22, 2020): Swizzle works fine: ```swift class Person: NSObject { let name: String init(name: String) { self.name = name } @objc dynamic func sayHi() { print("Hi: \(name)") } } class ViewController: UIViewController { private var interposer: Interpose! override func viewDidLoad() { super.viewDidLoad() do { interposer = try Interpose(Person.self) { try $0.hook( #selector(Person.sayHi), methodSignature: (@convention(c) (AnyObject, Selector) -> Void).self, hookSignature: (@convention(block) (AnyObject) -> Void).self) { store in { `self` in print("Hi: Nghia v2") } } } let person = Person(name: "Nghia Tran") person.sayHi() } catch let error { print(error) } } } ```
Author
Owner

@NghiaTranUIT commented on GitHub (Oct 25, 2020):

We decide not to use InterposeKit since it's too complicated.

<!-- gh-comment-id:716104044 --> @NghiaTranUIT commented on GitHub (Oct 25, 2020): We decide not to use InterposeKit since it's too complicated.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/atlantis#1
No description provided.