This repository has been archived by the owner on Aug 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 添加了安装软件包的选项 - 完善了 ldrestart
- Loading branch information
Lakr Aream
committed
May 15, 2020
1 parent
52f395e
commit a0bf218
Showing
3 changed files
with
49 additions
and
3 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -3,6 +3,8 @@ import { join } from 'path'; | |
import { LKutils } from './Utils'; | ||
import { iDevices } from './iDevices'; | ||
import { iDeviceItem, iDeviceNodeProvider } from './iDeviceConnections'; | ||
import { writeFileSync } from 'fs'; | ||
import { url } from 'inspector'; | ||
|
||
|
||
export class ToolItem extends vscode.TreeItem { | ||
|
@@ -27,6 +29,8 @@ export class ToolItem extends vscode.TreeItem { | |
return vscode.Uri.file(join(__filename,'..', '..' ,'res' ,'kill.svg')); | ||
} else if (name === "Add iProxy") { | ||
return vscode.Uri.file(join(__filename,'..', '..' ,'res' ,'connect.svg')); | ||
} else if (name === "Install deb") { | ||
return vscode.Uri.file(join(__filename,'..', '..' ,'res' ,'package.svg')); | ||
} else { | ||
return vscode.Uri.file(join(__filename,'..', '..' ,'res' ,'ios.svg')); | ||
} | ||
|
@@ -45,7 +49,7 @@ export class ToolItem extends vscode.TreeItem { | |
|
||
export class ToolboxNodeProvider implements vscode.TreeDataProvider<ToolItem> { | ||
|
||
public static tools = ["Copy UDID", "Copy ECID", "sbreload", "ldrestart", "Safemode", "Shutdown iProxy", "Add iProxy"]; | ||
public static tools = ["Copy UDID", "Copy ECID", "Install deb", "sbreload", "ldrestart", "Safemode", "Shutdown iProxy", "Add iProxy"]; | ||
public static nodeProvider: ToolboxNodeProvider; | ||
|
||
public static init() { | ||
|
@@ -70,14 +74,55 @@ export class ToolboxNodeProvider implements vscode.TreeDataProvider<ToolItem> { | |
vscode.env.clipboard.writeText(vdev?.ecid); | ||
return; | ||
} | ||
if (toolObject.label === "Install deb") { | ||
const options: vscode.OpenDialogOptions = { | ||
canSelectMany: false, | ||
canSelectFolders: false, | ||
canSelectFiles: true, | ||
openLabel: 'deb pls', | ||
filters: { | ||
'DEBIAN Package': ['deb'] | ||
} | ||
}; | ||
vscode.window.showOpenDialog(options).then((uri) => { | ||
if (uri === undefined || uri === null) { | ||
return; | ||
} | ||
let selection = iDevices.shared.getDevice() as iDeviceItem; | ||
iDeviceNodeProvider.nodeProvider.ensureiProxy(selection); | ||
let terminal = vscode.window.createTerminal("Install DEB"); | ||
terminal.show(); | ||
let passpath = LKutils.shared.storagePath + "/" + LKutils.shared.makeid(10); | ||
writeFileSync(passpath, selection.iSSH_password); | ||
terminal.show(); | ||
let script = "#!/bin/bash\n"; | ||
let items = []; | ||
items.push(" export SSHPASSWORD=$(cat \'" + passpath + "\')"); | ||
items.push(" rm -f \'" + passpath + "\'"); | ||
items.push(" ssh-keygen -R \"[127.0.0.1]:" + selection.iSSH_mappedPort + "\" &> /dev/null"); | ||
items.push(" sshpass -p $SSHPASSWORD ssh -oStrictHostKeyChecking=no -p " + selection.iSSH_mappedPort + " [email protected] \'rm -rf /var/mobile/Media/DEBIAN && mkdir -p /var/mobile/Media/DEBIAN\'"); | ||
uri.forEach((sel) => { | ||
items.push(" sshpass -p $SSHPASSWORD scp -oStrictHostKeyChecking=no -r -P" + selection.iSSH_mappedPort + " \"" + sel.path + "\" \"[email protected]:/var/mobile/Media/DEBIAN\""); | ||
}); | ||
items.push(" sshpass -p $SSHPASSWORD ssh -oStrictHostKeyChecking=no -p " + selection.iSSH_mappedPort + " [email protected] \'dpkg -i /var/mobile/Media/DEBIAN/*.deb\'"); | ||
items.forEach((line) => { | ||
script += line + "\n"; | ||
}); | ||
let scriptpath = LKutils.shared.storagePath + "/" + LKutils.shared.makeid(10); | ||
writeFileSync(scriptpath, script); | ||
terminal.sendText(" chmod +x \"" + scriptpath + "\""); | ||
terminal.sendText(" \"" + scriptpath + "\""); | ||
}); | ||
return; | ||
} | ||
if (toolObject.label === "sbreload") { | ||
iDeviceNodeProvider.nodeProvider.ensureiProxy(vdev); | ||
iDevices.shared.executeOnDevice("sbreload"); | ||
return; | ||
} | ||
if (toolObject.label === "ldrestart") { | ||
iDeviceNodeProvider.nodeProvider.ensureiProxy(vdev); | ||
iDevices.shared.executeOnDevice("ldrestart &"); | ||
iDevices.shared.executeOnDevice("( ldrestart & )"); | ||
return; | ||
} | ||
if (toolObject.label === "Safemode") { | ||
|