Change URL database

main
Muhammad Daffa 2022-06-23 13:28:16 +07:00
parent e487929304
commit 6fd46cb837
2 changed files with 22 additions and 5 deletions

View File

@ -1,4 +1,4 @@
package main package apiguess
import ( import (
"bufio" "bufio"
@ -11,6 +11,21 @@ import (
"regexp" "regexp"
) )
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
}
type regex_data struct { type regex_data struct {
Name []string `json:"Name"` Name []string `json:"Name"`
Regex string `json:"Regex"` Regex string `json:"Regex"`
@ -42,7 +57,7 @@ func Regex_api(contents string) string {
var data []regex_data var data []regex_data
var result string var result string
resp, err := http.Get("https://pastebin.com/raw/9BuLKBUG") resp, err := http.Get("https://raw.githubusercontent.com/daffainfo/apiguesser/main/db.json")
if err != nil { if err != nil {
fmt.Println(Red("No response from request")) fmt.Println(Red("No response from request"))
} }

View File

@ -3,6 +3,8 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
api "github.com/daffainfo/apiguesser/apiguess"
) )
var ( var (
@ -43,14 +45,14 @@ func main() {
if *api != "" && *path == "" && len(*api) > 3 { if *api != "" && *path == "" && len(*api) > 3 {
fmt.Println(Cyan(*api)) fmt.Println(Cyan(*api))
if Regex_api(*api) != "" { if api.Regex_api(*api) != "" {
fmt.Print(Green(Regex_api(*api))) fmt.Print(Green(api.Regex_api(*api)))
} else { } else {
fmt.Println(Red("Not Match")) fmt.Println(Red("Not Match"))
} }
} else if *api == "" && *path != "" { } else if *api == "" && *path != "" {
Regex_api_file(*path) api.Regex_api_file(*path)
} else if *api != "" || *path != "" { } else if *api != "" || *path != "" {
fmt.Println(Red("Can't call 2 arguments at once")) fmt.Println(Red("Can't call 2 arguments at once"))
} }