mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
fix
fix
This commit is contained in:
parent
ad2d3fc9b7
commit
5e44bd11e7
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -57,7 +57,7 @@ typings/
|
|||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
.rts2_cache_umd/package
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
@ -105,3 +105,4 @@ dist
|
|||
|
||||
# Custom directories and files
|
||||
bin/
|
||||
packages/
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
|
33
build.bat
Normal file
33
build.bat
Normal file
|
@ -0,0 +1,33 @@
|
|||
@echo off
|
||||
|
||||
REM set required build-tools
|
||||
set PATH=%WINDIR%\System32
|
||||
set PATH=%PATH%;%CD%\packages\go1.14.6.windows-amd64\go\bin
|
||||
set PATH=%PATH%;%CD%\packages\git-2.28.0-64-bit\bin
|
||||
set PATH=%PATH%;%CD%\packages\winlibs-x86_64-posix-seh-gcc-10.2.0-llvm-10.0.0-mingw-w64-7.0.0-r2\mingw64\bin
|
||||
set GOPATH=%CD%\packages\build\go
|
||||
|
||||
REM check a PATH variable
|
||||
echo %PATH%
|
||||
|
||||
REM check a GOPATH variable
|
||||
echo %GOPATH%
|
||||
|
||||
REM build a WinDivert handler
|
||||
go get -v -ldflags="-s -w" -trimpath -tags=wintun github.com/gnh1201/shadow/executive/shadow
|
||||
|
||||
REM set destination folder
|
||||
set BINPATH=%CD%\bin
|
||||
rmdir %BINPATH% /s /q
|
||||
mkdir %BINPATH%
|
||||
|
||||
REM copy required files
|
||||
copy %CD%\packages\shadowsocks-libev-mingw-x86_64\ss-local.exe %BINPATH%\ss-local.exe
|
||||
copy %CD%\packages\shadowsocks-libev-mingw-x86_64\*.dll %BINPATH%\
|
||||
copy %CD%\packages\WinDivert-2.2.0-A\x64\WinDivert.dll %BINPATH%\WinDivert.dll
|
||||
copy %CD%\packages\WinDivert-2.2.0-A\x64\WinDivert64.sys %BINPATH%\WinDivert64.sys
|
||||
copy %CD%\packages\tun2socks-windows-4.0-amd64.exe %BINPATH%\tun2socks.exe
|
||||
copy %CD%\packages\tap-windows-9.24.2-I601-Win10.exe %BINPATH%\tap-windows-9.24.2-I601-Win10.exe
|
||||
copy %GOPATH%\bin\shadow.exe %BINPATH%\shadow.exe
|
||||
|
||||
echo done
|
|
@ -8,13 +8,7 @@ var SYS = require("lib/system");
|
|||
exports.VERSIONINFO = "Shadowsocks Lib (shadowsocks.js) version 0.1";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
||||
var arch = SYS.getArch();
|
||||
if(arch.indexOf("64") > -1) {
|
||||
exports.binPath = "bin/shadowsocks-libev-mingw-x86_64/ss-local.exe";
|
||||
} else {
|
||||
exports.binPath = "bin/shadowsocks-libev-mingw-x86/ss-local.exe";
|
||||
}
|
||||
exports.binPath = "bin/ss-local.exe";
|
||||
|
||||
exports.getRandomInt = function(min, max) {
|
||||
var x = Math.random();
|
||||
|
|
|
@ -124,25 +124,21 @@ exports.getNetworkInterfaces = function() {
|
|||
var wbemFlagForwardOnly = 0x20;
|
||||
var rows = [];
|
||||
|
||||
try {
|
||||
var colItems = WMI.ExecQuery(
|
||||
"SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True",
|
||||
"WQL",
|
||||
wbemFlagReturnImmediately | wbemFlagForwardOnly
|
||||
);
|
||||
var colItems = WMI.ExecQuery(
|
||||
"SELECT * FROM Win32_NetworkAdapterConfiguration",
|
||||
"WQL",
|
||||
wbemFlagReturnImmediately | wbemFlagForwardOnly
|
||||
);
|
||||
|
||||
var enumItems = new Enumerator(colItems);
|
||||
for (; !enumItems.atEnd(); enumItems.moveNext()) {
|
||||
var objItem = enumItems.item();
|
||||
try {
|
||||
rows.push({
|
||||
Caption: objItem.Caption,
|
||||
IPAddress: objItem.IPAddress.toArray().join(','),
|
||||
MACAddress: objItem.MACAddress
|
||||
});
|
||||
} catch(e) {}
|
||||
}
|
||||
} catch(e) {}
|
||||
var enumItems = new Enumerator(colItems);
|
||||
for (; !enumItems.atEnd(); enumItems.moveNext()) {
|
||||
var objItem = enumItems.item();
|
||||
rows.push({
|
||||
Caption: (objItem.Caption || ""),
|
||||
IPAddress: (objItem.IPAddress || []).join(','),
|
||||
MACAddress: (objItem.MACAddress || "")
|
||||
});
|
||||
}
|
||||
|
||||
return rows;
|
||||
};
|
||||
|
|
|
@ -8,14 +8,7 @@ var SYS = require("lib/system");
|
|||
exports.VERSIONINFO = "TUN2SOCKS Lib (tun2socks.js) version 0.1";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
||||
var arch = SYS.getArch();
|
||||
|
||||
if(arch.indexOf("64")) {
|
||||
exports.binPath = "bin/tun2socks-windows-4.0-amd64.exe";
|
||||
} else {
|
||||
exports.binPath = "bin/tun2socks-windows-4.0-386.exe";
|
||||
}
|
||||
exports.binPath = "bin/tun2socks.exe";
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
|
|
|
@ -10,8 +10,6 @@ exports.VERSIONINFO = "WindowsTAP Lib (wintap.js) version 0.1";
|
|||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
||||
var arch = SYS.getArch();
|
||||
|
||||
exports.infPath = SYS.getEnvString("PROGRAMFILES") + "/TAP-Windows/driver/OemVista.inf";
|
||||
exports.binPath = SYS.getEnvString("PROGRAMFILES") + "/TAP-Windows/bin/tapinstall.exe";
|
||||
|
||||
|
|
66
ssloader.js
66
ssloader.js
|
@ -6,27 +6,63 @@ var SS = require("lib/shadowsocks");
|
|||
var WINTAP = require("lib/wintap");
|
||||
var SYS = require("lib/system");
|
||||
var HOSTS = require("lib/hosts");
|
||||
var JSON = require("lib/json");
|
||||
|
||||
var ssConfig = {
|
||||
Server: [],
|
||||
NameServer: "https://1.1.1.1/dns-query",
|
||||
FilterString: "outbound and (ip ? ip.DstAddr != 1.1.1.1 : true)",
|
||||
TunName: "",
|
||||
TunAddr: [
|
||||
"192.168.0.11/24"
|
||||
],
|
||||
IPCIDRRules: {
|
||||
Proxy: [
|
||||
"198.18.0.0/16",
|
||||
"8.8.8.8/32"
|
||||
]
|
||||
},
|
||||
AppRules: {
|
||||
Proxy: []
|
||||
},
|
||||
DomainRules: {
|
||||
Proxy: [
|
||||
"**.google.com",
|
||||
"**.google.*",
|
||||
"**.google.*.*",
|
||||
"**.youtube.com",
|
||||
"*.twitter.com",
|
||||
"www.facebook.com",
|
||||
"bing.com",
|
||||
"**.amazon.*"
|
||||
],
|
||||
Direct: [
|
||||
"**.baidu.*",
|
||||
"**.youku.*",
|
||||
"**.*"
|
||||
],
|
||||
Blocked: [
|
||||
"ad.blocked.com"
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
exports.main = function() {
|
||||
console.log("Connecting to shadowsocks...");
|
||||
console.log("* Connecting to shadowsocks...");
|
||||
var listenPort = SS.connect();
|
||||
console.log("Local listening port: " + listenPort);
|
||||
ssConfig.Server.push("socks://localhost:" + listenPort);
|
||||
console.log("* Local listening port: " + listenPort);
|
||||
|
||||
console.log("Gethering network interfaces...");
|
||||
console.log("* Gethering network interfaces...");
|
||||
var inets = SYS.getNetworkInterfaces();
|
||||
for (var i in inets) {
|
||||
console.log("Caption > " + inets[i].Caption);
|
||||
console.log(" > IPAddress > " + inets[i].IPAddress);
|
||||
console.log(" > MACAddress > " + inets[i].MACAddress);
|
||||
for (var i = 0; i < inets.length; i++) {
|
||||
console.log(" > " + inets[i].Caption);
|
||||
}
|
||||
|
||||
console.log("Gethering hosts...");
|
||||
var hosts = HOSTS.getHosts();
|
||||
for (var i = 0; i < hosts.length; i++) {
|
||||
console.log(hosts[i].domain + " -> " + hosts[i].host);
|
||||
}
|
||||
|
||||
console.log("Gethering WindowsTAP interfaces...");
|
||||
console.log("* Gethering WindowsTAP interfaces...");
|
||||
console.log(WINTAP.query("tap0901"));
|
||||
console.log("Done");
|
||||
ssConfig.TunName = "TAP-Windows Adapter V9";
|
||||
|
||||
console.log(JSON.stringify(ssConfig));
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user