-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This makes it possible to include apk-mitm in a project built with webpack (like APK Lab).
- Loading branch information
1 parent
0c1d87d
commit ae998f9
Showing
3 changed files
with
13 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,8 +22,7 @@ | |
"bin": "bin/apk-mitm", | ||
"files": [ | ||
"bin", | ||
"dist", | ||
"res" | ||
"dist" | ||
], | ||
"engines": { | ||
"node": ">=10" | ||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,9 +1,19 @@ | ||
import * as fs from '../utils/fs' | ||
import * as pathUtils from 'path' | ||
|
||
const TEMPLATE_PATH = pathUtils.join(__dirname, '../../res/nsc_mitm.xml') | ||
const TEMPLATE = `<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Intentionally lax Network Security Configuration (generated by apk-mitm) --> | ||
<network-security-config> | ||
<!-- Allow cleartext traffic --> | ||
<base-config cleartextTrafficPermitted="true"> | ||
<trust-anchors> | ||
<!-- Allow user-added (proxy) certificates --> | ||
<certificates src="user" /> | ||
</trust-anchors> | ||
</base-config> | ||
</network-security-config>` | ||
|
||
export default async function createNetworkSecurityConfig(path: string) { | ||
await fs.mkdir(pathUtils.dirname(path), { recursive: true }) | ||
await fs.copyFile(TEMPLATE_PATH, path) | ||
await fs.writeFile(path, TEMPLATE, 'utf-8') | ||
} |