Created
August 19, 2019 15:54
-
-
Save wybiral/8c6111b0aae03094c9b8e0a71c71cf7a to your computer and use it in GitHub Desktop.
Example of using the ipv4scan Scanner from Go code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"github.com/wybiral/ipv4scan/pkg/scan" | |
) | |
func main() { | |
// create scanner with 500 threads | |
s := scan.NewScanner(500) | |
// set socks5 proxy for scan (optional) | |
err := s.SetProxy("socks5://127.0.0.1:9050") | |
if err != nil { | |
log.Fatal(err) | |
} | |
// print scan results in real-time | |
for result := range s.Start() { | |
fmt.Println("IP:", result.IP) | |
fmt.Println("Port:", result.Port) | |
fmt.Println(result.Headers) | |
fmt.Println("") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment