mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
b8d9179def
commit
30d9415d8c
5 changed files with 25 additions and 24 deletions
|
@ -19,10 +19,16 @@ func cleanBanner(banner string) string {
|
|||
}
|
||||
|
||||
func tcpGrabber(mod *SynScanner, ip string, port int) string {
|
||||
if conn, err := net.Dial("tcp", fmt.Sprintf("%s:%d", ip, port)); err == nil {
|
||||
dialer := net.Dialer{
|
||||
Timeout: bannerGrabTimeout,
|
||||
}
|
||||
|
||||
if conn, err := dialer.Dial("tcp", fmt.Sprintf("%s:%d", ip, port)); err == nil {
|
||||
defer conn.Close()
|
||||
msg, _ := bufio.NewReader(conn).ReadString('\n')
|
||||
return cleanBanner(strings.Trim(msg, "\r\n\t "))
|
||||
} else {
|
||||
mod.Debug("%s:%d : %v", ip, port, err)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue