Fixing color
parent
ad6db3e79a
commit
fdc7994187
|
@ -1,18 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -16,21 +16,40 @@ type regex_data struct {
|
|||
Regex string `json:"Regex"`
|
||||
}
|
||||
|
||||
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 Regex_api_file(path string) {
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Fatal(Red(err))
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
scanner := bufio.NewScanner(file)
|
||||
for scanner.Scan() {
|
||||
fmt.Println(scanner.Text())
|
||||
fmt.Println(Regex_api(scanner.Text()))
|
||||
fmt.Println(Cyan(scanner.Text()))
|
||||
if Regex_api(scanner.Text()) != "" {
|
||||
fmt.Println(Green(Regex_api(scanner.Text())))
|
||||
} else {
|
||||
fmt.Println(Red("Not match"))
|
||||
}
|
||||
}
|
||||
|
||||
if err := scanner.Err(); err != nil {
|
||||
log.Fatal(err)
|
||||
log.Fatal(Red(err))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +59,7 @@ func Regex_api(contents string) string {
|
|||
|
||||
resp, err := http.Get("https://raw.githubusercontent.com/daffainfo/apiguesser/main/db.json")
|
||||
if err != nil {
|
||||
fmt.Println("No response from request")
|
||||
fmt.Println(Red("No response from request"))
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
|
@ -48,7 +67,7 @@ func Regex_api(contents string) string {
|
|||
|
||||
var errjson = json.Unmarshal(body, &data)
|
||||
if errjson != nil {
|
||||
fmt.Println(err.Error())
|
||||
fmt.Println(Red(err.Error()))
|
||||
}
|
||||
|
||||
for i := range data {
|
||||
|
|
34
main.go
34
main.go
|
@ -7,8 +7,23 @@ 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(`
|
||||
fmt.Println(Blue(`
|
||||
_
|
||||
___ ___|_|___ ___ _ _ ___ ___ ___ ___ ___
|
||||
| .'| . | |___| . | | | -_|_ -|_ -| -_| _|
|
||||
|
@ -16,7 +31,10 @@ func show_banner() {
|
|||
|_| |___|
|
||||
|
||||
Author: Muhammad Daffa
|
||||
Version: 1.0`)
|
||||
Version: 1.0
|
||||
|
||||
Starting...
|
||||
`))
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
@ -26,12 +44,16 @@ func main() {
|
|||
flag.Parse()
|
||||
|
||||
if *api != "" && *path == "" && len(*api) > 3 {
|
||||
fmt.Println("[!] Possible Key:")
|
||||
fmt.Println(g.Regex_api(*api))
|
||||
fmt.Println(Cyan(*api))
|
||||
if g.Regex_api(*api) != "" {
|
||||
fmt.Println(Green(g.Regex_api(*api)))
|
||||
} else {
|
||||
fmt.Println(Red("Not Match"))
|
||||
}
|
||||
|
||||
} else if *api == "" && *path != "" {
|
||||
fmt.Println("[!] Possible Key:")
|
||||
g.Regex_api_file(*path)
|
||||
} else if *api != "" || *path != "" {
|
||||
fmt.Println("[X] Can't call 2 arguments at once")
|
||||
fmt.Println(Red("Can't call 2 arguments at once"))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue