mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-11 09:24:58 +00:00
fix
This commit is contained in:
parent
054dcb27f8
commit
67aef58246
3
app.js
3
app.js
|
@ -146,9 +146,10 @@ function require(FN) {
|
|||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// get configuration variables
|
||||
// get global variables
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var __global = {};
|
||||
var __config = require("config").config;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -3,8 +3,8 @@ var global = {};
|
|||
var FILE = require("lib/file");
|
||||
var SSLoader = require("ssloader");
|
||||
|
||||
global.processNames = [];
|
||||
global.serverNames = [];
|
||||
__global.processNames = [];
|
||||
__global.serverNames = [];
|
||||
|
||||
var loginSuccess = function(res) {
|
||||
// 성공하면 아이디 표시
|
||||
|
@ -22,7 +22,7 @@ var loginSuccess = function(res) {
|
|||
for (var i in res.processes) {
|
||||
var row = res.processes[i];
|
||||
$userProcesses.append('<li class="show-logged remove-when-logout"><span><img src="app/assets/img/gear-2-16.png" alt="Process" /> ' + row.processname + '</span></li>');
|
||||
global.processNames.push(row.processname);
|
||||
__global.processNames.push(row.processname);
|
||||
}
|
||||
|
||||
// 사용자 서버 조회
|
||||
|
@ -30,7 +30,7 @@ var loginSuccess = function(res) {
|
|||
for (var i in res.serverusers) {
|
||||
var row = res.serverusers[i];
|
||||
$userServers.append('<li class="show-logged remove-when-logout"><span><img src="app/assets/img/server-16.png" alt="Server" /> ' + row.servername + '</span></li>');
|
||||
global.serverNames.push(row.servername);
|
||||
__global.serverNames.push(row.servername);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
11
build.bat
11
build.bat
|
@ -13,14 +13,18 @@ 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 complie shadow-may.19.2020-modified
|
||||
pushd %CD%\packages\shadow-may.19.2020-modified
|
||||
windres -o main.syso main.rc
|
||||
go build
|
||||
copy %CD%\shadow.exe %BINPATH%\shadow.exe
|
||||
popd
|
||||
|
||||
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%\
|
||||
|
@ -28,6 +32,5 @@ 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
|
||||
|
|
41
config.json
41
config.json
|
@ -1,21 +1,36 @@
|
|||
{
|
||||
"Server": [
|
||||
"socks://localhost:61654"
|
||||
],
|
||||
{
|
||||
"Server": "socks://localhost:1080",
|
||||
"NameServer": "https://1.1.1.1/dns-query",
|
||||
"FilterString": "outbound and (ip ? ip.DstAddr != 1.1.1.1 : true)",
|
||||
"TunName": "TAP-Windows Adapter V9",
|
||||
"TunAddr": [
|
||||
"192.168.0.11/24"
|
||||
],
|
||||
"IPCIDRRules": {
|
||||
"Proxy": [
|
||||
"198.18.0.0/16",
|
||||
"8.8.8.8/32"
|
||||
"IPRules": {
|
||||
"Mode": true,
|
||||
"IPCIDR": [
|
||||
"44.44.0.0/16",
|
||||
"1.1.1.1",
|
||||
"1.0.0.1",
|
||||
"8.8.8.8",
|
||||
"8.8.4.4",
|
||||
"2001:4860:4860::8888",
|
||||
"2001:4860:4860::8844",
|
||||
"2001:4860:4860::/64",
|
||||
"91.108.4.0/22",
|
||||
"91.108.8.0/22",
|
||||
"91.108.12.0/22",
|
||||
"91.108.20.0/22",
|
||||
"91.108.36.0/23",
|
||||
"91.108.38.0/23",
|
||||
"91.108.56.0/22",
|
||||
"149.154.160.0/20",
|
||||
"149.154.164.0/22",
|
||||
"149.154.172.0/22"
|
||||
]
|
||||
},
|
||||
"AppRules": {
|
||||
"Proxy": []
|
||||
"Mode": true,
|
||||
"Programs": [
|
||||
"chrome.exe",
|
||||
"nx.exe"
|
||||
]
|
||||
},
|
||||
"DomainRules": {
|
||||
"Proxy": [
|
||||
|
|
18
lib/file.js
18
lib/file.js
|
@ -87,7 +87,19 @@ exports.readFile = function(FN, charset) {
|
|||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.writeFile = function(FN, content, charset) {
|
||||
var Stream_No_UTF8_BOM = function(objStream) {
|
||||
var _objStream = CreateObject("ADODB.Stream");
|
||||
_objStream.Type = 1;
|
||||
_objStream.Mode = 3;
|
||||
_objStream.Open();
|
||||
objStream.Position = 3;
|
||||
objStream.CopyTo(_objStream);
|
||||
objStream.Flush();
|
||||
objStream.Close();
|
||||
return _objStream;
|
||||
};
|
||||
var ok;
|
||||
|
||||
if (charset) {
|
||||
console.log("WRITE TO DISK USING ADODB.Stream CHARSET " + charset);
|
||||
try {
|
||||
|
@ -96,7 +108,11 @@ exports.writeFile = function(FN, content, charset) {
|
|||
fsT.Charset = charset; // Specify charset For the source text data.
|
||||
fsT.Open();
|
||||
fsT.WriteText(content);
|
||||
fsT.SaveToFile(FN, 2); // save as binary to disk
|
||||
if (charset == "utf-8") {
|
||||
Stream_No_UTF8_BOM(fsT).SaveToFile(FN, 2); // save as binary to disk
|
||||
} else {
|
||||
fsT.SaveToFile(FN, 2); // save as binary to disk
|
||||
}
|
||||
ok = true;
|
||||
} catch (e) {
|
||||
console.log("ADODB.Stream: ERROR! " + e.number + ", " + e.description + ", FN=" + FN);
|
||||
|
|
|
@ -39,6 +39,5 @@ exports.execCommand = function(cmd) {
|
|||
};
|
||||
|
||||
exports.runAs = function(cmd) {
|
||||
return PS.execCommand("Start-Process cmd \"/q /k " + cmd + "\" -Verb RunAs");
|
||||
return exports.execCommand("Start-Process cmd \"/q /c " + SHELL.addslashes(SHELL.makeCmdLine(cmd)) + "\" -Verb RunAs");
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ exports.getRandomInt = function(min, max) {
|
|||
};
|
||||
|
||||
exports.connect = function() {
|
||||
var listenPort = exports.getRandomInt(49152, 65535);
|
||||
var listenPort = 1080;
|
||||
//var listenPort = exports.getRandomInt(49152, 65535);
|
||||
|
||||
SHELL.run([
|
||||
exports.binPath,
|
||||
|
|
33
ssloader.js
33
ssloader.js
|
@ -6,23 +6,19 @@ var SS = require("lib/shadowsocks");
|
|||
var WINTAP = require("lib/wintap");
|
||||
var SYS = require("lib/system");
|
||||
var FILE = require("lib/file");
|
||||
var SHELL = require("lib/shell");
|
||||
|
||||
var ssConfig = {
|
||||
Server: [],
|
||||
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"
|
||||
]
|
||||
IPRules: {
|
||||
Mode: false,
|
||||
IPCIDR: []
|
||||
},
|
||||
AppRules: {
|
||||
Proxy: []
|
||||
Mode: true,
|
||||
Programs: []
|
||||
},
|
||||
DomainRules: {
|
||||
Proxy: [
|
||||
|
@ -50,7 +46,7 @@ exports.main = function() {
|
|||
// 내부 포트 결정
|
||||
console.log("* Connecting to socket proxy...");
|
||||
var listenPort = SS.connect();
|
||||
ssConfig.Server.push("socks://localhost:" + listenPort);
|
||||
ssConfig.Server = "socks://localhost:" + listenPort;
|
||||
console.log("* Local listening port: " + listenPort);
|
||||
|
||||
// 네트워크 인터페이스 정보 조회
|
||||
|
@ -63,12 +59,12 @@ exports.main = function() {
|
|||
// TAP 설치 여부 조회
|
||||
console.log("* Gethering WindowsTAP interfaces...");
|
||||
console.log(WINTAP.query("tap0901"));
|
||||
ssConfig.TunName = "TAP-Windows Adapter V9";
|
||||
//ssConfig.TunName = "TAP-Windows Adapter V9";
|
||||
|
||||
// 앱 규칙 설정
|
||||
var processNames = global.processNames;
|
||||
var processNames = __global.processNames;
|
||||
for (var i in processNames) {
|
||||
ssConfig.AppRules.Proxy.push(processNames[i]);
|
||||
ssConfig.AppRules.Programs.push(processNames[i]);
|
||||
}
|
||||
|
||||
// 설정 파일 저장
|
||||
|
@ -80,7 +76,12 @@ exports.main = function() {
|
|||
console.info("설정 파일 저장 완료!");
|
||||
|
||||
// 앱 프록시 실행
|
||||
console.info("앱 프록시는 관리자 권한을 필요로 합니다. 확인을 눌러주세요.");
|
||||
console.info("앱 프록시는 관리자 권한을 필요로 합니다. 확인을 눌러주세요.");
|
||||
SHELL.run([
|
||||
"bin/shadow.exe",
|
||||
"-c",
|
||||
"config.json"
|
||||
]);
|
||||
};
|
||||
|
||||
exports.ssConfig = ssConfig;
|
||||
|
|
Loading…
Reference in New Issue
Block a user