package main
import (
"fmt"
"log"
"net/http"
"net/http/cookiejar"
"os"
"os/exec"
"runtime"
"strings"
"github.com/PuerkitoBio/goquery"
"golang.org/x/net/publicsuffix"
"golang.org/x/text/encoding/charmap"
"golang.org/x/text/transform"
)
func main() {
clear()
alpha := getInput("set a Dork: ")
query := alpha
tld := []string{"com", "com.sg", "co.id", "co.uk"}
jar, _ := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})
client := &http.Client{
Jar: jar,
}
visited := make(map[string]bool)
for _, t := range tld {
results := search(query, t, 100, client)
for _, gamma := range results {
if !visited[gamma] {
fmt.Println(gamma)
visited[gamma] = true
}
}
}
fmt.Println("Done")
fmt.Println("[! >] delete .google-cookie DIR")
}
func clear() {
cmd := "clear"
if runtime.GOOS == "windows" {
cmd = "cls"
}
clearCmd := exec.Command(cmd)
clearCmd.Stdout = os.Stdout
clearCmd.Run()
}
func getInput(prompt string) string {
fmt.Print(prompt)
var input string
fmt.Scanln(&input)
return input
}
func search(query string, tld string, num int, client *http.Client) []string {
url := fmt.Sprintf("https://www.google.%s/search?q=%s&num=%d", tld, query, num)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_6_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
doc, err := goquery.NewDocumentFromReader(transform.NewReader(resp.Body, charmap.ISO8859_1.NewDecoder()))
if err != nil {
log.Fatal(err)
}
var results []string
doc.Find("#search .g").Each(func(i int, s *goquery.Selection) {
link := s.Find("a").AttrOr("href", "")
if link != "" {
link = cleanURL(link)
results = append(results, link)
}
})
return results
}
func cleanURL(url string) string {
if strings.HasPrefix(url, "/url?q=") {
url = url[7:]
if idx := strings.Index(url, "&"); idx != -1 {
url = url[:idx]
}
}
return url
}
import os
import requests
import random
import warnings
from googlesearch import search
from termcolor import colored, cprint
from http import cookiejar
class BlockAll(cookiejar.CookiePolicy):
return_ok = set_ok = domain_return_ok = path_return_ok = lambda self, *args, **kwargs: False
netscape = True
rfc2965 = hide_cookie2 = False
def fxn():
warnings.warn("deprecated", DeprecationWarning)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
fxn()
def clear():
return os.system('cls' if os.name == 'nt' else 'clear')
TLD = ["com", "net", "org", "io", "ai", "gov", "edu", "co", "uk", "mil", "ru", "ca", "de", "au", "jp", "cn", "in", "br", "es", "id", "sg", "xyz"]
s = requests.Session()
s.cookies.set_policy(BlockAll())
alpha = input(colored('set a Dork : ', 'green'))
query = alpha
beta = random.choice(TLD)
for gamma in search(query, num_results=10):
print(gamma)
print(colored('Done', 'green'))
print(colored('[! >] delete .google-cookie DIR ', 'red'))