obfs插件自动安装配置
By
admin
at 2020-04-07 • 0人收藏 • 1617人看过
感谢 jacen 分享代码, 收藏备用
关于VPN那些事
import fsys; import web.json; import inet.http; import zlib.unzip; import console; import process.cache var ssPath = process.cache.find("Shadowsocks.exe") if(!ssPath) return console.pause(,"没有找到Shadowsocks.exe") var bin = inet.http().get("https://justmysocks2.net/members/dist/obfs-local.zip"); if(!bin) return console.pause(,"下载obfs-local.zip失败") var zipPath = io.tmpname() string.save(zipPath, bin ) var ok,err = zlib.unzip.extract(zipPath,io.splitpath(ssPath).dir, function(fileName,extractPath,fileInfo,size,unitSize,unitName){ if( size !== null )console.log( "正在解压文件",fileName,size++ unitName ); return true; } ) io.remove(zipPath) var ssConfigPath = fsys.path.replaceFile(ssPath,"gui-config.json"); var ssConfig = web.json.parse( string.load(ssConfigPath) ) if(!ssConfig) return console.pause(,"加载配置失败") ssConfig.index = -1; var cfgTemplate; for i,cfg in table.eachIndex(ssConfig.configs){ if(cfg.server == "c9s3.jamjams.net" || cfg.server == "c9s4.jamjams.net"){ cfg.plugin = "obfs-local"; cfg.plugin_opts = "obfs=tls"; cfg.method="aes-256-gcm"; ssConfig.index = i-1; obfs = true; } elseif(string.find(cfg.server,"\.jamjams\.net")) { cfgTemplate = cfg; } } if(ssConfig.index<0){ var cfg = table.mixin({},cfgTemplate,{ server = "c9s3.jamjams.net";plugin = "obfs-local";plugin_opts = "obfs=tls";method="aes-256-gcm" }); table.push(ssConfig.configs,cfg); var cfg = table.mixin({},cfgTemplate,{ server = "c9s4.jamjams.net";plugin = "obfs-local";plugin_opts = "obfs=tls";method="aes-256-gcm" }); table.push(ssConfig.configs,cfg); ssConfig.index = #ssConfig.configs - 1; } string.save(ssConfigPath,web.json.stringify(ssConfig,true)); process.kill(ssPath,true); console.log("obfs插件安装配置成功") console.pause()
登录后方可回帖