Skip to content

Commit

Permalink
custom ceye
Browse files Browse the repository at this point in the history
  • Loading branch information
u21h2 committed Aug 1, 2022
1 parent 996122c commit 27a35c2
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ sudo ./nacs -uf url文件 -o result.txt
-useradd 爆破时添加用户名
-passwordadd 爆破时添加密码
-noreverse 不使用反连平台
-ceyekey 你自己的ceye token
-ceyedomain 你自己的ceye domain
```
## 借鉴
Expand Down
2 changes: 2 additions & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ sudo ./nacs -uf "File of url(s)" -o result.txt
-useradd add username when blasting
-passwordadd add password when blasting
-noreverse do not use reverse platform
-ceyekey your own ceye token
-ceyedomain your own ceye domain
```
## Reference
Expand Down
4 changes: 4 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
rm -rf build/*
mkdir -p build/pocs
mkdir build/nacs_linux_amd64
mkdir build/nacs_linux_arm64
mkdir build/nacs_darwin_amd64
mkdir build/nacs_darwin_arm64
mkdir build/nacs_win_amd64
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w " -trimpath -o build/nacs_linux_amd64/nacs
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w " -trimpath -o build/nacs_linux_arm64/nacs
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w " -trimpath -o build/nacs_win_amd64/nacs.exe
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w " -trimpath -o build/nacs_darwin_amd64/nacs
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w " -trimpath -o build/nacs_darwin_arm64/nacs
cp -r web/pocv1/pocs build/pocs/xrayv1
cp -r web/poc/pocs/nuclei build/pocs/nuclei
cd build/
cp -r pocs nacs_linux_amd64
cp -r pocs nacs_linux_arm64
cp -r pocs nacs_darwin_amd64
cp -r pocs nacs_darwin_arm64
cp -r pocs nacs_win_amd64
COPYFILE_DISABLE=true tar -zcvf nacs_darwin_amd64.tar.gz --exclude="*.DS_Store" nacs_darwin_amd64
COPYFILE_DISABLE=true tar -zcvf nacs_linux_arm64.tar.gz --exclude="*.DS_Store" nacs_linux_arm64
COPYFILE_DISABLE=true tar -zcvf nacs_darwin_arm64.tar.gz --exclude="*.DS_Store" nacs_darwin_arm64
COPYFILE_DISABLE=true tar -zcvf nacs_linux_amd64.tar.gz --exclude="*.DS_Store" nacs_linux_amd64
zip -q -r nacs_win_amd64.zip nacs_win_amd64
3 changes: 3 additions & 0 deletions common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ type RunningInfoStruct struct {
DnslogCNGetDomainRequest *http.Request
DnslogCNGetRecordRequest *http.Request

XrayV1CeyeApi string
XrayV1CeyeDomain string

NucleiPocPath string
FscanPocPath string
PocTimeout int
Expand Down
7 changes: 6 additions & 1 deletion parse/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ func Parse(InputInfo *common.InputInfoStruct, RunningInfo *common.RunningInfoStr

RunningInfo.OutJson = InputInfo.OutJson

ParseReversePlatform(InputInfo.CeyeKey, InputInfo.CeyeDomain)
ParseReversePlatform(InputInfo.CeyeKey, InputInfo.CeyeDomain) // useless

if InputInfo.CeyeKey != "" {
RunningInfo.XrayV1CeyeApi = InputInfo.CeyeKey
RunningInfo.XrayV1CeyeDomain = InputInfo.CeyeDomain
}

RunningInfo.NoPoc = InputInfo.NoPoc
RunningInfo.NoBrute = InputInfo.NoBrute
Expand Down
16 changes: 14 additions & 2 deletions web/pocv1/lib/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func executePoc(oReq *http.Request, p *Poc) (bool, error, string) {
variableMap["response"] = resp
// 先判断响应页面是否匹配search规则
if rule.Search != "" {
result := doSearch(strings.TrimSpace(rule.Search), string(resp.Body))
result := doSearch(strings.TrimSpace(rule.Search), GetHeader(resp.Headers)+string(resp.Body))
if result != nil && len(result) > 0 { // 正则匹配成功
for k, v := range result {
variableMap[k] = v
Expand Down Expand Up @@ -231,6 +231,9 @@ func newReverse() *Reverse {
if common.RunningInfo.NoReverse {
return &Reverse{}
}
if common.RunningInfo.XrayV1CeyeDomain != "" {
ceyeDomain = common.RunningInfo.XrayV1CeyeDomain
}
urlStr := fmt.Sprintf("http://%s.%s", sub, ceyeDomain)
//fmt.Println(urlStr)
u, _ := url.Parse(urlStr)
Expand Down Expand Up @@ -446,7 +449,7 @@ func clustersend(oReq *http.Request, variableMap map[string]interface{}, req *Re
variableMap["response"] = resp
// 先判断响应页面是否匹配search规则
if rule.Search != "" {
result := doSearch(strings.TrimSpace(rule.Search), string(resp.Body))
result := doSearch(strings.TrimSpace(rule.Search), GetHeader(resp.Headers)+string(resp.Body))
if result != nil && len(result) > 0 { // 正则匹配成功
for k, v := range result {
variableMap[k] = v
Expand Down Expand Up @@ -525,3 +528,12 @@ func evalset1(env *cel.Env, variableMap map[string]interface{}, k string, expres
// }
// return ""
//}

func GetHeader(header map[string]string) (output string) {
for name, values := range header {
line := fmt.Sprintf("%s: %s\n", name, values)
output = output + line
}
output = output + "\r\n"
return
}
4 changes: 4 additions & 0 deletions web/pocv1/lib/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"io"
"io/ioutil"
"math/rand"
"nacs/common"
"net/http"
"net/url"
"regexp"
Expand Down Expand Up @@ -546,6 +547,9 @@ func reverseCheck(r *Reverse, timeout int64) bool {
}
time.Sleep(time.Second * time.Duration(timeout))
sub := strings.Split(r.Domain, ".")[0]
if common.RunningInfo.XrayV1CeyeApi != "" {
ceyeApi = common.RunningInfo.XrayV1CeyeApi
}
urlStr := fmt.Sprintf("http://api.ceye.io/v1/records?token=%s&type=dns&filter=%s", ceyeApi, sub)
//fmt.Println(urlStr)
req, _ := http.NewRequest("GET", urlStr, nil)
Expand Down
4 changes: 2 additions & 2 deletions web/pocv1/poc.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ func Execute(PocInfo poc_struct.PocInfoStruct) {
func InitPocInfo(pocInfo *poc_struct.PocInfoStruct) {
pocInfo.Num = common.RunningInfo.PocRate
pocInfo.Timeout = int64(common.RunningInfo.PocTimeout)
pocInfo.ApiKey = common.RunningInfo.CeyeApi
pocInfo.CeyeDomain = common.RunningInfo.CeyeDomain
// pocInfo.ApiKey = common.RunningInfo.CeyeApi
// pocInfo.CeyeDomain = common.RunningInfo.CeyeDomain

}

Expand Down

0 comments on commit 27a35c2

Please sign in to comment.