Skip to content

Commit

Permalink
修复多节点连接的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Mob2003 committed Mar 28, 2023
1 parent 36af6a8 commit e4b3295
Show file tree
Hide file tree
Showing 11 changed files with 306 additions and 341 deletions.
Binary file modified bin/rakshasa.exe
Binary file not shown.
Binary file modified bin/rakshasa_darwin
Binary file not shown.
Binary file modified bin/rakshasa_linux
Binary file not shown.
16 changes: 13 additions & 3 deletions common/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"errors"
"fmt"
"github.com/dlclark/regexp2"
"github.com/google/uuid"
"math/rand"
"net"
Expand All @@ -15,6 +16,7 @@ import (
)

var Debug bool = false
var NoPing bool = false
var DebugLock bool = false
var DebugLockMap sync.Map

Expand Down Expand Up @@ -194,13 +196,12 @@ func init() {

type RegMsg struct {
UUID string //当前机器uuid
Addr string
RegAddr string //远程连接的addr
Hostname string //当前机器名称
Goos string
ViaUUID string
Err string
MainIp []string
MainIp string
Port int
}

Expand Down Expand Up @@ -310,7 +311,16 @@ func ResolveTCPAddr(str string) ([]string, error) {
dst = append(dst[:i], dst[i+1:]...)
} else {
if _, err := net.ResolveTCPAddr("tcp", addr); err != nil {
return nil, fmt.Errorf("参数错误 格式为\"ip:端口\",多个地址以逗号隔开,错误详情%v", err)
if i>0{
r, _ := regexp2.Compile(`^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}`, 0)
match,_ :=r.MatchString(addr)
if !match{
return nil, fmt.Errorf("参数错误 格式为\"ip:端口\",多个地址以逗号隔开,错误详情%v", err)
}
}else{
return nil, fmt.Errorf("参数错误 格式为\"ip:端口,第二个地址可以是UUID\",多个地址以逗号隔开,错误详情%v", err)
}

}
}

Expand Down
2 changes: 1 addition & 1 deletion common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type Config struct {
DstNode []string //-d 上级节点
Password string //通讯密码,可为空
Port int //默认8883
ListenIp []string //指定公网ip,其他节点进行额外节点连接时候,尝试连接的ip
ListenIp string //指定公网ip,其他节点进行额外节点连接时候,尝试连接的ip
Limit bool //禁止额外连接,只连接-d节点,不会尝试连接其他节点
FileName string
FileSave bool `yaml:"-"`
Expand Down
207 changes: 16 additions & 191 deletions in.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,194 +8,19 @@
66.29.154.103:3128
35.222.50.197:80
169.55.89.6:80
174.70.1.210:8080
35.209.198.222:80
208.109.32.60:81
3.134.56.120:80
20.241.236.196:3128
216.215.123.174:8080
3.128.142.113:80
146.190.74.6:80
24.106.221.230:53281
165.3.122.211:80
155.254.192.216:80
104.255.231.87:3128
45.61.163.12:80
45.77.198.163:80
216.137.184.253:80
71.255.153.117:80
104.223.135.178:10000
109.122.195.16:80
5.78.78.180:8080
54.82.79.59:80
52.24.80.166:80
3.220.76.84:80
129.153.107.221:80
64.225.8.115:9997
20.69.79.158:8443
191.101.1.116:80
5.78.75.64:8080
72.169.67.145:87
12.69.91.227:80
4.16.68.158:443
52.144.46.250:25345
198.59.191.234:8080
64.225.4.12:9991
93.188.166.232:80
137.184.197.190:80
72.169.67.241:87
130.41.109.158:8080
204.2.218.145:8080
66.75.121.167:8080
162.223.94.163:80
38.242.195.210:80
64.225.8.132:9979
93.188.161.84:80
68.183.143.134:80
64.225.8.142:9988
184.60.66.122:80
15.204.207.232:3128
64.225.4.81:9991
47.254.47.61:77
64.225.8.118:9990
31.220.52.49:80
23.238.33.186:80
52.86.21.254:80
103.152.112.145:80
3.12.178.169:80
47.88.87.74:1080
98.110.236.35:8080
142.93.61.46:80
154.202.97.224:3128
154.201.62.199:3128
154.202.122.29:3128
154.202.98.115:3128
72.169.66.157:87
75.89.101.62:80
64.225.8.121:9992
198.11.175.192:3128
159.89.132.167:8989
72.170.220.17:8080
148.76.97.250:80
3.94.182.57:7497
43.251.116.62:45787
206.189.199.91:80
34.23.45.223:80
64.225.4.63:9998
52.38.72.41:80
38.52.220.194:999
18.217.198.64:80
206.161.97.62:31337
170.187.138.40:8009
143.198.182.218:80
34.170.89.64:80
97.74.92.60:80
64.225.8.82:9995
43.249.11.114:45787
137.184.242.126:80
143.110.232.177:80
143.198.228.250:80
209.126.6.159:80
138.68.60.8:3128
63.239.220.11:8080
100.21.127.153:80
34.229.213.84:8118
45.81.130.51:45787
198.199.86.11:8080
108.161.128.43:80
209.169.71.193:80
64.225.8.191:9987
167.99.236.14:80
156.239.48.222:3128
209.127.148.104:3128
154.202.118.16:3128
154.202.124.35:3128
154.83.8.195:3128
154.202.125.108:3128
194.50.243.120:3128
154.202.127.66:3128
154.202.119.127:3128
156.239.48.48:3128
162.144.236.128:80
157.230.48.102:80
104.45.128.122:80
149.248.14.12:24018
72.169.67.85:87
128.199.13.74:80
64.225.4.29:9994
72.52.217.188:80
154.202.122.17:3128
154.202.127.8:3128
154.202.127.192:3128
154.202.115.109:3128
156.239.51.113:3128
154.202.119.154:3128
154.202.98.233:3128
154.201.61.223:3128
156.239.53.151:3128
154.202.97.174:3128
209.127.48.59:3128
156.239.48.128:3128
156.239.54.138:3128
154.202.125.44:3128
156.239.51.49:3128
154.202.113.77:3128
209.127.136.164:3128
154.202.122.139:3128
154.202.114.4:3128
45.199.137.179:3128
185.93.32.136:3128
45.199.140.87:3128
154.202.114.244:3128
156.239.55.233:3128
154.202.112.54:3128
156.239.51.131:3128
154.83.10.189:3128
154.83.8.13:3128
154.83.11.100:3128
154.202.112.128:3128
156.239.50.212:3128
154.202.110.19:3128
45.199.141.170:3128
154.202.113.221:3128
154.202.113.65:3128
45.199.140.85:3128
45.199.141.22:3128
50.114.110.124:3128
154.202.96.105:3128
154.202.114.110:3128
156.239.53.37:3128
156.239.55.63:3128
45.199.137.141:3128
154.202.118.60:3128
154.202.114.168:3128
45.199.140.71:3128
156.239.54.108:3128
154.202.114.20:3128
50.114.111.113:3128
156.239.53.217:3128
154.83.10.165:3128
45.199.139.158:3128
156.239.49.73:3128
154.202.112.20:3128
45.199.141.196:3128
154.202.98.241:3128
194.50.243.246:3128
154.201.63.43:3128
50.114.111.75:3128
154.202.111.153:3128
156.239.52.10:3128
156.239.51.17:3128
154.202.125.224:3128
156.239.54.78:3128
154.202.117.84:3128
154.83.9.218:3128
154.202.107.212:3128
156.239.53.11:3128
156.239.49.131:3128
154.202.118.72:3128
154.83.9.238:3128
45.199.141.60:3128
156.239.55.117:3128
154.202.120.165:3128
socks5://admin:123456@127.0.0.1:1080
167.71.246.128:3128
129.21.158.30:8080
69.167.174.17:80
45.119.208.134:80
216.21.18.194:80
54.205.132.170:80
113.121.39.200:7890
54.222.237.192:8888
120.27.239.26:7890
47.92.110.4:7890
183.230.162.122:9091
35.232.243.222:80
103.147.246.43:8080
15.236.135.81:80
186.96.2.89:999
36.88.170.170:8080
12 changes: 5 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"fmt"
"log"
"net/http"
_ "net/http/pprof"
Expand All @@ -11,18 +12,17 @@ import (
"rakshasa/httppool"
"rakshasa/server"
"strconv"
"strings"
"sync"
)

func main() {

var (
//以下为配置参数
dstNode = flag.String("d", "", "依次连接到指定的 上级节点地址,格式为 ip:端口 多个节点以,隔开\r\n -d 192.168.1.1:8883\r\n -d 192.168.1.1:8883,192.168.1.2:8882")
dstNode = flag.String("d", "", "依次连接到指定的 上级节点地址,格式为 ip:端口 多个节点以,隔开 第二个地址可以是UUID\r\n -d 192.168.1.1:8883\r\n -d 192.168.1.1:8883,192.168.1.2:8882")
limit = flag.String("limit", "", "limit模式,只连接-d的节点,不进行额外节点连接,默认为false,如果为true,本节点掉线的时候,将会尝试连接所有已保存节点")
password = flag.String("password", "", "通讯二次加密秘钥,可为空")
listenip = flag.String("ip", "", "设置本地节点指定公网ip,多个ip以,间隔,如\r\n -ip 192.168.1.1")
listenip = flag.String("ip", "", "设置本地节点指定公网ip,如\r\n -ip 192.168.1.1")
port = flag.String("p", "", "设置本地节点监听端口,默认8883")
configFile = flag.String("f", "", "配置文件路径,为空的时候不读取")
check_proxy = flag.String("check_proxy", "", "检查http代理是否有效,传入参数可以是ip:port 或者文件,当前支持ipv4,并将结果保存到-check_proxy_out,可选参数-check_proxy_timeout,-check_proxy_url,使用方法: \r\n -check_proxy 192.168.1.1:8080\r\n -check_proxy in.txt\r\n -check_proxy in.txt -check_proxy_out out.txt -check_proxy_timeout 10 -check_proxy_url https://www.google.com/")
Expand Down Expand Up @@ -82,7 +82,7 @@ func main() {
config.Password = *password
}
if *listenip != "" {
config.ListenIp = strings.Split(*listenip, ",")
config.ListenIp = *listenip
}
if *limit != "" {
if *limit != "flase" && *limit != "true" {
Expand Down Expand Up @@ -131,11 +131,9 @@ func main() {
}

if *shellCode != "" {

server.RunShellcodeWithDst(*dstNode, *shellCode, *shellCodeXorKey, *shellCodeParam, *shellCodeTimeout)

}
if err := server.StartServer(config.Port); err != nil {
if err := server.StartServer(fmt.Sprintf("%s:%d", config.ListenIp, config.Port)); err != nil {
log.Fatalln(err)
}

Expand Down
79 changes: 79 additions & 0 deletions readme/rakshasa内网穿透--win10+Proxifier使用案例.md

Large diffs are not rendered by default.

Loading

0 comments on commit e4b3295

Please sign in to comment.