Change URL database
parent
e487929304
commit
6fd46cb837
|
@ -1,4 +1,4 @@
|
|||
package main
|
||||
package apiguess
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
|
@ -11,6 +11,21 @@ import (
|
|||
"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 {
|
||||
Name []string `json:"Name"`
|
||||
Regex string `json:"Regex"`
|
||||
|
@ -42,7 +57,7 @@ func Regex_api(contents string) string {
|
|||
var data []regex_data
|
||||
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 {
|
||||
fmt.Println(Red("No response from request"))
|
||||
}
|
8
main.go
8
main.go
|
@ -3,6 +3,8 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
api "github.com/daffainfo/apiguesser/apiguess"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -43,14 +45,14 @@ func main() {
|
|||
|
||||
if *api != "" && *path == "" && len(*api) > 3 {
|
||||
fmt.Println(Cyan(*api))
|
||||
if Regex_api(*api) != "" {
|
||||
fmt.Print(Green(Regex_api(*api)))
|
||||
if api.Regex_api(*api) != "" {
|
||||
fmt.Print(Green(api.Regex_api(*api)))
|
||||
} else {
|
||||
fmt.Println(Red("Not Match"))
|
||||
}
|
||||
|
||||
} else if *api == "" && *path != "" {
|
||||
Regex_api_file(*path)
|
||||
api.Regex_api_file(*path)
|
||||
} else if *api != "" || *path != "" {
|
||||
fmt.Println(Red("Can't call 2 arguments at once"))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue