mirror of
https://github.com/lunchcat/sif.git
synced 2026-06-12 19:11:25 -07:00
cmd: close resp.Body to avoid memory leak
This commit is contained in:
@@ -63,6 +63,7 @@ func Dirlist(size string, url string, timeout time.Duration, threads int, logdir
|
||||
log.Errorf("Error downloading directory list: %s", err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
var directories []string
|
||||
scanner := bufio.NewScanner(resp.Body)
|
||||
scanner.Split(bufio.ScanLines)
|
||||
|
||||
@@ -51,6 +51,7 @@ func Dnslist(size string, url string, timeout time.Duration, threads int, logdir
|
||||
log.Errorf("Error downloading DNS list: %s", err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
var dns []string
|
||||
scanner := bufio.NewScanner(resp.Body)
|
||||
scanner.Split(bufio.ScanLines)
|
||||
|
||||
@@ -48,6 +48,7 @@ func Dork(url string, timeout time.Duration, threads int, logdir string) {
|
||||
log.Errorf("Error downloading dork list: %s", err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
var dorks []string
|
||||
scanner := bufio.NewScanner(resp.Body)
|
||||
scanner.Split(bufio.ScanLines)
|
||||
|
||||
@@ -47,6 +47,7 @@ func Git(url string, timeout time.Duration, threads int, logdir string) {
|
||||
log.Errorf("Error downloading git list: %s", err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
var gitUrls []string
|
||||
scanner := bufio.NewScanner(resp.Body)
|
||||
scanner.Split(bufio.ScanLines)
|
||||
|
||||
@@ -44,6 +44,7 @@ func Ports(scope string, url string, timeout time.Duration, threads int, logdir
|
||||
log.Errorf("Error downloading ports list: %s", err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
scanner := bufio.NewScanner(resp.Body)
|
||||
scanner.Split(bufio.ScanLines)
|
||||
for scanner.Scan() {
|
||||
|
||||
@@ -46,6 +46,7 @@ func Scan(url string, timeout time.Duration, threads int, logdir string) {
|
||||
if err != nil {
|
||||
log.Debugf("Error: %s", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != 404 && resp.StatusCode != 301 && resp.StatusCode != 302 && resp.StatusCode != 307 {
|
||||
scanlog.Infof("file [%s] found", statusstyle.Render("robots.txt"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user