MCPcopy
hub / github.com/ph4ntonn/Stowaway / main

Function main

agent/agent.go:19–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17}
18
19func main() {
20 options := initial.ParseOptions()
21
22 share.GeneratePreAuthToken(options.Secret)
23
24 agent := process.NewAgent(options)
25
26 protocol.DecideType(options.Upstream, options.Downstream)
27
28 var conn net.Conn
29 switch options.Mode {
30 case initial.NORMAL_PASSIVE:
31 conn, agent.UUID = initial.NormalPassive(options)
32 case initial.NORMAL_RECONNECT_ACTIVE:
33 fallthrough
34 case initial.NORMAL_ACTIVE:
35 conn, agent.UUID = initial.NormalActive(options, nil)
36 case initial.SOCKS5_PROXY_RECONNECT_ACTIVE:
37 fallthrough
38 case initial.SOCKS5_PROXY_ACTIVE:
39 proxy := share.NewSocks5Proxy(options.Connect, options.Socks5Proxy, options.Socks5ProxyU, options.Socks5ProxyP)
40 conn, agent.UUID = initial.NormalActive(options, proxy)
41 case initial.HTTP_PROXY_RECONNECT_ACTIVE:
42 fallthrough
43 case initial.HTTP_PROXY_ACTIVE:
44 proxy := share.NewHTTPProxy(options.Connect, options.HttpProxy)
45 conn, agent.UUID = initial.NormalActive(options, proxy)
46 case initial.IPTABLES_REUSE_PASSIVE:
47 defer initial.DeletePortReuseRules(options.Listen, options.ReusePort)
48 conn, agent.UUID = initial.IPTableReusePassive(options)
49 case initial.SO_REUSE_PASSIVE:
50 conn, agent.UUID = initial.SoReusePassive(options)
51 default:
52 log.Fatal("[*] Unknown Mode")
53 }
54
55 global.InitialGComponent(conn, options.Secret, agent.UUID)
56 global.G_TLSEnable = options.TlsEnable
57
58 agent.Run()
59}

Callers

nothing calls this directly

Calls 13

RunMethod · 0.95
ParseOptionsFunction · 0.92
GeneratePreAuthTokenFunction · 0.92
NewAgentFunction · 0.92
DecideTypeFunction · 0.92
NormalPassiveFunction · 0.92
NormalActiveFunction · 0.92
NewSocks5ProxyFunction · 0.92
NewHTTPProxyFunction · 0.92
DeletePortReuseRulesFunction · 0.92
IPTableReusePassiveFunction · 0.92
SoReusePassiveFunction · 0.92

Tested by

no test coverage detected