WebHackersWeapons/scripts/erb.rb

249 lines
7.4 KiB
Ruby
Raw Normal View History

require 'erb'
2022-08-16 12:11:14 -04:00
require 'yaml'
2022-08-17 10:05:58 -04:00
def generate_badge array
badge = ""
array.each { |t|
case t
when 'linux'
2022-10-07 11:33:25 -04:00
badge = badge + "![linux](/images/linux.png)"
2022-08-17 10:05:58 -04:00
when 'windows'
2022-10-07 11:33:25 -04:00
badge = badge + "![windows](/images/windows.png)"
2022-08-17 10:05:58 -04:00
when 'macos'
2022-10-07 11:33:25 -04:00
badge = badge + "![macos](/images/apple.png)"
2022-08-17 10:05:58 -04:00
when 'firefox'
2022-10-07 11:33:25 -04:00
badge = badge + "![firefox](/images/firefox.png)"
2022-08-17 10:05:58 -04:00
when 'safari'
2022-10-07 11:33:25 -04:00
badge = badge + "![safari](/images/safari.png)"
2022-08-17 10:05:58 -04:00
when 'chrome'
2022-10-07 11:33:25 -04:00
badge = badge + "![chrome](/images/chrome.png)"
2022-08-17 10:27:51 -04:00
when 'burpsuite'
2022-10-07 11:33:25 -04:00
badge = badge + "![burp](/images/burp.png)"
2024-07-24 10:32:02 -04:00
when 'caido'
badge = badge + "![caido](/images/caido.png)"
2022-08-17 10:27:51 -04:00
when 'zap'
2022-10-07 11:33:25 -04:00
badge = badge + "![zap](/images/zap.png)"
2022-08-17 10:05:58 -04:00
end
}
return badge
2022-08-16 12:11:14 -04:00
end
2022-08-17 12:04:58 -04:00
def generate_tags array
tags = ""
array.each { |t|
tags = tags + "`#{t}` "
}
return tags
end
2022-10-07 11:14:55 -04:00
categorize_template_tags = %q{
## Tools for <%= @ct_tag %>
<%= @ct_head %>
<%= @ct_data %>
}.gsub(/^ /, '')
categorize_template_langs = %q{
2022-10-07 11:35:45 -04:00
## Tools Made of <%= @ct_lang %>
2022-10-07 11:14:55 -04:00
<%= @ct_head %>
<%= @ct_data %>
}.gsub(/^ /, '')
template = %q{
<h1 align="center">
<br>
<a href=""><img src="https://user-images.githubusercontent.com/13212227/104400969-9f3d9280-5596-11eb-80f4-864effae95fc.png" alt="" width="500px;"></a>
<br>
<img src="https://img.shields.io/github/last-commit/hahwul/WebHackersWeapons?style=flat">
<img src="https://img.shields.io/badge/PRs-welcome-cyan">
<img src="https://github.com/hahwul/WebHackersWeapons/actions/workflows/cd.yml/badge.svg">
<a href="https://twitter.com/intent/follow?screen_name=hahwul"><img src="https://img.shields.io/twitter/follow/hahwul?style=flat&logo=twitter"></a>
</h1>
2022-08-16 07:48:09 -04:00
A collection of awesome tools used by Web hackers. Happy hacking , Happy bug-hunting
## Family project
[![WebHackersWeapons](https://img.shields.io/github/stars/hahwul/WebHackersWeapons?label=WebHackersWeapons)](https://github.com/hahwul/WebHackersWeapons)
[![MobileHackersWeapons](https://img.shields.io/github/stars/hahwul/MobileHackersWeapons?label=MobileHackersWeapons)](https://github.com/hahwul/MobileHackersWeapons)
## Table of Contents
- [Weapons](#weapons)
2022-08-17 10:30:21 -04:00
- [Tools](#tools)
- [Bookmarklets](#bookmarklets)
- [Browser Addons](#browser-addons)
- [Burp and ZAP Addons](#burpsuite-and-zap-addons)
- [Contribute](CONTRIBUTING.md)
- [Thanks to contributor](#thanks-to-contributor)
2022-08-16 07:48:09 -04:00
## Weapons
2022-08-19 01:33:44 -04:00
*Attributes*
| | Attributes |
|-------|---------------------------------------------------|
2022-09-16 04:44:36 -04:00
| Types | `Army-Knife` `Proxy` `Recon` `Fuzzer` `Scanner` `Exploit` `Env` `Utils` `Etc`|
2022-08-19 01:33:44 -04:00
| Tags | <%= tags.uniq.join ' ' %> |
| Langs | <%= langs.uniq.join ' ' %> |
2022-08-17 10:48:01 -04:00
2022-08-16 07:48:09 -04:00
### Tools
<%= tools %>
2022-08-16 07:48:09 -04:00
### Bookmarklets
<%= bookmarklets %>
### Browser Addons
<%= browser_addons %>
### Burpsuite and ZAP Addons
2022-08-16 12:11:14 -04:00
<%= tool_addons %>
## Thanks to (Contributor)
2022-08-19 10:55:56 -04:00
WHW's open-source project and made it with if you want contribute this project, please see [CONTRIBUTING.md](https://github.com/hahwul/WebHackersWeapons/blob/main/CONTRIBUTING.md) and Pull-Request with cool your contents.
[![](/images/CONTRIBUTORS.svg)](https://github.com/hahwul/WebHackersWeapons/graphs/contributors)
}.gsub(/^ /, '')
2022-08-16 12:11:14 -04:00
2022-08-19 01:33:44 -04:00
tags = []
langs = []
2022-10-07 11:14:55 -04:00
categorize_tags = {}
categorize_langs = {}
2022-08-19 01:33:44 -04:00
head = "| Type | Name | Description | Star | Tags | Badges |\n"
head = head + "| --- | --- | --- | --- | --- | --- |"
2022-08-16 12:11:14 -04:00
tools = head + "\n"
bookmarklets = head + "\n"
browser_addons = head + "\n"
tool_addons = head + "\n"
2022-08-19 01:33:44 -04:00
weapons = []
weapons_obj = {
2022-08-19 03:26:26 -04:00
"army-knife" => [],
"proxy" => [],
2022-08-19 01:33:44 -04:00
"recon"=> [],
"fuzzer"=> [],
"scanner"=> [],
"exploit"=> [],
"utils"=> [],
"etc"=> []
}
2022-08-16 12:11:14 -04:00
Dir.entries("./weapons/").each do | name |
2022-08-17 10:33:50 -04:00
if name != '.' && name != '..'
begin
data = YAML.load(File.open("./weapons/#{name}"))
2022-10-07 11:14:55 -04:00
2022-08-19 01:33:44 -04:00
if data['type'] != "" && data['type'] != nil
if weapons_obj[data['type'].downcase] != nil
2022-10-07 11:14:55 -04:00
weapons_obj[data['type'].downcase].push data
else
weapons_obj[data['type'].downcase] = []
weapons_obj[data['type'].downcase].push data
end
2022-08-17 10:33:50 -04:00
else
2022-08-19 01:33:44 -04:00
weapons_obj['etc'].push data
2022-08-17 10:33:50 -04:00
end
rescue => e
2022-08-17 10:33:50 -04:00
puts e
2022-08-16 12:11:14 -04:00
end
end
end
2022-10-07 11:14:55 -04:00
2022-08-19 01:33:44 -04:00
weapons_obj.each do |key,value|
weapons.concat value
end
weapons.each do | data |
begin
name = data['name']
temp_tags = []
begin
data['tags'].each do |t|
2022-10-07 11:23:32 -04:00
temp_tags.push "[`#{t}`](/categorize/tags/#{t}.md)"
end
tags.concat temp_tags
rescue
2022-08-19 01:33:44 -04:00
end
lang_badge = ""
begin
if data['lang'].length > 0 && data['lang'] != "null"
2022-11-25 10:54:38 -05:00
langs.push "[`#{data['lang']}`](/categorize/langs/#{data['lang'].gsub('#','%23')}.md)"
lang_badge = "[![#{data['lang']}](/images/#{data['lang'].downcase.gsub('#','%23')}.png)](/categorize/langs/#{data['lang'].gsub('#','%23')}.md)"
end
rescue
2022-08-19 01:33:44 -04:00
end
2022-08-19 01:33:44 -04:00
popularity = ""
if data['url'].length > 0
2022-08-19 01:33:44 -04:00
name = "[#{name}](#{data['url']})"
end
if data['url'].include? "github.com"
split_result = data['url'].split "//github.com/"
popularity = "![](https://img.shields.io/github/stars/#{split_result[1]}?label=%20)"
end
badge = generate_badge(data['platform'])
line = "|#{data['type']}|#{name}|#{data['description']}|#{popularity}|#{temp_tags.join ' '}|#{badge}#{lang_badge}|"
case data['category'].downcase
2022-08-19 01:33:44 -04:00
when 'tool'
tools = tools + line + "\n"
when 'tool-addon'
tool_addons = tool_addons + line + "\n"
when 'browser-addon'
browser_addons = browser_addons + line + "\n"
when 'bookmarklet'
bookmarklets = bookmarklets + line + "\n"
else
puts name
end
2022-10-07 11:14:55 -04:00
tmp_lang = data['lang']
tmp_tags = data['tags']
if tmp_tags != nil
2022-10-07 11:14:55 -04:00
tmp_tags.each do |t|
if categorize_tags[t] == nil
categorize_tags[t] = line + "\n"
else
categorize_tags[t] = categorize_tags[t] + line + "\n"
end
end
end
2022-10-07 11:14:55 -04:00
if tmp_lang != nil
if categorize_langs[tmp_lang] == nil
2022-10-07 11:14:55 -04:00
categorize_langs[tmp_lang] = line + "\n"
else
categorize_langs[tmp_lang] = categorize_langs[tmp_lang] + line + "\n"
end
end
rescue => e
2022-08-19 01:33:44 -04:00
puts e
end
end
markdown = ERB.new(template, trim_mode: "%<>")
2022-08-17 10:15:01 -04:00
#puts markdown.result
File.write './README.md', markdown.result
2022-10-07 11:14:55 -04:00
categorize_tags.each do |key,value|
if key != nil && key != ""
@ct_tag = key
@ct_head = head + "\n"
@ct_data = value
tag_markdown = ERB.new(categorize_template_tags, trim_mode: "%<>")
File.write "./categorize/tags/#{@ct_tag}.md", tag_markdown.result
end
end
categorize_langs.each do |key,value|
if key != nil && key != ""
2022-10-07 11:14:55 -04:00
@ct_lang = key
@ct_head = head + "\n"
@ct_data = value
lang_markdown = ERB.new(categorize_template_langs, trim_mode: "%<>")
File.write "./categorize/langs/#{@ct_lang}.md", lang_markdown.result
end
end