Skip to content

Commit 0777d79

Browse files
committed
fix -host http:/xxx.com can not run naabu 2022-06-29 23:07:1656515250
1 parent 7176a89 commit 0777d79

File tree

9 files changed

+69
-27
lines changed

9 files changed

+69
-27
lines changed

config/config.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
"UrlPrecise": true,
5252
"ParseSSl": false,
5353
"EnableSubfinder": false,
54+
"EnableKsubdomain": true,
55+
"KsubdomainRegxp": "([0-9a-zA-Z\\-]+\\.[0-9a-zA-Z\\-]+)$",
5456
"naabu_dns": {},
5557
"naabu": {"TopPorts": "1000","ScanAllIPS": true},
5658
"nuclei": {},

config/nuclei-templates/cves/2018/CVE-2018-18778.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ info:
1313
cvss-score: 6.5
1414
cve-id: CVE-2018-18778
1515
cwe-id: CWE-200
16-
tags: cve,cve2018,lfi
16+
tags: cve,cve2018,lfi,mini_httpd
1717

1818
requests:
1919
- raw:

config/nuclei-templates/cves/2021/CVE-2021-42063.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ info:
1616
cvss-score: 6.1
1717
cve-id: CVE-2021-42063
1818
cwe-id: CWE-79
19+
metadata:
20+
shodan-query: http.favicon.hash:-266008933
21+
zoomeye-query: +app:"SAP NetWeaver Application Server httpd
1922
tags: cve,cve2021,sap,xss
2023

2124
requests:

config/nuclei-templates/miscellaneous/robots-txt.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ id: robots-txt
22

33
info:
44
name: robots.txt file
5-
author: CasperGN
5+
author: CasperGN,thezakman
66
severity: info
77
tags: misc,generic
88

config/nuclei-templates/misconfiguration/phpmyadmin/phpmyadmin-setup.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ id: phpmyadmin-setup
22

33
info:
44
name: Publicly Accessible Phpmyadmin Setup
5-
author: sheikhrishad,thevillagehacker
5+
author: sheikhrishad,thevillagehacker,Kr1shna4garwal
66
severity: medium
77
tags: phpmyadmin,misconfig
88

@@ -19,11 +19,13 @@ requests:
1919
- "{{BaseURL}}/sysadmin/phpMyAdmin/scripts/setup.php"
2020
- "{{BaseURL}}/phpmyadmin/setup/index.php"
2121
- "{{BaseURL}}/pma/setup/index.php"
22+
- "{{BaseURL}}/phpmyadmin/setup/"
2223

2324
stop-at-first-match: true
2425
matchers-condition: and
2526
matchers:
2627
- type: word
28+
part: body
2729
words:
2830
- "You want to configure phpMyAdmin using web interface"
2931
- "<title>phpMyAdmin setup</title>"

pkg/config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package pkg
22

