Skip to content

Instantly share code, notes, and snippets.

@wybiral
Created August 19, 2019 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wybiral/8c6111b0aae03094c9b8e0a71c71cf7a to your computer and use it in GitHub Desktop.
Save wybiral/8c6111b0aae03094c9b8e0a71c71cf7a to your computer and use it in GitHub Desktop.
Example of using the ipv4scan Scanner from Go code
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