Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Commit

Permalink
quick fix up for #3 ,and update to v1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
superfashi committed Nov 13, 2016
1 parent 8501a4e commit 8fc8751
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions brute.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ func saveProxies() {
func() {
for {
resp, err := http.Get("http://api.xicidaili.com/free2016.txt")
if err != nil || resp.Body == nil {
if err != nil {
log.Println(err)
time.Sleep(RETRY_TIME)
continue
}
sca := bufio.NewScanner(resp.Body)
for sca.Scan() {
Expand All @@ -153,9 +154,10 @@ func saveProxies() {
func() {
for {
resp, err := http.Get("http://proxy.tekbreak.com/1000/json")
if err != nil || resp.Body == nil {
if err != nil {
log.Println(err)
time.Sleep(RETRY_TIME)
continue
}
var sca []struct {
IP string `json:"ip"`
Expand All @@ -165,6 +167,7 @@ func saveProxies() {
if err := json.NewDecoder(resp.Body).Decode(&sca); err != nil {
log.Println(err)
time.Sleep(RETRY_TIME)
continue
}
for _, i := range sca {
ne := Proxy{addr: i.IP, port: i.Port}
Expand All @@ -191,15 +194,17 @@ func saveProxies() {
func() {
for {
resp, err := http.Get("https://free-proxy-list.net/")
if err != nil || resp.Body == nil {
if err != nil {
log.Println(err)
time.Sleep(RETRY_TIME)
continue
}
conte, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
log.Println(err)
time.Sleep(RETRY_TIME)
continue
}
re, _ := regexp.Compile(`<tr><td>(\d+\.\d+\.\d+\.\d+)</td><td>(\d+)</td><td>.*</td><td>.*</td><td>.*</td><td>.*</td><td>(yes|no)</td><td>.*</td></tr>`)
sca := re.FindAllStringSubmatch(string(conte), -1)
Expand All @@ -224,15 +229,17 @@ func saveProxies() {
func() {
for {
resp, err := http.Get("https://www.sslproxies.org/")
if err != nil || resp.Body == nil {
if err != nil {
log.Println(err)
time.Sleep(RETRY_TIME)
continue
}
conte, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
log.Println(err)
time.Sleep(RETRY_TIME)
continue
}
re, _ := regexp.Compile(`<tr><td>(\d+\.\d+\.\d+\.\d+)</td><td>(\d+)</td>.*</tr>`)
sca := re.FindAllStringSubmatch(string(conte), -1)
Expand Down

0 comments on commit 8fc8751

Please sign in to comment.