33
import (
44
"encoding/json"
5+
"fmt"
56
"github.com/spf13/viper"
67
"io/ioutil"
78
"log"
@@ -29,8 +30,9 @@ var (
2930

3031
// 优先使用配置文件中的配置,否则从环境变量中读取
3132
func GetVal(key string) string {
33+
key = strings.ToLower(key)
3234
if s, ok := mData[key]; ok {
33-
return s.(string)
35+
return fmt.Sprintf("%v", s)
3436
}
3537
return os.Getenv(key)
3638
}

pkg/ksubdomain/ksbdomain.go

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,44 @@ package ksubdomain
33
import (
44
"github.com/boy-hack/ksubdomain/core/conf"
55
"github.com/boy-hack/ksubdomain/core/gologger"
6+
"github.com/hktalent/scan4all/pkg"
67
cli "github.com/urfave/cli/v2"
78
"os"
9+
"regexp"
810
)
911

1012
// cat $HOME/MyWork/scan4all/pkg/ksubdomain/*.go|grep "github.com/boy-hack/ksubdomain"|sed 's/"//g'|sort -u|uniq|xargs -I % go get %
1113
func DoSubfinder(a []string, out chan string, done chan bool) {
12-
app := &cli.App{
13-
Name: conf.AppName,
14-
Version: conf.Version,
15-
Usage: conf.Description,
16-
Commands: []*cli.Command{
17-
enumCommand,
18-
verifyCommand,
19-
testCommand,
20-
},
21-
}
14+
if "true" == pkg.GetVal("EnableKsubdomain") {
15+
s1 := pkg.GetVal("KsubdomainRegxp")
16+
if "" != s1 {
17+
r1, err := regexp.Compile(s1)
18+
if nil == err {
19+
a1 := []string{}
20+
for _, x := range a {
21+
x3 := r1.FindAllString(x, -1)
22+
if 0 < len(x3) {
23+
a1 = append(a1, x3[0])
24+
}
25+
}
26+
a = a1
27+
}
28+
app := &cli.App{
29+
Name: conf.AppName,
30+
Version: conf.Version,
31+
Usage: conf.Description,
32+
Commands: []*cli.Command{
33+
enumCommand,
34+
verifyCommand,
35+
testCommand,
36+
},
37+
}
38+
39+
err := app.Run(os.Args)
40+
if err != nil {
41+
gologger.Fatalf(err.Error())
42+
}
2243

23-
err := app.Run(os.Args)
24-
if err != nil {
25-
gologger.Fatalf(err.Error())
44+
}
2645
}
2746
}

pkg/naabu/v2/pkg/runner/targets.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ func (r *Runner) mergeToFile() (string, error) {
5151
// target defined via CLI argument
5252
if len(r.options.Host) > 0 {
5353
for _, v := range r.options.Host {
54-
fmt.Fprintf(tempInput, "%s\n", v)
54+
if strings.HasPrefix(v, "https://") || strings.HasPrefix(v, "http://") {
55+
if u, err := url.Parse(v); err == nil {
56+
fmt.Fprintf(tempInput, "%s\n", u.Hostname())
57+
}
58+
} else {
59+
fmt.Fprintf(tempInput, "%s\n", v)
60+
}
5561
}
5662
}
5763

@@ -158,6 +164,7 @@ func (r *Runner) AddTarget(target string) error {
158164
if u, err := url.Parse(target); err == nil {
159165
s1 := fmt.Sprintf("%s://%s", u.Scheme, u.Host)
160166
Add2Naabubuffer(fmt.Sprintf("%s\n", s1))
167+
//Add2Naabubuffer(u.Hostname())
161168
// target 长度 大于 s1才处理
162169
////UrlPrecise bool // 精准url扫描,不去除url清单上下文 2022-06-08
163170
UrlPrecise := pkg.GetVal(pkg.UrlPrecise)

test/testXml.go

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
package main
22

33
import (
4-
"bytes"
5-
"github.com/hktalent/scan4all/nuclei_Yaml"
4+
"log"
5+
"net/url"
66
)
77

8-
var Naabubuffer bytes.Buffer = bytes.Buffer{}
8+
//var Naabubuffer bytes.Buffer = bytes.Buffer{}
99

1010
func main() {
11-
var nucleiDone = make(chan bool)
12-
Naabubuffer.Write([]byte("192.168.10.31\n"))
13-
// 集成nuclei
14-
//log.Println("httpxrunner.Naabubuffer = ", httpxrunner.Naabubuffer.String())
15-
nuclei_Yaml.RunNuclei(Naabubuffer, nucleiDone)
16-
<-nucleiDone
11+
12+
s := "http://www.ddd.com:990/xxp"
13+
if u, err := url.Parse(s); err == nil {
14+
//s1 := fmt.Sprintf("%s://%s", u.Scheme, u.Host)
15+
log.Println(u.Hostname())
16+
}
17+
//fmt.Println(fmt.Sprintf("%v", 333))
18+
//var nucleiDone = make(chan bool)
19+
//Naabubuffer.Write([]byte("192.168.10.31\n"))
20+
//// 集成nuclei
21+
////log.Println("httpxrunner.Naabubuffer = ", httpxrunner.Naabubuffer.String())
22+
//nuclei_Yaml.RunNuclei(Naabubuffer, nucleiDone)
23+
//<-nucleiDone
1724

1825
//x := "test/4ee58a18fc884edd74ff1ec077e8c90c6048a45b.xml"
1926
//b, err := ioutil.ReadFile(x)

0 commit comments

Comments
 (0)