First version 1.0

pull/1/head
daffainfo 2021-11-23 19:29:30 +07:00
parent bb233d7c9d
commit 03b479ec62
3 changed files with 185 additions and 0 deletions

90
db.json Normal file
View File

@ -0,0 +1,90 @@
[
{
"Name": "AdotpAPet API Key",
"Regex": "^\\s*([a-z0-9]{33})\\z"
},
{
"Name": "IUCN API Key",
"Regex": "^\\s*([a-z0-9]{64})\\z"
},
{
"Name": "TheCatAPI API Key",
"Regex": "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[0-9a-f]{12}"
},
{
"Name": "TheDogAPI API Key",
"Regex": "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[0-9a-f]{12}"
},
{
"Name": "AniAPI OAuth Token",
"Regex": "^[A-Za-z0-9-_=]+\\.[A-Za-z0-9-_=]+\\.?[A-Za-z0-9-_.+/=]*$"
},
{
"Name": "MyAnimeList OAuth Token",
"Regex": "^[A-Za-z0-9-_=]+\\.[A-Za-z0-9-_=]+\\.?[A-Za-z0-9-_.+/=]*$"
},
{
"Name": "AbuseIPDB API Key",
"Regex": "^\\s*([a-z0-9]{80})\\z"
},
{
"Name": "AlienVault Open Threat Exchange API Key",
"Regex": "^\\s*([a-z0-9]{64})\\z"
},
{
"Name": "Google Safe Browsing API Key",
"Regex": "AIza[0-9A-Za-z-_]{35}"
},
{
"Name": "URLScan API Key",
"Regex": "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"
},
{
"Name": "VirusTotal API Key",
"Regex": "^\\s*([a-z0-9]{64})\\z"
},
{
"Name": "Cooper Hewitt API Key",
"Regex": "^\\s*([a-z0-9]{32})\\z"
},
{
"Name": "Dribbble API Key",
"Regex": "^\\s*([a-z0-9]{64})\\z"
},
{
"Name": "Europeana API Key",
"Regex": "^\\s*([a-z]{8,10})\\z"
},
{
"Name": "IconFinder API Key",
"Regex": "^\\s*([a-zA-Z0-9]{64})\\z"
},
{
"Name": "Rijksmuseum API Key",
"Regex": "^\\s*([a-zA-Z0-9]{8})\\z"
},
{
"Name": "Micro User Service API Key",
"Regex": "^\\s*([a-z0-9]{48})\\z"
},
{
"Name": "Covalent API Key",
"Regex": "ckey_[a-z0-9]{27}"
},
{
"Name": "Etherscan API Key",
"Regex": "^\\s*([A-Z0-9]{34})\\z"
},
{
"Name": "Nownodes API Key",
"Regex": "^\\s*([A-Za-z0-9]{32})\\z"
},
{
"Name": "API Bible API Key",
"Regex": "^\\s*([a-z0-9]{32})\\z"
},
{
"Name": "Google Books API Key",
"Regex": "AIza[0-9A-Za-z-_]{35}"
}
]

5
go.mod Normal file
View File

@ -0,0 +1,5 @@
module ApiGuesser
go 1.16
replace github.com/daffainfo/ApiGuesser => /ApiGuesser

90
main.go Normal file
View File

@ -0,0 +1,90 @@
package main
import (
"bufio"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"regexp"
)
type regex_data struct {
Name string `json:"Name"`
Regex string `json:"Regex"`
}
func show_banner() {
fmt.Println(`
_
___ ___|_|___ ___ _ _ ___ ___ ___ ___ ___
| .'| . | |___| . | | | -_|_ -|_ -| -_| _|
|__,| _|_| |_ |___|___|___|___|___|_|
|_| |___|
Author: Muhammad Daffa
Version: 1.0`)
}
func Regex_api_file(path string) {
file, err := os.Open(path)
if err != nil {
log.Fatal(err)
}
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
fmt.Println(scanner.Text())
Regex_api(scanner.Text())
}
if err := scanner.Err(); err != nil {
log.Fatal(err)
}
}
func Regex_api(contents string) {
var data []regex_data
resp, err := http.Get("https://raw.githubusercontent.com/daffainfo/ApiGuesser/main/db.json")
if err != nil {
fmt.Println("No response from request")
}
defer resp.Body.Close()
byteValue, _ := ioutil.ReadAll(resp.Body)
var errjson = json.Unmarshal([]byte(byteValue), &data)
if errjson != nil {
fmt.Println(err.Error())
return
}
for i := range data {
re := regexp.MustCompile(data[i].Regex)
if re.MatchString(contents) {
res1 := re.FindAllString(contents, 1)
fmt.Println("[+] "+data[i].Name, " ", res1)
}
}
}
func main() {
show_banner()
api := flag.String("api", "", "An API Key. Example: tue3sv9hzsey1me4l7fwq3t46u5k8wag")
path := flag.String("path", "", "A file with API Key. Example: daffainfo.txt")
flag.Parse()
if *api != "" && *path == "" && len(*api) > 3 {
fmt.Println("Possible API Key:")
Regex_api(*api)
} else if *api == "" && *path != "" {
Regex_api_file(*path)
} else if *api != "" || *path != "" {
fmt.Println("Can't call 2 arguments at once")
}
}