modulepackage
0.0.0-20240704015121-d68ab2b17a03
Repository: https://github.com/ghosttroops/go-utils.git
Documentation: pkg.go.dev
# README
go-utils
# Functions
int to hex string.
No description provided by the author
追加到文件中.
No description provided by the author
异步执行命令.
No description provided by the author
big int to hex, base is 16.
使用 UnBrotli 解码
*/.
No description provided by the author
Catch Panic
in your func: defer CatchPanic().
No description provided by the author
头信息同一检查,并调用合适到go poc进一步爆破、检测
1、需要认证 2、shiro.
检查 蜜罐 Server信息,check Honeypor server info.
Check for HTTP proxy.
No description provided by the author
No description provided by the author
No description provided by the author
Check for KCP server.
避免重复,并设置标记.
检查 cookie Shiro CVE_2016_4437 cookie 其他POC cookie同一检查入口.
Check for sockss proxy.
Check for socks5 proxy.
No description provided by the author
关闭数据库连接.
关闭所有资源.
No description provided by the author
关闭cache.
go tool pprof -seconds=120 -http=:9999 http://65.49.202.211:8080/debug/pprof/heap.
No description provided by the author
No description provided by the author
No description provided by the author
兼容hacker one 域名表示方式,以下格式支持 *.xxx.com *.xxx.xx1.*.
数字转换为 "Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"
*/.
拷贝配置信息到o中.
通用,insert.
压缩多个文件
d 为 map[string][]byte{文件名1:文件内容1,文件名2:文件内容2,}
var mJar = map[string][]byte{
"buildServerResources/" + pluginName + ".jsp": X3Jsp}
// pluginName+".zip"
var mZip = map[string][]byte{
"buildServerResources/" + pluginName + ".jsp": X3Jsp,
"server/" + pluginName + ".jar": CreateZip(mJar),
"teamcity-plugin.xml": []byte(`?xml version="1.0" encoding="UTF-8"?>
<teamcity-plugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:schemas-jetbrains-com:teamcity-plugin-v1-xml">
<info>
<name>` + pluginName + `</name>
<display-name>` + pluginName + `</display-name>
<description>South rise such since land project enough.</description>
<version>1.0</version>
<vendor>
<name>Salas, Smith and Williams</name>
<url>http://meza-smith.biz/</url>
</vendor>
</info>
<deployment use-separate-classloader="true" node-responsibilities-aware="true"/>
</teamcity-plugin>`),
}
var data = CreateZip(mZip)
*/.
convert any Object to T.
Decode decodes the input from base64 It can optionally unzip the input after decoding.
detect http、socks5 proxy
*/.
No description provided by the author
body中开发商信息提取.
No description provided by the author
最佳的方法是将命令写到临时文件,并通过bash进行执行.
通用的、常规小工具参数接收和处理 接收命令行 os.Args[1:] 接收管道命令,按行输入.
通用的、常规小工具参数接收和处理 接收命令行 os.Args[1:] 接收管道命令,按行输入.
延时清理.
处理目录遍历.
初始化
1、读取配置文件 2、驱动执行 其他初始化注册的func.
这个方法必须显示 调用 否则可能会在其他init之前调用,导致初始化失效.
1、检测 $HOME/MyWork/log4j-scan 存在就执行 python3 版本log4j检测 2、相同目标只执行一次,基于内存缓存 3、只支持:https://github.com/hktalent/log4j-scan 版本.
立刻执行.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
执行自定义查询.
No description provided by the author
异步执行方法,只适合无返回值、或使用管道返回值的方法 程序main整体等待.
通用的获取数据的方法.
No description provided by the author
No description provided by the author
Encode encodes the input in base64 It can optionally zip the input before encoding.
将 config 释放 到 szPath 目录中.
翻译中文
*/.
le :en,fr,ko,ja
*/.
No description provided by the author
文件转 16进制字符串.
判断文件是否存在.
No description provided by the author
No description provided by the author
生成count个[start,end)结束的不重复的随机数
可以在一次会话中随机生成62个数字,构建 62 进制字符串模版.
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/base64"
"encoding/pem"
"fmt"
)
func main() {
// 生成一个4096位RSA密钥对
privateKey, err := rsa.GenerateKey(rand.Reader, 4096)
if err != nil {
panic(err)
}
// 将私钥编码成DER格式
derPrivateKey := x509.MarshalPKCS1PrivateKey(privateKey)
// 将DER格式的私钥转换为PEM格式
pemPrivateKey := pem.EncodeToMemory(&pem.Block{
Type: "RSA PRIVATE KEY",
Bytes: derPrivateKey,
})
// 将公钥编码成DER格式
derPublicKey, err := x509.MarshalPKIXPublicKey(&privateKey.PublicKey)
if err != nil {
panic(err)
}
// 将DER格式的公钥转换为PEM格式
pemPublicKey := pem.EncodeToMemory(&pem.Block{
Type: "RSA PUBLIC KEY",
Bytes: derPublicKey,
})
// 输出Base64格式的密钥对
fmt.Println(base64.StdEncoding.EncodeToString([]byte(input + string(pemPrivateKey) + string(pemPublicKey))))
}
*/
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/base64"
"encoding/pem"
"fmt"
)
func main() {
// 生成一个4096位RSA密钥对
privateKey, err := rsa.GenerateKey(rand.Reader, 4096)
if err != nil {
panic(err)
}
// 将私钥编码成DER格式
derPrivateKey := x509.MarshalPKCS1PrivateKey(privateKey)
// 将DER格式的私钥转换为PEM格式
pemPrivateKey := pem.EncodeToMemory(&pem.Block{
Type: "RSA PRIVATE KEY",
Bytes: derPrivateKey,
})
// 将公钥编码成DER格式
derPublicKey, err := x509.MarshalPKIXPublicKey(&privateKey.PublicKey)
if err != nil {
panic(err)
}
// 将DER格式的公钥转换为PEM格式
pemPublicKey := pem.EncodeToMemory(&pem.Block{
Type: "RSA PUBLIC KEY",
Bytes: derPublicKey,
})
// 输出Base64格式的密钥对
fmt.Println(base64.StdEncoding.EncodeToString([]byte(inputStr + string(pemPrivateKey) + string(pemPublicKey))))
}
*/.
获取当前 mac 地址 hex 格式,可以作为 51pwn.com 的前缀.
获取本机互联网ip.
127.0.0.1:0 实现动态端口,避免端口被占用的情况 :0 也可以.
No description provided by the author
No description provided by the author
获取interface.
获取缓存对象.
No description provided by the author
No description provided by the author
No description provided by the author
通用 求T类型count,支持条件 对T表,mod类型表,args 的where求count.
4.CPU使用率.
获取当前ip
*/.
通过cloudflare 获取自己当前互联网 ip.
X-Forwarded-Host: 127.0.0.1
X-Forwarded-For: 127.0.0.1
X-Originating-IP: 127.0.0.1
X-Remote-IP: 127.0.0.1
X-Remote-Addr: 127.0.0.1
X-Client-IP: 127.0.0.1
X-Host: 127.0.0.1
*/ 获取 自定义头信息等raw模式.
No description provided by the author
No description provided by the author
3.磁盘信息.
domain opType 0 all type,1 ipv4,2 ipv6.
No description provided by the author
No description provided by the author
map[ad_info:map[adcode:510105 city:成都市 district:xxx nation:中国 province:四川省] ip:117.76.248.175 location:map[lat:30.67485 lng:104.06291]]*
{
"ip": "117.176.248.75",
"network": "117.176.240.0/20",
"version": "IPv4",
"city": "Chengdu",
"region": "Sichuan",
"region_code": "SC",
"country": "CN",
"country_name": "China",
"country_code": "CN",
"country_code_iso3": "CHN",
"country_capital": "Beijing",
"country_tld": ".cn",
"continent_code": "AS",
"in_eu": false,
"postal": null,
"latitude": 30.6498,
"longitude": 104.0555,
"timezone": "Asia/Shanghai",
"utc_offset": "+0800",
"country_calling_code": "+86",
"currency": "CNY",
"currency_name": "Yuan Renminbi",
"languages": "zh-CN,yue,wuu,dta,ug,za",
"country_area": 9596960.0,
"country_population": 1411778724,
"asn": "AS9808",
"org": "China Mobile Communications Group Co., Ltd."
}
*/.
No description provided by the author
2.主机信息.
当前ip,自动跳过socks proxy X-Limit: current_qps=1; limit_qps=50; current_pv=10197; limit_pv=1000000.
No description provided by the author
No description provided by the author
get ip location.
获取domain的所有ip.
for github.com/itchyny/gojq.
itchyny/gojq.
No description provided by the author
1.主机IP.
https://www.ipplus360.com/getLocation.
No description provided by the author
No description provided by the author
5.内存信息.
获取一个内存对象
如果c不是nil,就不再创建新的.
6.获取网卡信息.
7.计算上下行带宽.
No description provided by the author
No description provided by the author
通用 查询返回T类型、表一条数据.
Get the Internet egress ip of the current machine.
key 标识不同用户,对等的p2p.
get 连接手机的 gps adb shell dumpsys location.
No description provided by the author
get your public ip auto skip proxy.
随机模版.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
获取 Sha1.
获取简单命令行输入.
获取字符串的hash.
通用 查询模型T1类型 mode,并关联T1类型对子类型T3 preLd 设置 nPageSize 和便宜Offset 以及其他查询条件conds.
通用 查询模型T1类型 mode,并关联T1类型对子类型T3 preLd 设置 nPageSize 和便宜Offset 以及其他查询条件conds.
通用 获取T类型mod表名.
No description provided by the author
No description provided by the author
临时结果文件,例如 nmap.
获取 a 类型,并合并到 nSrc 返回.
获取类型.
No description provided by the author
No description provided by the author
No description provided by the author
获取http 响应头信息,并跟踪进入location跳转 获取url header 信息 默认移除 X-Cache-Hits,X-Cache,Via,Traceparent,Server-Timing,Strict-Transport-Security,Date,Paypal-Debug-Id,Set-Cookie,Etag,Content-Type,X-Timer,Accept-Ranges,Cache-Control,X-Xss-Protection,Vary,content-type,etag,paypal-debug-id,set-cookie,traceparent,X-Content-Type-Options,accept-ranges,via,date,strict-transport-security,x-served-by,x-cache,x-cache-hits,x-timer,server-timing,content-length.
获取http 响应头信息,并跟踪进入location跳转
rmHds 可以设置移除 X-Cache-Hits,X-Cache,Via,Traceparent,Server-Timing,Strict-Transport-Security,Date,Paypal-Debug-Id,Set-Cookie,Etag,Content-Type,X-Timer,Accept-Ranges,Cache-Control,X-Xss-Protection,Vary,content-type,etag,paypal-debug-id,set-cookie,traceparent,X-Content-Type-Options,accept-ranges,via,date,strict-transport-security,x-served-by,x-cache,x-cache-hits,x-timer,server-timing,content-length.
优先使用配置文件中的配置,否则从环境变量中读取.
其他类型.
读区配置中的字典文件.
读区配置中的字典文件.
No description provided by the author
获取配置为bool.
No description provided by the author
获取配置为int.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
16进制 字符串 转byte.
添加蜜罐检测,并自动跳过目标,默认false跳过蜜罐检测 考虑内存缓存结果.
需要考虑缓存
1、缓解网络不好的情况 2、缓存有效期为当天 3、缓存命中需和请求的数据完全匹配.
http密码爆破.
初始化数据库对象,默认文件数据库 go - 交叉编译go-sqlite3 https://www.modb.pro/db/329524 ./tools/Check_CVE_2020_26134 -config="/Users/51pwn/MyWork/mybugbounty/allDomains.txt" 获取Gorm db连接、操作对象.
初始化到开头.
初始化配置文件信息,这个必须先执行.
初始化client cache.
初始化配置文件信息,这个必须先执行.
No description provided by the author
初始化模型.
判断 i 是否存在slice中.
big int to Ip.
big int to ip(v6) string.
ipv4 to bigint ipv6 to bigint.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
判断对象是否为struct.
No description provided by the author
加载配置文件.
No description provided by the author
格式化 map 并返回 str.
No description provided by the author
Merge multiple channels from type Result.
多个对象合并.
若干参数依赖注入到对象 obj中
util.MergeParms2Obj(&ms, args...) 使用 inject 注入 struct 需要注意的时,每个inject的类型不一样,如果一样的,必须使用类型别名,否则盲注会出问题.
No description provided by the author
修改struct 对象 私有成员.
准备要检测、链接带目标 需要考虑 ssl的情况.
No description provided by the author
No description provided by the author
获取一个.
No description provided by the author
New creates a SizedWaitGroup.
调用浏览器 打开url.
map format out.
Pack32BinaryIP4("127.0.0.1") 7f000001 Pack32BinaryIP4("192.168.0.1") c0a80001.
利用各种格式自动解析.
从配置json中读取naabu、httpx、nuclei等的细化配置.
No description provided by the author
将该方法放到方法中运行,就可以打印出所有调用该方法的链路出来.
Print results as JSON or plain.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
下一步计划:加载osvdb 并驱动执行.
No description provided by the author
读取多个文件,按行返回.
No description provided by the author
读取命令行管道输入.
读取流,逐行 cbk 为什么这样封装?因为基于buf的行受限长度.
No description provided by the author
注册延时清理
n0 0表示60秒后执行.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Remove duplicates from a channel and return a channel from type Result.
Remove duplicate strings.
No description provided by the author
No description provided by the author
No description provided by the author
移除不要的key.
移除空的、无效的值
*/.
k is id.
一定得有全局得线程等待.
No description provided by the author
记录日志到 大数据搜索引擎.
1、优化代码,统一结果输出,便于维护.
发送数据到ES.
全局设置header.
设置map格式的header.
发送通讯信号.
判断 i 是否存在slice中.
No description provided by the author
数组去重.
string big int to big int If the string input tosetString() starts with “0x” base 16 (hexadecimal) will be used.
No description provided by the author
字符转换 'open -a Calculator' to ${T(java.lang.Runtime).getRuntime().exec(new String(new byte[]{0x6f,0x70,0x65,0x6e,0x20,0x2d,0x61,0x20,0x43,0x61,0x6c,0x63,0x75,0x6c,0x61,0x74,0x6f,0x72}))}.
No description provided by the author
字符串包含关系,且大小写不敏感.
判断 str 是否存在slice中.
No description provided by the author
ipv4 string to bigint ipv6 string to bigint.
提取供应链信息 相同上下文、成功时只提取一次 提取header信息:server、X*,不同上下文提取.
绝对404检测 相同 url 本实例中只检测一次.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
字符串还原数字.
数字转 62 进制.
将十进制转换为 任意进制,需要注意的是,域名总不能有 下划线(_),但是可以有减号(-) 0 -- > 0 1 -- > 1 10-- > a 61-- > Z
id 需要转换的数字 szTemplate 模版 szTemplate 的长度决定进制 数据, 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 表示 62 进制度.
N 进制逆向计算.
使用 BrotliBase64 编码
*/.
将字符串转换 为 unicode,例如 & -> \u0026 log.Println(UnicodeEncode("javax.script.ScriptEngineManager")).
通用,update 指定id更新T类型mod数据 通用,update 指定id更新T类型mod数据.
更新到最新版本.
更新失败再插入新数据,确保只有一条数据.
重时间计数器.
字符串全部 url 编码.
并发执行所有func,并等待他们执行完.
并行执行方法,并将使用 wg 计数器.
并行执行方法,并将使用 wg 计数器 同时传入参数parms.
迭代所有的参数.
No description provided by the author
车牌归宿查询:
WhereCar("川G")
WhereCar("黄石市")
*/.
Print results as JSON.
No description provided by the author
No description provided by the author
# Constants
DefaultAntsPoolSize sets up the capacity of worker pool, 256 * 1024.
No description provided by the author
ExpiryDuration is the interval time to clean up those expired workers.
Distributed API Server,服务器.
No description provided by the author
No description provided by the author
No description provided by the author
10M.
No description provided by the author
No description provided by the author
Nonblocking decides what to do when submitting a new task to a full worker pool: waiting for a available worker or returning nil directly.
No description provided by the author
amass, 子域名:amass 7.2k.
17- DNSX.
ffuf.
Gobuster, 服务、目录发现:gobuster 6k,https://github.com/OJ/gobuster// gobuster dns -d google.com -w ~/wordlists/subdomains.txt.
08- go-poc 检测, 隐含包含了: 端口扫描(05-masscan + 06-nmap).
16- httpx, 服务、目录发现:httpx 3.2k,https://github.com/projectdiscovery/httpx.
07- 获取ip info.
No description provided by the author
19 - jaeles.
katana.
05- 合并后的ip 进行快速端口扫描, 端口扫描工具:masscan 19.1k, https://github.com/robertdavidgraham/masscan.
03- 默认自动合并ip,记录ip与域名的关联关系,再发送payload时考虑:相同ip不同域名,相同payload分别发送 合并相同目标 若干域名的ip,避免扫描时重复.
15- naabu, 服务、目录发现:naabu 2.1k,https://github.com/projectdiscovery/naabu.
06、精准 端口指纹,排除masscan已经识别的几种指纹, 端口扫描工具:Nmap, https://github.com/vulnersCom/nmap-vulners.
nuclei 漏洞扫描:nuclei 8.4k,https://github.com/projectdiscovery/nuclei.
09- web端口识别,Naabu,识别 https,识别存活的web端口,再进入下一流程.
端口扫描工具:RustScan 6.3k,https://github.com/RustScan/RustScan.
18- Save Es.
all scan.
shuffledns.
01- SSL信息分析,并对域名信息进行收集、进入下一步流程.
02- 子域名爆破,新域名回归 到: 1 <-- -> 2,做去重处理.
subfinder, 子域名:Subfinder 5.6k,https://github.com/projectdiscovery/subfinder.
tlsx.
Uncover.
指纹:wappalyzer 7.5k, https://github.com/wappalyzer/wappalyzer.
04- 密码破解,隐含包含了: 端口扫描(05-masscan + 06-nmap).
11- detect WAF.
14- dir爆破,Gobuster.
No description provided by the author
10- web指纹,识别蜜罐,并标识.
13- server、x-powerby、x***,url、ip、其他敏感信息(姓名、电话、地址、身份证).
No description provided by the author
12- 爬虫分析,form表单识别,字段名识别,form action提取;.
14- 包含 nuclei.
No description provided by the author
https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/json/proxies.json
https://raw.githubusercontent.com/mertguvencli/http-proxy-list/main/proxy-list/data-with-geolocation.json
https://www.freeproxy.world/?type=socks5&anonymity=4&country=&speed=&port=&page=1
https://www.proxy-list.download/SOCKS5
https://www.proxy-list.download/SOCKS5
https://list.proxylistplus.com/Socks-List-1
https://list.proxylistplus.com/Socks-List-2
http://proxydb.net/?protocol=https&protocol=socks5&anonlvl=2&anonlvl=4&country=
https://www.socks-proxy.net
*/.
# Variables
No description provided by the author
匹配响应中 www-Authenticate 是否有认证要求都信息.
No description provided by the author
No description provided by the author
Ceye api.
Ceye domain.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
国家映射.
No description provided by the author
全局关闭所有线程.
自定义http 头.
No description provided by the author
No description provided by the author
多次使用,一次性编译效率更高.
No description provided by the author
No description provided by the author
No description provided by the author
2,4,8,16,32,采用2的N次方的数字.
No description provided by the author
单实例提高效率.
代理.
InterruptTimeout timeout for interrupt signal when exiting a Cmd.
go:embed ipdb/*.
No description provided by the author
单实例运行.
No description provided by the author
KillTimeout timeout for kill signal when exiting a Cmd.
No description provided by the author
out filename.
No description provided by the author
go POC 检测管道,避免循环引用.
No description provided by the author
No description provided by the author
全局控制.
No description provided by the author
No description provided by the author
全局关闭所有线程.
提取供应链信息.
No description provided by the author
No description provided by the author
No description provided by the author
tick 检测.
临时文件.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
全局线程控制.
# Structs
映射分布式服务器列表.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
CPU.
No description provided by the author
事件数据.
No description provided by the author
创建一个泛型的先进先出(FIFO)栈.
https://colobu.com/2017/10/11/badger-a-performant-k-v-store/ https://juejin.cn/post/6844903814571491335 key-value db chache.
No description provided by the author
No description provided by the author
fuzz请求返回的结果 尽可能使用指针,节约内存开销.
分区.
管道通讯使用.
No description provided by the author
fuzz 响应对象封装.
简单结果.
SizedWaitGroup has the same role and close to the same API as the Golang sync.WaitGroup but adds a limit of the amount of goroutines started concurrently.
扫描目标,非存储,chan时用.
# Interfaces
No description provided by the author
# Type aliases
No description provided by the author
No description provided by the author
No description provided by the author
分区集合.
Pool is the alias of ants.Pool.
No description provided by the author
No description provided by the author
No description provided by the author