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
- "log"
12
- "math/rand"
13
- "os"
14
- "os/signal"
15
- "strings"
16
- "time"
8
+ "encoding/json"
9
+ "flag"
10
+ "fmt"
11
+ "log"
12
+ "math/rand"
13
+ "os"
14
+ "os/signal"
15
+ "strings"
16
+ "time"
17
17
)
18
18
19
19
var port = flag .Int ("p" , 80 , "proxy port" )
@@ -26,66 +26,67 @@ var fetch = flag.String("url", "", "url proxy fetch")
26
26
const wt = 3
27
27
28
28
type Api struct {
29
- Status string `json:"Status"`
30
- Reason string `json:"Reason"`
29
+ Status string `json:"Status"`
30
+ Reason string `json:"Reason"`
31
31
}
32
32
33
33
type Config struct {
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"`
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"`
50
50
}
51
51
52
52
var config Config
53
53
54
54
func main () {
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 ())
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
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
- }
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
72
73
- _ = os .Remove (* output )
73
+ _ = os .Remove (* output )
74
74
75
- exporter = & Exporter {
76
- out : * output ,
77
- }
75
+ exporter = & Exporter {
76
+ out : * output ,
77
+ }
78
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 )
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
87
88
- sc := make (chan os.Signal , 1 )
89
- signal .Notify (sc , os .Kill , os .Interrupt )
90
- <- sc
88
+ sc := make (chan os.Signal , 1 )
89
+ signal .Notify (sc , os .Kill , os .Interrupt )
90
+ <- sc
91
+ exporter .Close ()
91
92
}
0 commit comments