This commit is contained in:
hahwul 2022-08-15 23:14:54 +09:00
parent 23377146a3
commit de533b951c
12 changed files with 1 additions and 533 deletions

View File

@ -1,67 +0,0 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '29 14 * * 4'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@ -19,3 +19,4 @@ jobs:
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
round: true
svgPath: ./images/CONTRIBUTORS.svg

View File

@ -1,33 +0,0 @@
name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build
run: make contribute

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
add-tool
distribute-readme

View File

@ -1,40 +0,0 @@
.PHONY: default help contribute add-tool distribute-readme clean
SHELL = /bin/bash
APP_NAME = WebHackersWeapons
ADD_TOOL = add-tool
DISTRIBUTE_README = distribute-readme
VERSION = $(shell git describe --always --tags)
GIT_COMMIT = $(shell git rev-parse HEAD)
GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "+CHANGES" || true)
BUILD_DATE = $(shell date '+%Y-%m-%d-%H:%M:%S')
default: help
help:
@echo 'Management commands for ${APP_NAME}:'
@echo
@echo 'Usage:'
@echo ' make contribute Compile ${ADD_TOOL} & ${DISTRIBUTE_README}.'
@echo ' make add-tool Build ${ADD_TOOL}'
@echo ' make distribute-readme Build ${DISTRIBUTE_README}'
@echo ' make clean Clean the contribute file.'
@echo
contribute: add-tool distribute-readme
add-tool:
@echo "Build ${ADD_TOOL} ${VERSION}"
@echo "GOPATH=${GOPATH}"
go build -ldflags "-w -X github.com/hahwul/WebHackersWeapons/version.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -X github.com/hahwul/WebHackersWeapons/version.Version=${VERSION} -X github.com/hahwul/WebHackersWeapons/version.BuildDate=${BUILD_DATE}" -o ./${ADD_TOOL} ./${ADD_TOOL}.go
distribute-readme:
@echo "Build ${ADD_TOOL} ${VERSION}"
@echo "GOPATH=${GOPATH}"
go build -ldflags "-w -X github.com/hahwul/WebHackersWeapons/version.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -X github.com/hahwul/WebHackersWeapons/version.Version=${VERSION} -X github.com/hahwul/WebHackersWeapons/version.BuildDate=${BUILD_DATE}" -o ./${DISTRIBUTE_README} ./${DISTRIBUTE_README}.go
clean:
@echo "Removing ${APP_NAME} ${VERSION}"
@test ! -e ${ADD_TOOL} || rm ${ADD_TOOL}
@test ! -e ${DISTRIBUTE_README} || rm ${DISTRIBUTE_README}

View File

