Update wintap.js and relative files

This commit is contained in:
Namhyeon Go 2020-07-29 12:06:49 +09:00
parent 557e3d7f77
commit e6f24e40d3
4 changed files with 42 additions and 12 deletions

View File

@ -22,8 +22,10 @@ exports.getRandomInt = function(min, max) {
}; };
exports.connect = function() { exports.connect = function() {
var port = exports.getRandomInt(49152, 65535); return;
var port = exports.getRandomInt(49152, 65535);
SHELL.run([ SHELL.run([
exports.binPath, exports.binPath,
"-s", "-s",

View File

@ -35,11 +35,11 @@ exports.createProcess = function(cmd) {
}; };
exports.getEnvString = function(path) { exports.getEnvString = function(path) {
return WSH.ExpandEnvironmentStrings(path); return WSH.ExpandEnvironmentStrings('%' + path + '%');
}; };
exports.get32BitFolder = function() { exports.get32BitFolder = function() {
var base = exports.getEnvString("%WINDIR%"); var base = exports.getEnvString("WINDIR");
var syswow64 = base + "\\SysWOW64\\"; var syswow64 = base + "\\SysWOW64\\";
if (JPTUDBSTOW.FS.FolderExists(syswow64)) if (JPTUDBSTOW.FS.FolderExists(syswow64))

View File

@ -4,30 +4,42 @@
var SHELL = require("lib/shell"); var SHELL = require("lib/shell");
var SYS = require("lib/system"); var SYS = require("lib/system");
var FILE = require("lib/file");
exports.VERSIONINFO = "WindowsTAP Lib (wintap.js) version 0.1"; exports.VERSIONINFO = "WindowsTAP Lib (wintap.js) version 0.1";
exports.global = global; exports.global = global;
exports.require = global.require; exports.require = global.require;
var arch = SYS.getArch(); var arch = SYS.getArch();
if(arch.indexOf("64") > -1) {
exports.binPath = "bin/tap-windows-9.24.2/amd64/tapinstall.exe";
} else {
exports.binPath = "bin/tap-windows-9.24.2/i386/tapinstall.exe";
}
exports.install = function(inf, id) { exports.infPath = SYS.getEnvString("PROGRAMFILES") + "/TAP-Windows/driver/OemVista.inf";
return SHELL.exec([exports.binPath, "install", inf, id]); exports.binPath = SYS.getEnvString("PROGRAMFILES") + "/TAP-Windows/bin/tapinstall.exe";
exports.before = function() {
if(!FILE.fileExists(exports.binPath)) {
console.log("WindowsTAP dose not installed. Trying to install...");
return SHELL.exec(["bin/tap-windows-9.24.2-I601-Win7.exe"]);
} else {
return true;
}
}; };
exports.update = function(inf, id) { exports.install = function(id) {
return SHELL.exec([exports.binPath, "update", inf, id]); exports.before();
return SHELL.exec([exports.binPath, "install", exports.infPath, id]);
};
exports.update = function(id) {
exports.before();
return SHELL.exec([exports.binPath, "update", exports.infPath, id]);
}; };
exports.query = function(id) { exports.query = function(id) {
exports.before();
return SHELL.exec([exports.binPath, "hwids", id]); return SHELL.exec([exports.binPath, "hwids", id]);
}; };
exports.remove = function(id) { exports.remove = function(id) {
exports.before();
return SHELL.exec([exports.binPath, "remove", id]); return SHELL.exec([exports.binPath, "remove", id]);
}; };

16
ssloader.js Normal file
View File

@ -0,0 +1,16 @@
////////////////////////////////////////////////////////////////////////
// Socksloader
////////////////////////////////////////////////////////////////////////
var SS = require("lib/shadowsocks");
var WINTAP = require("lib/wintap");
exports.main = function() {
console.log("Connecting to shadowsocks...");
var proxyport = SS.connect();
console.log(proxyport);
console.log("Installing new WindowsTAP...");
console.log(WINTAP.query("tap0901"));
console.log("Done");
};