Skip to main content
Zondex
login
Browse Stats Pricing Blog Dorks How-To Docs
code

Go Integration

Use the Zondex API from Go applications. No external dependencies — just the standard library.

search Basic Search

Query the Zondex API and parse JSON results.

package main import ( "encoding/json" "fmt" "net/http" "net/url" ) const apiBase = "https://zondex.io" type SearchResult struct { Total int `json:"total"` Results []Host `json:"results"` } type Host struct { IP string `json:"ip"` Port int `json:"port"` Service string `json:"service"` Product string `json:"product"` Country string `json:"country_code"` } func search(query string, apiKey string) (*SearchResult, error) { u := fmt.Sprintf("%s/api/search/?q=%s", apiBase, url.QueryEscape(query)) req, _ := http.NewRequest("GET", u, nil) req.Header.Set("X-API-Key", apiKey) resp, err := http.DefaultClient.Do(req) if err != nil { return nil, err } defer resp.Body.Close() var result SearchResult if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { return nil, err } return &result, nil } func main() { result, err := search("port:443 product:nginx", "YOUR_API_KEY") if err != nil { panic(err) } fmt.Printf("Found %d results\n", result.Total) for _, h := range result.Results { fmt.Printf(" %s:%d — %s\n", h.IP, h.Port, h.Product) } }

speed Concurrent Multi-Query

Run multiple queries concurrently using goroutines.

func multiSearch(queries []string, apiKey string) { var wg sync.WaitGroup for _, q := range queries { wg.Add(1) go func(query string) { defer wg.Done() result, err := search(query, apiKey) if err != nil { fmt.Printf("Error for %q: %v\n", query, err) return } fmt.Printf("%q: %d results\n", query, result.Total) }(q) } wg.Wait() } // Usage: multiSearch([]string{ "port:22", "port:80", "port:443", "port:8080", }, "YOUR_API_KEY")
support_agent
Zondex Support
Usually replies within minutes
Hi there!
Send us a message and we'll reply as soon as possible.