1
1
/*
2
- (c) Yariya
2
+ (c) Yariya
3
3
*/
4
4
5
5
package main
6
6
7
7
import (
8
- "encoding/json"
9
- "flag"
10
- "fmt"
11
- "io"
12
- "log"
13
- "math/rand"
14
- "net/http"
15
- "os"
16
- "os/signal"
17
- "strings"
18
- "time"
8
+ "encoding/json"
9
+ "flag"
10
+ "fmt"
11
+ "log"
12
+ "math/rand"
13
+ "os"
14
+ "os/signal"
15
+ "strings"
16
+ "time"
19
17
)
20
18
21
19
var port = flag .Int ("p" , 80 , "proxy port" )
@@ -28,95 +26,66 @@ var fetch = flag.String("url", "", "url proxy fetch")
28
26
const wt = 3
29
27
30
28
type Api struct {
31
- Status string `json:"Status"`
32
- Reason string `json:"Reason"`
29
+ Status string `json:"Status"`
30
+ Reason string `json:"Reason"`
33
31
}
34
32
35
33
type Config struct {
36
- License string `json:"license"`
37
- CheckSite string `json:"check-site"`
38
- ProxyType string `json:"proxy-type"`
39
- HttpThreads int `json:"http_threads"`
40
- Headers struct {
41
- UserAgent string `json:"user-agent"`
42
- Accept string `json:"accept"`
43
- } `json:"headers"`
44
- PrintIps struct {
45
- Enabled bool `json:"enabled"`
46
- DisplayIpInfo bool `json:"display-ip-info"`
47
- } `json:"print_ips"`
48
- Timeout struct {
49
- HttpTimeout int `json:"http_timeout"`
50
- Socks4Timeout int `json:"socks4_timeout"`
51
- Socks5Timeout int `json:"socks5_timeout"`
52
- } `json:"timeout"`
34
+ CheckSite string `json:"check-site"`
35
+ ProxyType string `json:"proxy-type"`
36
+ HttpThreads int `json:"http_threads"`
37
+ Headers struct {
38
+ UserAgent string `json:"user-agent"`
39
+ Accept string `json:"accept"`
40
+ } `json:"headers"`
41
+ PrintIps struct {
42
+ Enabled bool `json:"enabled"`
43
+ DisplayIpInfo bool `json:"display-ip-info"`
44
+ } `json:"print_ips"`
45
+ Timeout struct {
46
+ HttpTimeout int `json:"http_timeout"`
47
+ Socks4Timeout int `json:"socks4_timeout"`
48
+ Socks5Timeout int `json:"socks5_timeout"`
49
+ } `json:"timeout"`
53
50
}
54
51
55
52
var config Config
56
53
57
54
func main () {
58
- if strings .Contains (strings .Join (os .Args [0 :], "" ), "-h" ) {
59
- fmt .Printf ("\t \t Shock Proxmeno.\n Help:\n \t -p <port> - Port you want to scan.\n \t -o <proxies.txt> - Writes proxy hits to file.\n \n \t -input <proxies.txt> - Loads the proxy list and checks it.\n \t -url https://api.com/proxies - Loads the proxies from an api and checks it.\n \n \t config.json - Customize the whole proxy checker\n " )
60
- return
61
- }
62
- flag .Parse ()
63
- rand .Seed (time .Now ().UnixNano ())
64
-
65
- cfgBytes , err := os .ReadFile (* configFile )
66
- if err != nil {
67
- log .Println ("error while opening config file" )
68
- return
69
- }
70
- err = json .Unmarshal (cfgBytes , & config )
71
- if err != nil {
72
- fmt .Println ("error while parsing config json" )
73
- return
74
- }
75
-
76
- res , err := http .Get ("https://license.shock.ac/?license=" + config .License )
77
- if err != nil {
78
- fmt .Println ("api error" )
79
- return
80
- }
81
- body , err := io .ReadAll (res .Body )
82
- if err != nil {
83
- log .Println ("body error" )
84
- return
85
- }
86
- res .Body .Close ()
87
-
88
- var api Api
89
- err = json .Unmarshal (body , & api )
90
- if err != nil {
91
- log .Println ("json error" )
92
- return
93
- }
94
-
95
- if api .Status != "Success" {
96
- log .Println ("license error: expired?" )
97
- return
98
- }
99
-
100
- if len (os .Args ) <= 1 {
101
- fmt .Println ("note: default port is set to 80. If you want to change this use [-p] argument." )
102
- }
103
-
104
- _ = os .Remove (* output )
105
-
106
- exporter = & Exporter {
107
- out : * output ,
108
- }
109
-
110
- go exporter .create ()
111
- go Queue ()
112
- go Scanner ()
113
- for x := 0 ; x < wt ; x ++ {
114
- go Proxies .WorkerThread ()
115
- }
116
- go Stater ()
117
- time .Sleep (time .Second )
118
-
119
- sc := make (chan os.Signal , 1 )
120
- signal .Notify (sc , os .Kill , os .Interrupt )
121
- <- sc
55
+ if strings .Contains (strings .Join (os .Args [0 :], "" ), "-h" ) {
56
+ fmt .Printf ("\t \t Zmap ProxyScanner @tcpfin\n Help:\n \t -p <port> - Port you want to scan.\n \t -o <proxies.txt> - Writes proxy hits to file.\n \n \t -input <proxies.txt> - Loads the proxy list and checks it.\n \t -url https://api.com/proxies - Loads the proxies from an api and checks it.\n \n \t config.json - Customize the whole proxy checker\n " )
57
+ return
58
+ }
59
+ flag .Parse ()
60
+ rand .Seed (time .Now ().UnixNano ())
61
+
62
+ cfgBytes , err := os .ReadFile (* configFile )
63
+ if err != nil {
64
+ log .Println ("error while opening config file" )
65
+ return
66
+ }
67
+ err = json .Unmarshal (cfgBytes , & config )
68
+ if err != nil {
69
+ fmt .Println ("error while parsing config json" )
70
+ return
71
+ }
72
+
73
+ _ = os .Remove (* output )
74
+
75
+ exporter = & Exporter {
76
+ out : * output ,
77
+ }
78
+
79
+ go exporter .create ()
80
+ go Queue ()
81
+ go Scanner ()
82
+ for x := 0 ; x < wt ; x ++ {
83
+ go Proxies .WorkerThread ()
84
+ }
85
+ go Stater ()
86
+ time .Sleep (time .Second )
87
+
88
+ sc := make (chan os.Signal , 1 )
89
+ signal .Notify (sc , os .Kill , os .Interrupt )
90
+ <- sc
122
91
}
0 commit comments