mirror of
https://github.com/hahwul/WebHackersWeapons.git
synced 2024-12-18 04:04:29 -05:00
(#23) Update add-tools for changed data.json format
This commit is contained in:
parent
21c5cd63c9
commit
e0c0efc022
22
add-tool.go
22
add-tool.go
@ -21,7 +21,8 @@ template
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
type Tools struct {
|
type Tools struct {
|
||||||
Type, Data, Method string
|
Type, Data, Method, Description string
|
||||||
|
Install, Update map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func isTitleElement(n *html.Node) bool {
|
func isTitleElement(n *html.Node) bool {
|
||||||
@ -52,7 +53,7 @@ func GetHtmlTitle(r io.Reader) (string, bool) {
|
|||||||
return traverse(doc)
|
return traverse(doc)
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeJSON(category string, name string, method string, data string) {
|
func writeJSON(category, name, method, data, udesc string) {
|
||||||
jsonFile, err := os.Open("data.json")
|
jsonFile, err := os.Open("data.json")
|
||||||
// if we os.Open returns an error then handle it
|
// if we os.Open returns an error then handle it
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -63,11 +64,24 @@ func writeJSON(category string, name string, method string, data string) {
|
|||||||
defer jsonFile.Close()
|
defer jsonFile.Close()
|
||||||
byteValue, _ := ioutil.ReadAll(jsonFile)
|
byteValue, _ := ioutil.ReadAll(jsonFile)
|
||||||
var result map[string]interface{}
|
var result map[string]interface{}
|
||||||
|
install := map[string]string{
|
||||||
|
"MacOS":"",
|
||||||
|
"Linux":"",
|
||||||
|
"Windows":"",
|
||||||
|
}
|
||||||
|
update := map[string]string{
|
||||||
|
"MacOS":"",
|
||||||
|
"Linux":"",
|
||||||
|
"Windows":"",
|
||||||
|
}
|
||||||
json.Unmarshal([]byte(byteValue), &result)
|
json.Unmarshal([]byte(byteValue), &result)
|
||||||
tool := Tools{
|
tool := Tools{
|
||||||
Type: category,
|
Type: category,
|
||||||
Data: data,
|
Data: data,
|
||||||
Method: method,
|
Method: method,
|
||||||
|
Description: udesc,
|
||||||
|
Install: install,
|
||||||
|
Update: update,
|
||||||
}
|
}
|
||||||
result[name] = tool
|
result[name] = tool
|
||||||
file, _ := json.MarshalIndent(result, "", " ")
|
file, _ := json.MarshalIndent(result, "", " ")
|
||||||
@ -140,7 +154,7 @@ func main() {
|
|||||||
fmt.Println("[+] What is method(e.g XSS, WVS, SSL, ETC..)?")
|
fmt.Println("[+] What is method(e.g XSS, WVS, SSL, ETC..)?")
|
||||||
method, _ := reader1.ReadString('\n')
|
method, _ := reader1.ReadString('\n')
|
||||||
method = strings.TrimRight(method, "\r\n")
|
method = strings.TrimRight(method, "\r\n")
|
||||||
writeJSON(m[choicetype], name, method, "| "+m[choicetype]+"/"+method+" | ["+name+"]("+*repourl+") | "+desc+" | ![](https://img.shields.io/github/stars"+u.Path+") | ![](https://img.shields.io/github/languages/top"+u.Path+") |")
|
writeJSON(m[choicetype], name, method, "| "+m[choicetype]+"/"+method+" | ["+name+"]("+*repourl+") | "+desc+" | ![](https://img.shields.io/github/stars"+u.Path+") | ![](https://img.shields.io/github/languages/top"+u.Path+") |", desc)
|
||||||
} else {
|
} else {
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
fmt.Println("[+] What is name?")
|
fmt.Println("[+] What is name?")
|
||||||
@ -178,7 +192,7 @@ func main() {
|
|||||||
fmt.Println("[+] What is method(e.g XSS, WVS, SSL, ETC..)?")
|
fmt.Println("[+] What is method(e.g XSS, WVS, SSL, ETC..)?")
|
||||||
method, _ := reader1.ReadString('\n')
|
method, _ := reader1.ReadString('\n')
|
||||||
method = strings.TrimRight(method, "\r\n")
|
method = strings.TrimRight(method, "\r\n")
|
||||||
writeJSON(m[choicetype], name, method, "| "+m[choicetype]+"/"+method+" | ["+name+"]("+*repourl+") | "+udesc+"|![](https://img.shields.io/static/v1?label=&message=it's not github&color=gray)|![](https://img.shields.io/static/v1?label=&message=it's not github&color=gray)")
|
writeJSON(m[choicetype], name, method, "| "+m[choicetype]+"/"+method+" | ["+name+"]("+*repourl+") | "+udesc+"|![](https://img.shields.io/static/v1?label=&message=it's not github&color=gray)|![](https://img.shields.io/static/v1?label=&message=it's not github&color=gray)",udesc)
|
||||||
}
|
}
|
||||||
|
|
||||||
if *first {
|
if *first {
|
||||||
|
Loading…
Reference in New Issue
Block a user