07c61c1b1c
First push for beginning of project
31 lines
575 B
Go
31 lines
575 B
Go
package shodan
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/ns3777k/go-shodan/v4/shodan"
|
|
|
|
"git.tcp.direct/perp/shogo/internal/utils"
|
|
)
|
|
|
|
// Return your query result count
|
|
func Count(query string) {
|
|
// Setup query
|
|
options := &shodan.HostQueryOptions{
|
|
Query: query,
|
|
}
|
|
|
|
// Get results
|
|
results, err := utils.Client.GetHostsCountForQuery(context.Background(), options)
|
|
if err != nil {
|
|
fmt.Printf("%s: %s\n", utils.Red("Error"), err.Error())
|
|
os.Exit(1)
|
|
}
|
|
|
|
// Print results
|
|
utils.Title.Printf("Count: %s\n", query)
|
|
fmt.Printf("%s\n", utils.Blue(results.Total))
|
|
}
|