apiguesser/main.go

60 lines
1.3 KiB
Go
Raw Normal View History

2021-11-23 12:29:30 +00:00
package main
import (
"flag"
"fmt"
2021-11-23 15:30:24 +00:00
g "github.com/daffainfo/apiguesser/guesser"
)
2021-11-23 12:29:30 +00:00
2021-12-03 11:02:02 +00:00
var (
Red = Color("\033[1;31m%s\033[0m")
Green = Color("\033[1;32m%s\033[0m")
Blue = Color("\033[1;34m%s\033[0m")
Cyan = Color("\033[1;36m%s\033[0m")
)
func Color(colorString string) func(...interface{}) string {
sprint := func(args ...interface{}) string {
return fmt.Sprintf(colorString,
fmt.Sprint(args...))
}
return sprint
}
2021-11-23 12:29:30 +00:00
func show_banner() {
2021-12-03 11:02:02 +00:00
fmt.Println(Blue(`
2021-11-23 12:29:30 +00:00
_
___ ___|_|___ ___ _ _ ___ ___ ___ ___ ___
| .'| . | |___| . | | | -_|_ -|_ -| -_| _|
|__,| _|_| |_ |___|___|___|___|___|_|
|_| |___|
Author: Muhammad Daffa
2021-12-03 11:02:02 +00:00
Version: 1.0
Starting...
`))
2021-11-23 12:29:30 +00:00
}
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 {
2021-12-03 11:02:02 +00:00
fmt.Println(Cyan(*api))
if g.Regex_api(*api) != "" {
fmt.Println(Green(g.Regex_api(*api)))
} else {
fmt.Println(Red("Not Match"))
}
2021-11-23 12:29:30 +00:00
} else if *api == "" && *path != "" {
2021-11-23 15:30:24 +00:00
g.Regex_api_file(*path)
2021-11-23 12:29:30 +00:00
} else if *api != "" || *path != "" {
2021-12-03 11:02:02 +00:00
fmt.Println(Red("Can't call 2 arguments at once"))
2021-11-23 12:29:30 +00:00
}
}