@ -1,214 +0,0 @@
package main
import (
"bufio"
"encoding/json"
"flag"
"fmt"
"golang.org/x/net/html"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"strconv"
"strings"
)
/*
template
| [WebHackersWeapons](https://github.com/hahwul/WebHackersWeapons) | template | ![](https://img.shields.io/github/stars/hahwul/WebHackersWeapons) | ![](https://img.shields.io/github/languages/top/hahwul/WebHackersWeapons) | ![](https://img.shields.io/github/repo-size/hahwul/WebHackersWeapons)<br>![](https://img.shields.io/github/license/hahwul/WebHackersWeapons) <br> ![](https://img.shields.io/github/forks/hahwul/WebHackersWeapons) <br> ![](https://img.shields.io/github/watchers/hahwul/WebHackersWeapons) |
*/
type Tools struct {
Type, Data, Method, Description string
Install, Update map[string]string
}
func isTitleElement(n *html.Node) bool {
return n.Type == html.ElementNode && n.Data == "title"
}
func traverse(n *html.Node) (string, bool) {
if isTitleElement(n) {
return n.FirstChild.Data, true
}
for c := n.FirstChild; c != nil; c = c.NextSibling {
result, ok := traverse(c)
if ok {
return result, ok
}
}
return "", false
}
func GetHtmlTitle(r io.Reader) (string, bool) {
doc, err := html.Parse(r)
if err != nil {
panic("Fail to parse html")
}
return traverse(doc)
}
func writeJSON(category, name, method, data, udesc string) {
jsonFile, err := os.Open("data.json")
// if we os.Open returns an error then handle it
if err != nil {
fmt.Println(err)
}
fmt.Println("Successfully Opened data.json")
// defer the closing of our jsonFile so that we can parse it later on
defer jsonFile.Close()
byteValue, _ := ioutil.ReadAll(jsonFile)
var result map[string]interface{}
install := map[string]string{
"MacOS":"",
"Linux":"",
"Windows":"",
}
update := map[string]string{
"MacOS":"",
"Linux":"",
"Windows":"",
}
json.Unmarshal([]byte(byteValue), &result)
tool := Tools{
Type: category,
Data: data,
Method: method,
Description: udesc,
Install: install,
Update: update,
}
if result[name] != nil {
resultData := result[name].(map[string]interface{})
resultInstall := resultData["Install"].(map[string]interface{})
resultUpdate := resultData["Update"].(map[string]interface{})
tool.Install["MacOS"] = resultInstall["MacOS"].(string)
tool.Install["Linux"] = resultInstall["Linux"].(string)
tool.Install["Windows"] = resultInstall["Windows"].(string)
tool.Update["MacOS"] = resultUpdate["MacOS"].(string)
tool.Update["Linux"] = resultUpdate["Linux"].(string)
tool.Update["Windows"] = resultUpdate["Windows"].(string)
}
result[name] = tool
file, _ := json.MarshalIndent(result, "", " ")
_ = ioutil.WriteFile("data.json", file, 0644)
}
func main() {
repourl := flag.String("url", "", "any url")
first := flag.Bool("isFirst", false, "if you add new type, it use")
flag.Parse()
if flag.NFlag() == 0 {
flag.Usage()
return
}
u, err := url.Parse(*repourl)
if err != nil {
panic(err)
}
if u.Host == "github.com" {
//fmt.Println(u.Path)
name := strings.Split(u.Path, "/")[2]
//fmt.Println(name)
desc := "asdf"
resp, err := http.Get(*repourl)
if err != nil {
panic(err)
}
defer resp.Body.Close()
if title, ok := GetHtmlTitle(resp.Body); ok {
if strings.Contains(string(title), ": ") {
desc = strings.Split(string(title), ": ")[1]
} else {
reader1 := bufio.NewReader(os.Stdin)
fmt.Println("[+] Don't have descriptions / input description")
a, _ := reader1.ReadString('\n')
desc = strings.TrimRight(a, "\r\n")
}
} else {
println("Fail to get HTML title")
}
typeFile, err := os.Open("type.lst")
// if we os.Open returns an error then handle it
if err != nil {
fmt.Println(err)
}
fmt.Println("Successfully Opened type.lst")
// defer the closing of our jsonFile so that we can parse it later on
defer typeFile.Close()
index := 0
m := make(map[int]string)
reader := bufio.NewReader(typeFile)
for {
line, isPrefix, err := reader.ReadLine()
if isPrefix || err != nil {
break
}
m[index] = string(line)
fmt.Println("[" + strconv.Itoa(index) + "] " + string(line))
index = index + 1
}
var choicetype int
fmt.Println("[+] What is type?")
_, err = fmt.Scan(&choicetype)
fmt.Println(m[choicetype])
reader1 := bufio.NewReader(os.Stdin)
fmt.Println("[+] What is method(e.g XSS, WVS, SSL, ETC..)?")
method, _ := reader1.ReadString('\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+") |", desc)
} else {
reader := bufio.NewReader(os.Stdin)
fmt.Println("[+] What is name?")
name, _ := reader.ReadString('\n')
name = strings.TrimRight(name, "\r\n")
fmt.Println("[+] Input Description?")
udesc, _ := reader.ReadString('\n')
udesc = strings.TrimRight(udesc, "\r\n")
typeFile, err := os.Open("type.lst")
// if we os.Open returns an error then handle it
if err != nil {
fmt.Println(err)
}
fmt.Println("Successfully Opened type.lst")
// defer the closing of our jsonFile so that we can parse it later on
defer typeFile.Close()
index := 0
m := make(map[int]string)
readerF := bufio.NewReader(typeFile)
for {
line, isPrefix, err := readerF.ReadLine()
if isPrefix || err != nil {
break
}
m[index] = string(line)
fmt.Println("[" + strconv.Itoa(index) + "] " + string(line))
index = index + 1
}
var choicetype int
fmt.Println("What is type?")
_, err = fmt.Scan(&choicetype)
fmt.Println(m[choicetype])
reader1 := bufio.NewReader(os.Stdin)
fmt.Println("[+] What is method(e.g XSS, WVS, SSL, ETC..)?")
method, _ := reader1.ReadString('\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%20not%20github&color=gray)|![](https://img.shields.io/static/v1?label=&message=it's%20not%20github&color=gray)",udesc)
}
if *first {
fmt.Println("| Type | Name | Description | Popularity | Language |")
fmt.Println("| ---------- | :---------- | :----------: | :----------: | :----------: |")
}
//fmt.Println("| [" + name + "](" + *repourl + ") | " + desc + " | ![](https://img.shields.io/github/stars" + u.Path + ") | ![](https://img.shields.io/github/languages/top" + u.Path + ") | ![](https://img.shields.io/github/repo-size" + u.Path + ")<br>![](https://img.shields.io/github/license" + u.Path + ") <br> ![](https://img.shields.io/github/forks" + u.Path + ") <br> ![](https://img.shields.io/github/watchers" + u.Path + ") |")
}

View File

@ -1,147 +0,0 @@
package main
import (
"bufio"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"reflect"
"sort"
"strings"
au "github.com/logrusorgru/aurora"
)
type mmm = map[string]interface{}
func mergeKeys(left, right mmm) mmm {
for key, rightVal := range right {
if leftVal, present := left[key]; present {
//then we don't want to replace it - recurse
left[key] = mergeKeys(leftVal.(mmm), rightVal.(mmm))
} else {
// key not in left so we can just shove it in
left[key] = rightVal
}
}
return left
}
func main() {
typeFile, err := os.Open("type.lst")
// if we os.Open returns an error then handle it
if err != nil {
fmt.Println(err)
}
fmt.Println("Successfully Opened type.lst")
// defer the closing of our jsonFile so that we can parse it later on
defer typeFile.Close()
index := 0i
m := make(map[string]interface{})
readerF := bufio.NewReader(typeFile)
for {
line, isPrefix, err := readerF.ReadLine()
if isPrefix || err != nil {
break
}
strings.TrimRight(string(line), "\r\n")
//m[string(line)] = ""
index = index + 1
}
fmt.Println(m)
dataJson, err := os.Open("data.json")
// if we os.Open returns an error then handle it
if err != nil {
fmt.Println(err)
}
fmt.Println("Successfully Opened data.json")
// defer the closing of our dataJson so that we can parse it later on
defer dataJson.Close()
byteValue, _ := ioutil.ReadAll(dataJson)
var result map[string]interface{}
json.Unmarshal([]byte(byteValue), &result)
//result[name] = tool
for k, v := range result {
myMap := v.(map[string]interface{})
t := myMap["Type"].(string)
d := myMap["Data"].(string)
mt := myMap["Method"].(string)
_ = d
_ = mt
tool := make(map[string]interface{})
tool[k] = d
fmt.Println(m[t+"/"+mt])
//fmt.Println(reflect.TypeOf(m[t+"/"+mt]).String())
//if reflect.TypeOf(m[t+"/"+mt]).String() == "string" {
if m[t+"/"+mt] == nil {
m[t+"/"+mt] = tool
} else {
tool = mergeKeys(tool, m[t+"/"+mt].(map[string]interface{}))
//fmt.Println(tool)
m[t+"/"+mt] = tool
}
}
readme := "| Type | Name | Description | Popularity | Language |\r\n| ---------- | :---------- | :----------: | :----------: | :----------: | \r\n"
keys := []string{}
for key := range m {
keys = append(keys, key)
}
sort.Strings(keys)
for _, dat := range keys {
vv := m[dat]
keys := []string{}
_ = keys
if vv != nil && reflect.TypeOf(vv).String() != "string" {
v := vv.(map[string]interface{})
for key := range v {
keys = append(keys, key)
}
sort.Strings(keys)
}
for _, val := range keys {
if reflect.TypeOf(val).String() != "string" {
} else {
vd := vv.(map[string]interface{})[val]
readme = readme + vd.(string) + "\r\n"
}
}
}
fmt.Println(readme)
top, err := os.Open("template/head.md")
if err != nil {
fmt.Println(err)
}
defer dataJson.Close()
head_data, _ := ioutil.ReadAll(top)
foot, err := os.Open("template/foot.md")
if err != nil {
fmt.Println(err)
}
defer dataJson.Close()
foot_data, _ := ioutil.ReadAll(foot)
readme = string(head_data) + readme + string(foot_data)
fmt.Println("======================result====================")
//fmt.Println(readme)
file, err := os.OpenFile(
"README.md",
os.O_CREATE|os.O_RDWR|os.O_TRUNC,
os.FileMode(0644))
if err != nil {
fmt.Println(err)
return
}
defer file.Close()
_, err = file.Write([]byte(readme))
if err != nil {
fmt.Println(err)
return
}
fmt.Println("[+] Patched README.md file")
fmt.Println("[+] Please check README file and git push")
fmt.Println("[ copy/paste this ] ", au.BrightYellow("git add data.json README.md ; git commit -m 'distribute readme'; git push"))
}

9
go.mod
View File

@ -1,9 +0,0 @@
module github.com/hahwul/WebHackerWeapons
go 1.16
require (
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/logrusorgru/aurora/v3 v3.0.0 // indirect
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4
)

11
go.sum
View File

@ -1,11 +0,0 @@
github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8=
github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
github.com/logrusorgru/aurora/v3 v3.0.0 h1:R6zcoZZbvVcGMvDCKo45A9U/lzYyzl5NfYIvznmDfE4=
github.com/logrusorgru/aurora/v3 v3.0.0/go.mod h1:vsR12bk5grlLvLXAYrBsb5Oc/N+LxAlxggSjiwMnCUc=
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

View File

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

View File

@ -1,4 +0,0 @@
| Type | Method | Name | Description | Popularity | Language |
| ---------- | :---------- | :---------- | :---------- | :----------: | :----------: |
| Army-Knife | WVS | [WebHackersWeapons](https://github.com/hahwul/WebHackersWeapons) | Web Hacker's Weapons / A collection of cool tools used by Web hackers. Happy hacking , Happy bug-hunting | ![](https://img.shields.io/github/stars/hahwul/WebHackersWeapons) | ![](https://img.shields.io/github/languages/top/hahwul/WebHackersWeapons) |
| Discovery | Clipboard | [Google](https://google.com) | Search engine|it's | github:dog:|"

View File

@ -1,6 +0,0 @@
Army-Knife
Discovery
Fetch
Scanner
ToolBox
Utility