Replace color func
parent
b0c4492cc7
commit
ad6db3e79a
|
@ -0,0 +1,18 @@
|
|||
package color
|
||||
|
||||
import "fmt"
|
||||
|
||||
var (
|
||||
Red = Color("\033[1;31m%s\033[0m")
|
||||
Green = Color("\033[1;32m%s\033[0m")
|
||||
Blue = Color("\033[1;33m%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
|
||||
}
|
|
@ -26,7 +26,7 @@ func Regex_api_file(path string) {
|
|||
scanner := bufio.NewScanner(file)
|
||||
for scanner.Scan() {
|
||||
fmt.Println(scanner.Text())
|
||||
Regex_api(scanner.Text())
|
||||
fmt.Println(Regex_api(scanner.Text()))
|
||||
}
|
||||
|
||||
if err := scanner.Err(); err != nil {
|
||||
|
@ -34,8 +34,9 @@ func Regex_api_file(path string) {
|
|||
}
|
||||
}
|
||||
|
||||
func Regex_api(contents string) {
|
||||
func Regex_api(contents string) string {
|
||||
var data []regex_data
|
||||
var result string
|
||||
|
||||
resp, err := http.Get("https://raw.githubusercontent.com/daffainfo/apiguesser/main/db.json")
|
||||
if err != nil {
|
||||
|
@ -53,7 +54,8 @@ func Regex_api(contents string) {
|
|||
for i := range data {
|
||||
re := regexp.MustCompile(data[i].Regex)
|
||||
if re.MatchString(contents) {
|
||||
fmt.Println(data[i].Name)
|
||||
result = data[i].Name
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
|
22
main.go
22
main.go
|
@ -7,21 +7,6 @@ import (
|
|||
g "github.com/daffainfo/apiguesser/guesser"
|
||||
)
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
func show_banner() {
|
||||
fmt.Println(`
|
||||
_
|
||||
|
@ -41,11 +26,12 @@ func main() {
|
|||
flag.Parse()
|
||||
|
||||
if *api != "" && *path == "" && len(*api) > 3 {
|
||||
fmt.Println("Possible API Key:")
|
||||
g.Regex_api(*api)
|
||||
fmt.Println("[!] Possible Key:")
|
||||
fmt.Println(g.Regex_api(*api))
|
||||
} else if *api == "" && *path != "" {
|
||||
fmt.Println("[!] Possible Key:")
|
||||
g.Regex_api_file(*path)
|
||||
} else if *api != "" || *path != "" {
|
||||
fmt.Println("Can't call 2 arguments at once")
|
||||
fmt.Println("[X] Can't call 2 arguments at once")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue