-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement packet capture client and models
- Loading branch information
1 parent
9c8c76f
commit 89e9074
Showing
10 changed files
with
380 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// SafariApp.swift | ||
// MullvadVPNUITests | ||
// | ||
// Created by Niklas Berglund on 2024-05-31. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
|
||
class SafariApp { | ||
let app = XCUIApplication(bundleIdentifier: "com.apple.mobilesafari") | ||
|
||
func launch() { | ||
app.launch() | ||
} | ||
|
||
@discardableResult func tapAddressBar() -> Self { | ||
app.textFields.firstMatch.tap() | ||
return self | ||
} | ||
|
||
@discardableResult func enterText(_ text: String) -> Self { | ||
app.typeText(text) | ||
return self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// LeakTests.swift | ||
// MullvadVPNUITests | ||
// | ||
// Created by Niklas Berglund on 2024-05-31. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
|
||
class LeakTests: LoggedInWithTimeUITestCase { | ||
/// For now just the skeleton of a leak test - traffic is captured and parsed, but not analyzed | ||
func testLeaks() throws { | ||
startPacketCapture() | ||
|
||
TunnelControlPage(app) | ||
.tapSecureConnectionButton() | ||
|
||
allowAddVPNConfigurationsIfAsked() | ||
|
||
TunnelControlPage(app) | ||
.waitForSecureConnectionLabel() | ||
|
||
// Trigger traffic by navigating to website in Safari | ||
let safariApp = SafariApp() | ||
safariApp.launch() | ||
safariApp.tapAddressBar() | ||
safariApp.enterText("mullvad.net\n") | ||
|
||
app.launch() | ||
TunnelControlPage(app) | ||
.tapDisconnectButton() | ||
|
||
// Keep the capture open for a while | ||
Thread.sleep(forTimeInterval: 5.0) | ||
let capturedTraffic = stopPacketCapture() | ||
|
||
// Analyze captured traffic | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.