@nwct/demo 1.0.1 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config.client.js +4 -4
- package/config.server.js +2 -2
- package/lib/client.js +1 -1
- package/lib/index.js +10 -1
- package/lib/server.js +5 -5
- package/package.json +2 -2
package/config.client.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module.exports={
|
2
|
-
server_addr: "
|
3
|
-
server_port:
|
2
|
+
server_addr: "166.66.66.66",//服务端地址,纯IP,必须改
|
3
|
+
server_port: 10000,//服务端端口,客户端和服务端必须保持一致
|
4
4
|
token: "aksda@$@#kjsk",//连接令牌,客户端和服务端必须保持一致
|
5
5
|
timeout: 3000,//请求超时时间
|
6
6
|
interval: 5000,//异常重试
|
@@ -8,7 +8,7 @@ module.exports={
|
|
8
8
|
ssh: {
|
9
9
|
local_ip: "127.0.0.1",//当前内网被转发的ip
|
10
10
|
local_port: 80,//当前内网被转发的端口
|
11
|
-
remote_port: 10001
|
11
|
+
remote_port: 10001,//服务端映射的端口
|
12
12
|
}
|
13
13
|
// ,
|
14
14
|
// aria2: {
|
@@ -22,4 +22,4 @@ module.exports={
|
|
22
22
|
// remote_port: 10003,//服务端映射的端口
|
23
23
|
// }
|
24
24
|
}
|
25
|
-
}
|
25
|
+
}
|
package/config.server.js
CHANGED
package/lib/client.js
CHANGED
package/lib/index.js
CHANGED
@@ -29,10 +29,19 @@ function registerCommand(){
|
|
29
29
|
.command('client')
|
30
30
|
.option('--server_addr <server_addr>','服务端地址(默认:0.0.0.0)')
|
31
31
|
.option('--server_port <server_port>','服务端端口(默认:10000)')
|
32
|
+
.option('--token <token>','连接令牌(默认:aksda@$@#kjsk)')
|
33
|
+
.option('--timeout <timeout>','请求超时时间(默认:3000)')
|
34
|
+
.option('--interval <interval>','连接令牌(默认:5000)')
|
35
|
+
.option('--binds <binds>','连接令牌(默认:ssh)')
|
36
|
+
.option('--local_ip <local_ip>','内网被转发的ip(默认:127.0.0.1)')
|
32
37
|
.option('--local_port <local_port>','内网被转发的端口(默认:80)')
|
38
|
+
.option('--remote_port <remote_port>','服务端映射的端口(默认:80)')
|
33
39
|
.action(client);
|
34
40
|
program
|
35
41
|
.command('server')
|
42
|
+
.option('--server_addr <server_addr>','服务端地址(默认:0.0.0.0)')
|
43
|
+
.option('--server_port <server_port>','服务端端口(默认:10000)')
|
44
|
+
.option('--token <token>','连接令牌(默认:aksda@$@#kjsk)')
|
36
45
|
.action(server);
|
37
46
|
// 对未知命令进行监听
|
38
47
|
program.on('command:*',function(obj){
|
@@ -47,4 +56,4 @@ function registerCommand(){
|
|
47
56
|
if(program.args&&program.args.length<1){
|
48
57
|
program.outputHelp()
|
49
58
|
}
|
50
|
-
}
|
59
|
+
}
|
package/lib/server.js
CHANGED
@@ -5,7 +5,7 @@ const envConfig=require('../config.server')
|
|
5
5
|
const CONFIG = {
|
6
6
|
server_addr: "0.0.0.0",//服务端地址 一般是0.0.0.0或127.0.0.1
|
7
7
|
server_port: 10000,//服务端端口
|
8
|
-
token: "aksda@$@#kjsk",//连接令牌
|
8
|
+
token: "aksda@$@#kjsk",//连接令牌
|
9
9
|
...envConfig
|
10
10
|
};
|
11
11
|
|
@@ -81,7 +81,7 @@ const listenServer = net.createServer((socket) => {
|
|
81
81
|
}
|
82
82
|
}
|
83
83
|
return socket.write(JSON.stringify({ code: code, type: type, id: id }));
|
84
|
-
} else if (type == 'connect') {// 客户端连接
|
84
|
+
} else if (type == 'connect') {// 客户端连接
|
85
85
|
let id = data.key;
|
86
86
|
let socketRecord = socketRecords[id];
|
87
87
|
if (socketRecord && socketRecord.bind && !socketRecord.client) {
|
@@ -100,13 +100,13 @@ const listenServer = net.createServer((socket) => {
|
|
100
100
|
}
|
101
101
|
}
|
102
102
|
} catch (error) {
|
103
|
-
//
|
103
|
+
//
|
104
104
|
removeInfo(id);
|
105
105
|
}
|
106
106
|
socket.end();
|
107
107
|
});
|
108
108
|
socket.on('error', (err) => {
|
109
|
-
//
|
109
|
+
//
|
110
110
|
removeInfo(id);
|
111
111
|
})
|
112
112
|
socket.on('end', (data) => {
|
@@ -125,4 +125,4 @@ function listenServe(cmdObj){
|
|
125
125
|
listenServer.listen(CONFIG.server_port, CONFIG.server_addr);
|
126
126
|
}
|
127
127
|
|
128
|
-
module.exports=listenServe;
|
128
|
+
module.exports=listenServe;
|
package/package.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nwct/demo",
|
3
|
-
"version": "
|
3
|
+
"version": "2.3.2",
|
4
4
|
"description": "Internal network penetration, mapping external network",
|
5
5
|
"main": "bin/index.js",
|
6
6
|
"bin": {
|
7
|
-
"
|
7
|
+
"mapping": "bin/index.js"
|
8
8
|
},
|
9
9
|
"scripts": {
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1",
|