diff --git a/app/index.js b/app/index.js index 02a4366..107afa9 100644 --- a/app/index.js +++ b/app/index.js @@ -18,6 +18,7 @@ var loginSuccess = function(res) { token: token }, function(res) { // 사용자 프로세스 조회 + __global.processNames = []; var $userProcesses = $("#userProcesses"); for (var i in res.processes) { var row = res.processes[i]; @@ -26,6 +27,7 @@ var loginSuccess = function(res) { } // 사용자 서버 조회 + __global.serverNames = []; var $userServers = $("#userServers"); for (var i in res.serverusers) { var row = res.serverusers[i]; diff --git a/assignProxy.bat b/assignProxy.bat new file mode 100644 index 0000000..3f96257 --- /dev/null +++ b/assignProxy.bat @@ -0,0 +1,2 @@ +@echo off +bin\shadow.exe -c config.json & diff --git a/build.bat b/build.bat index 1e5bc2b..1f890a7 100644 --- a/build.bat +++ b/build.bat @@ -19,18 +19,21 @@ 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 pushd %CD%\packages\shadow-may.19.2020-modified +REM windres -o main.syso main.rc +REM go build +REM copy %CD%\shadow.exe %BINPATH%\shadow.exe +REM popd + +go get -v -ldflags="-s -w" -trimpath github.com/imgk/shadow/executive/shadow 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 +REM copy %CD%\packages\tun2socks-windows-4.0-amd64.exe %BINPATH%\tun2socks.exe +REM copy %CD%\packages\tap-windows-9.24.2-I601-Win10.exe %BINPATH%\tap-windows-9.24.2-I601-Win10.exe +copy %CD%\packages\build\go\bin\shadow.exe %BINPATH%\shadow.exe echo done diff --git a/config.json b/config.json index aefcd3e..e604034 100644 --- a/config.json +++ b/config.json @@ -1,36 +1,24 @@ { - "Server": "socks://localhost:1080", + "Server": [ + "socks://localhost:1080" + ], "NameServer": "https://1.1.1.1/dns-query", - "FilterString": "outbound and (ip ? ip.DstAddr != 1.1.1.1 : true)", - "IPRules": { - "Mode": false, - "IPCIDR": [] + "FilterString": "outbound and (ip ? ip.DstAddr != 1.2.3.4 and ip.DstAddr != 1.1.1.1 : true)", + "IPCIDRRules": { + "Proxy": [ + "198.18.0.0/16", + "8.8.8.8/32" + ] }, "AppRules": { - "Mode": true, - "Programs": [ + "Proxy": [ "chrome.exe", "nx.exe" ] }, "DomainRules": { - "Proxy": [ - "**.google.com", - "**.google.*", - "**.google.*.*", - "**.youtube.com", - "*.twitter.com", - "www.facebook.com", - "bing.com", - "**.amazon.*" - ], - "Direct": [ - "**.baidu.*", - "**.youku.*", - "**.*" - ], - "Blocked": [ - "ad.blocked.com" - ] + "Proxy": [], + "Direct": [], + "Blocked": [] } } \ No newline at end of file diff --git a/elevator.js b/elevator.js new file mode 100644 index 0000000..e69de29 diff --git a/lib/shell.js b/lib/shell.js index 2a11b4f..337350c 100644 --- a/lib/shell.js +++ b/lib/shell.js @@ -57,3 +57,8 @@ exports.run = function(cmd, fork) { WSH.Run(c, 0, !fork); }; +exports.elevatedRun = function(cmd, fork) { + var oShell = CreateObject("Shell.Application"); + var c = exports.makeCmdLine(cmd); + oShell.shellExecute(c, null, null, "runas", 1); +}; diff --git a/ssloader.js b/ssloader.js index b460e79..3b98b71 100644 --- a/ssloader.js +++ b/ssloader.js @@ -9,36 +9,22 @@ var FILE = require("lib/file"); var SHELL = require("lib/shell"); var ssConfig = { - Server: "", - NameServer: "https://1.1.1.1/dns-query", - FilterString: "outbound and (ip ? ip.DstAddr != 1.1.1.1 : true)", - IPRules: { - Mode: false, - IPCIDR: [] - }, - AppRules: { - Mode: true, - Programs: [] - }, - DomainRules: { - Proxy: [ - "**.google.com", - "**.google.*", - "**.google.*.*", - "**.youtube.com", - "*.twitter.com", - "www.facebook.com", - "bing.com", - "**.amazon.*" - ], - Direct: [ - "**.baidu.*", - "**.youku.*", - "**.*" - ], - Blocked: [ - "ad.blocked.com" + "Server": [], + "NameServer": "https://1.1.1.1/dns-query", + "FilterString": "outbound and (ip ? ip.DstAddr != 1.2.3.4 and ip.DstAddr != 1.1.1.1 : true)", + "IPCIDRRules": { + "Proxy": [ + "198.18.0.0/16", + "8.8.8.8/32" ] + }, + "AppRules": { + "Proxy":[] + }, + "DomainRules": { + "Proxy": [], + "Direct": [], + "Blocked": [] } }; @@ -46,25 +32,13 @@ exports.main = function() { // 내부 포트 결정 console.log("* Connecting to socket proxy..."); var listenPort = SS.connect(); - ssConfig.Server = "socks://localhost:" + listenPort; + ssConfig.Server.push("socks://localhost:" + listenPort); console.log("* Local listening port: " + listenPort); - // 네트워크 인터페이스 정보 조회 - console.log("* Gethering network interfaces..."); - var inets = SYS.getNetworkInterfaces(); - for (var i = 0; i < inets.length; i++) { - console.log(" > " + inets[i].Caption); - } - - // TAP 설치 여부 조회 - console.log("* Gethering WindowsTAP interfaces..."); - console.log(WINTAP.query("tap0901")); - //ssConfig.TunName = "TAP-Windows Adapter V9"; - // 앱 규칙 설정 var processNames = __global.processNames; for (var i in processNames) { - ssConfig.AppRules.Programs.push(processNames[i]); + ssConfig.AppRules.Proxy.push(processNames[i]); } // 설정 파일 저장 @@ -76,12 +50,8 @@ exports.main = function() { console.info("설정 파일 저장 완료!"); // 앱 프록시 실행 - console.info("앱 프록시는 관리자 권한을 필요로 합니다. 확인을 눌러주세요."); - SHELL.run([ - "bin/shadow.exe", - "-c", - "config.json" - ]); + console.info("앱 프록시는 관리자 권한을 필요로 합니다. 권한 요청 시 확인을 눌러주세요."); + SHELL.elevatedRun("assignProxy.bat"); }; exports.ssConfig = ssConfig; diff --git a/token.txt b/token.txt index 40b05be..d440194 100644 --- a/token.txt +++ b/token.txt @@ -1 +1 @@ -32fiJjwxNmDhSpLhqG1yKPt7qTxMFyno \ No newline at end of file +EZWLCH1Lw4iP5QhRbzfCTuND4laAz4bA \ No newline at end of file