diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..be25f5e --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.idea +back +dist +text \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml index f7fdb50..dbcb27f 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -13,6 +13,9 @@ builds: - linux - windows - darwin + ldflags: + - -s -w + main: . archives: - format: zip diff --git a/Dockerfile b/Dockerfile index 06238db..697f148 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,10 @@ -FROM golang:1.19.3 AS builder -RUN go install -v github.com/wjlin0/pathScan@latest - +FROM golang:1.19-alpine AS builder +ENV CGO_ENABLED=0 +RUN apk add --no-cache git && git clone https://github.com/wjlin0/pathScan.git && cd pathScan && go build -ldflags="-w -s" && unzip -d /tmp/dict/ ./config/dict.zip FROM alpine:3.17.1 -COPY --from=builder /go/bin/pathScan /usr/local/bin/pathScan -ENTRYPOINT ["pathScan"] \ No newline at end of file +COPY --from=builder /go/pathScan/pathScan /usr/local/bin/pathScan +COPY --from=builder /tmp/dict/ /root/.config/pathScan/dict +COPY --from=builder /go/pathScan/config/match-config.yaml /root/.config/pathScan/match-config.yaml +RUN pathScan + +ENTRYPOINT ["pathScan"] diff --git a/config/match-config.yaml b/config/match-config.yaml index 2172e0d..9984047 100644 --- a/config/match-config.yaml +++ b/config/match-config.yaml @@ -1,10 +1,10 @@ -version: "v1.0.0" +version: "v1.0.1" rules: - name: "Thinkphp" matchers: - - type: regex + - type: word part: header - regex: + word: - "ThinkPHP" - name: "Apache" matchers: @@ -34,8 +34,9 @@ rules: matchers: - type: regex part: header + name: php regex: - - "X-Powered-By: (PHP[\\d\\.\\/]*?)" + - 'X-Powered-By: (PHP/?(\d+\.\d+\.\d+)?)' group: 1 - name: "Tomcat" matchers: @@ -77,4 +78,51 @@ rules: - type: word part: body words: - - '' \ No newline at end of file + - '' + - name: "WordPress" + matchers: + - type: regex + part: body + name: wordpress + group: 1 + regex: + - 'Logging' + - type: word + part: body + words: + - 'Apache SOLR' + - 'Logging' + - 'Cloud' + - 'Collections' + condition: and + - name: "Phpinfo" + matchers-condition: and + matchers: + - type: regex + part: body + name: phpinfo + group: 1 + regex: + - '

PHP Version (\d+\.\d+\.\d+)

' + - type: word + part: body + words: + - 'System ' + - 'Server API ' + - 'disable_functions' + condition: or + - name: "Splunk-Enterprise" + matchers: + - type: word + part: body + words: + - '

Splunk relies on JavaScript to function properly.
Please enable JavaScript and then refresh the page to login.

' \ No newline at end of file diff --git a/go.mod b/go.mod index cf58fc6..0b067e4 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/wjlin0/pathScan +module pathScan go 1.19 diff --git a/main.go b/main.go index 6342ce9..5e19e74 100644 --- a/main.go +++ b/main.go @@ -3,11 +3,11 @@ package main import ( "fmt" "github.com/projectdiscovery/gologger" - "github.com/wjlin0/pathScan/pkg/runner" - "github.com/wjlin0/pathScan/pkg/util" "os" "os/signal" "path/filepath" + "pathScan/pkg/runner" + "pathScan/pkg/util" ) func main() { diff --git a/pkg/common/identification/identification.go b/pkg/common/identification/identification.go index 807d8ff..a4c16f0 100644 --- a/pkg/common/identification/identification.go +++ b/pkg/common/identification/identification.go @@ -5,8 +5,8 @@ import ( "github.com/projectdiscovery/fileutil" "github.com/projectdiscovery/gologger" folderutil "github.com/projectdiscovery/utils/folder" - "github.com/wjlin0/pathScan/pkg/common/identification/matchers" "path/filepath" + "pathScan/pkg/common/identification/matchers" ) type Options struct { diff --git a/pkg/common/uncover/uncorver.go b/pkg/common/uncover/uncorver.go index f958d00..c21038a 100644 --- a/pkg/common/uncover/uncorver.go +++ b/pkg/common/uncover/uncorver.go @@ -8,22 +8,22 @@ import ( "github.com/projectdiscovery/ratelimit" folderutil "github.com/projectdiscovery/utils/folder" "github.com/remeh/sizedwaitgroup" - ucRunner "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/runner" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/binary" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/censys" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/fofa" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/hunter" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/netlas" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/quake" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/shodan" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/shodanidb" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/zone" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/zoomeye" - "github.com/wjlin0/pathScan/pkg/util" "golang.org/x/net/context" "os" "path/filepath" + ucRunner "pathScan/pkg/projectdiscovery/uncover/runner" + "pathScan/pkg/projectdiscovery/uncover/uncover" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/binary" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/censys" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/fofa" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/hunter" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/netlas" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/quake" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/shodan" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/shodanidb" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/zone" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/zoomeye" + "pathScan/pkg/util" "regexp" "runtime" "strconv" diff --git a/pkg/projectdiscovery/uncover/runner/output_writer.go b/pkg/projectdiscovery/uncover/runner/output_writer.go index 41bec84..fc8af90 100644 --- a/pkg/projectdiscovery/uncover/runner/output_writer.go +++ b/pkg/projectdiscovery/uncover/runner/output_writer.go @@ -7,7 +7,7 @@ import ( "sync" lru "github.com/hashicorp/golang-lru" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover" + "pathScan/pkg/projectdiscovery/uncover/uncover" ) type OutputWriter struct { diff --git a/pkg/projectdiscovery/uncover/runner/provider.go b/pkg/projectdiscovery/uncover/runner/provider.go index 0faeb83..20d05cd 100644 --- a/pkg/projectdiscovery/uncover/runner/provider.go +++ b/pkg/projectdiscovery/uncover/runner/provider.go @@ -4,7 +4,7 @@ import ( "math/rand" "strings" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover" + "pathScan/pkg/projectdiscovery/uncover/uncover" ) type Provider struct { diff --git a/pkg/projectdiscovery/uncover/runner/runner.go b/pkg/projectdiscovery/uncover/runner/runner.go index f37b98f..68fcaa0 100644 --- a/pkg/projectdiscovery/uncover/runner/runner.go +++ b/pkg/projectdiscovery/uncover/runner/runner.go @@ -13,16 +13,16 @@ import ( "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/ratelimit" "github.com/projectdiscovery/stringsutil" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/censys" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/criminalip" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/fofa" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/hunter" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/netlas" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/quake" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/shodan" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/shodanidb" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover/agent/zoomeye" + "pathScan/pkg/projectdiscovery/uncover/uncover" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/censys" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/criminalip" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/fofa" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/hunter" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/netlas" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/quake" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/shodan" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/shodanidb" + "pathScan/pkg/projectdiscovery/uncover/uncover/agent/zoomeye" ) func init() { diff --git a/pkg/projectdiscovery/uncover/uncover/agent/binary/binary.go b/pkg/projectdiscovery/uncover/uncover/agent/binary/binary.go index 8b7a457..ee50dd6 100644 --- a/pkg/projectdiscovery/uncover/uncover/agent/binary/binary.go +++ b/pkg/projectdiscovery/uncover/uncover/agent/binary/binary.go @@ -4,10 +4,10 @@ import ( "encoding/json" "fmt" "github.com/pkg/errors" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover" "io" "net/http" "net/url" + "pathScan/pkg/projectdiscovery/uncover/uncover" ) type Agent struct { diff --git a/pkg/projectdiscovery/uncover/uncover/agent/censys/censys.go b/pkg/projectdiscovery/uncover/uncover/agent/censys/censys.go index be7cc38..a271f19 100644 --- a/pkg/projectdiscovery/uncover/uncover/agent/censys/censys.go +++ b/pkg/projectdiscovery/uncover/uncover/agent/censys/censys.go @@ -8,7 +8,7 @@ import ( "github.com/pkg/errors" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover" + "pathScan/pkg/projectdiscovery/uncover/uncover" ) const ( diff --git a/pkg/projectdiscovery/uncover/uncover/agent/criminalip/criminalip.go b/pkg/projectdiscovery/uncover/uncover/agent/criminalip/criminalip.go index 46de0ce..e274293 100644 --- a/pkg/projectdiscovery/uncover/uncover/agent/criminalip/criminalip.go +++ b/pkg/projectdiscovery/uncover/uncover/agent/criminalip/criminalip.go @@ -8,7 +8,7 @@ import ( "github.com/pkg/errors" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover" + "pathScan/pkg/projectdiscovery/uncover/uncover" ) const ( diff --git a/pkg/projectdiscovery/uncover/uncover/agent/fofa/fofa.go b/pkg/projectdiscovery/uncover/uncover/agent/fofa/fofa.go index 31e7373..5a48d60 100644 --- a/pkg/projectdiscovery/uncover/uncover/agent/fofa/fofa.go +++ b/pkg/projectdiscovery/uncover/uncover/agent/fofa/fofa.go @@ -9,7 +9,7 @@ import ( "github.com/pkg/errors" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover" + "pathScan/pkg/projectdiscovery/uncover/uncover" ) const ( diff --git a/pkg/projectdiscovery/uncover/uncover/agent/hunter/hunter.go b/pkg/projectdiscovery/uncover/uncover/agent/hunter/hunter.go index 243ee6f..545e8f3 100644 --- a/pkg/projectdiscovery/uncover/uncover/agent/hunter/hunter.go +++ b/pkg/projectdiscovery/uncover/uncover/agent/hunter/hunter.go @@ -7,7 +7,7 @@ import ( "fmt" "net/http" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover" + "pathScan/pkg/projectdiscovery/uncover/uncover" ) const ( diff --git a/pkg/projectdiscovery/uncover/uncover/agent/netlas/netlas.go b/pkg/projectdiscovery/uncover/uncover/agent/netlas/netlas.go index c5c7f13..04aae65 100644 --- a/pkg/projectdiscovery/uncover/uncover/agent/netlas/netlas.go +++ b/pkg/projectdiscovery/uncover/uncover/agent/netlas/netlas.go @@ -5,7 +5,7 @@ import ( "errors" "net/http" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover" + "pathScan/pkg/projectdiscovery/uncover/uncover" ) const ( diff --git a/pkg/projectdiscovery/uncover/uncover/agent/quake/quake.go b/pkg/projectdiscovery/uncover/uncover/agent/quake/quake.go index dc9ceb6..17e10a7 100644 --- a/pkg/projectdiscovery/uncover/uncover/agent/quake/quake.go +++ b/pkg/projectdiscovery/uncover/uncover/agent/quake/quake.go @@ -4,9 +4,9 @@ import ( "bytes" "encoding/json" "errors" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover" "io" "net/http" + "pathScan/pkg/projectdiscovery/uncover/uncover" ) const ( diff --git a/pkg/projectdiscovery/uncover/uncover/agent/shodan/shodan.go b/pkg/projectdiscovery/uncover/uncover/agent/shodan/shodan.go index ccefa97..1b60221 100644 --- a/pkg/projectdiscovery/uncover/uncover/agent/shodan/shodan.go +++ b/pkg/projectdiscovery/uncover/uncover/agent/shodan/shodan.go @@ -8,7 +8,7 @@ import ( "github.com/pkg/errors" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover" + "pathScan/pkg/projectdiscovery/uncover/uncover" ) const ( diff --git a/pkg/projectdiscovery/uncover/uncover/agent/shodanidb/shodan.go b/pkg/projectdiscovery/uncover/uncover/agent/shodanidb/shodan.go index d69a164..b3d6642 100644 --- a/pkg/projectdiscovery/uncover/uncover/agent/shodanidb/shodan.go +++ b/pkg/projectdiscovery/uncover/uncover/agent/shodanidb/shodan.go @@ -9,7 +9,7 @@ import ( "github.com/pkg/errors" "github.com/projectdiscovery/mapcidr" iputil "github.com/projectdiscovery/utils/ip" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover" + "pathScan/pkg/projectdiscovery/uncover/uncover" ) const ( diff --git a/pkg/projectdiscovery/uncover/uncover/agent/zone/zone.go b/pkg/projectdiscovery/uncover/uncover/agent/zone/zone.go index aa01479..8c55bf7 100644 --- a/pkg/projectdiscovery/uncover/uncover/agent/zone/zone.go +++ b/pkg/projectdiscovery/uncover/uncover/agent/zone/zone.go @@ -5,10 +5,10 @@ import ( jsoniter "github.com/json-iterator/go" "github.com/json-iterator/go/extra" "github.com/pkg/errors" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover" "io" "net/http" "net/url" + "pathScan/pkg/projectdiscovery/uncover/uncover" "strconv" ) diff --git a/pkg/projectdiscovery/uncover/uncover/agent/zoomeye/zoomeye.go b/pkg/projectdiscovery/uncover/uncover/agent/zoomeye/zoomeye.go index 267c27c..0e9c5fa 100644 --- a/pkg/projectdiscovery/uncover/uncover/agent/zoomeye/zoomeye.go +++ b/pkg/projectdiscovery/uncover/uncover/agent/zoomeye/zoomeye.go @@ -7,7 +7,7 @@ import ( "net/http" "net/url" - "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/uncover" + "pathScan/pkg/projectdiscovery/uncover/uncover" ) const ( diff --git a/pkg/runner/banner.go b/pkg/runner/banner.go index 3884181..4b2ac41 100644 --- a/pkg/runner/banner.go +++ b/pkg/runner/banner.go @@ -6,11 +6,11 @@ const banner = ` __ __ ____ ___ ___ _ / /_ / / / __/____ ___ _ ___ / _ \/ _ // __// _ \ _\ \ / __// _ // _ \ - / .__/\_,_/ \__//_//_//___/ \__/ \_,_//_//_/ v1.1.0 + / .__/\_,_/ \__//_//_//___/ \__/ \_,_//_//_/ v1.1.1 /_/ ` -const Version = `1.1.0` +const Version = `1.1.1` // showBanner is used to show the banner to the user func showBanner() { diff --git a/pkg/runner/handler.go b/pkg/runner/handler.go index 01117b9..3bba408 100644 --- a/pkg/runner/handler.go +++ b/pkg/runner/handler.go @@ -4,12 +4,12 @@ import ( "bufio" "github.com/projectdiscovery/gologger" fileutil "github.com/projectdiscovery/utils/file" - "github.com/wjlin0/pathScan/pkg/common/uncover" - "github.com/wjlin0/pathScan/pkg/util" "io" "net/http" "net/url" "os" + "pathScan/pkg/common/uncover" + "pathScan/pkg/util" "strings" ) @@ -115,7 +115,7 @@ func addPathsToSet(pathList []string, pathSet map[string]struct{}) { func (r *Runner) handlerGetFilePath(filename string) []string { - path := util.DataRoot("dict", "v"+Version, filename) + path := util.DataRoot("dict", filename) out, err := fileutil.ReadFile(path) if err != nil { return nil diff --git a/pkg/runner/operators.go b/pkg/runner/operators.go index 8b1f28f..613cf4c 100644 --- a/pkg/runner/operators.go +++ b/pkg/runner/operators.go @@ -2,7 +2,7 @@ package runner import ( "github.com/projectdiscovery/nuclei/v2/pkg/types" - "github.com/wjlin0/pathScan/pkg/common/identification/matchers" + "pathScan/pkg/common/identification/matchers" "strings" ) diff --git a/pkg/runner/options.go b/pkg/runner/options.go index 1a2f6de..10a741f 100644 --- a/pkg/runner/options.go +++ b/pkg/runner/options.go @@ -9,11 +9,11 @@ import ( "github.com/projectdiscovery/gologger/formatter" "github.com/projectdiscovery/gologger/levels" folderutil "github.com/projectdiscovery/utils/folder" - "github.com/wjlin0/pathScan/pkg/common/identification" - "github.com/wjlin0/pathScan/pkg/common/uncover" - ucRunner "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/runner" "os" "path/filepath" + "pathScan/pkg/common/identification" + "pathScan/pkg/common/uncover" + ucRunner "pathScan/pkg/projectdiscovery/uncover/runner" "time" ) diff --git a/pkg/runner/output.go b/pkg/runner/output.go index 4150e89..525f8e8 100644 --- a/pkg/runner/output.go +++ b/pkg/runner/output.go @@ -5,7 +5,7 @@ import ( "encoding/csv" "fmt" "github.com/pkg/errors" - "github.com/wjlin0/pathScan/pkg/result" + "pathScan/pkg/result" "reflect" "strings" "time" diff --git a/pkg/runner/result.go b/pkg/runner/result.go index f06a951..a41ef2d 100644 --- a/pkg/runner/result.go +++ b/pkg/runner/result.go @@ -3,8 +3,8 @@ package runner import ( "fmt" "github.com/logrusorgru/aurora" - "github.com/wjlin0/pathScan/pkg/result" "net/http" + "pathScan/pkg/result" "strconv" "strings" "sync" diff --git a/pkg/runner/resume.go b/pkg/runner/resume.go index 750e9e2..f3fbfec 100644 --- a/pkg/runner/resume.go +++ b/pkg/runner/resume.go @@ -7,10 +7,10 @@ import ( "github.com/pkg/errors" "github.com/projectdiscovery/fileutil" "github.com/projectdiscovery/gologger" - "github.com/wjlin0/pathScan/pkg/result" - "github.com/wjlin0/pathScan/pkg/util" "os" "path/filepath" + "pathScan/pkg/result" + "pathScan/pkg/util" "strings" "sync" ) diff --git a/pkg/runner/run.go b/pkg/runner/run.go index 2c9aef8..ad3ade3 100644 --- a/pkg/runner/run.go +++ b/pkg/runner/run.go @@ -7,14 +7,14 @@ import ( "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/ratelimit" "github.com/remeh/sizedwaitgroup" - "github.com/wjlin0/pathScan/pkg/common/identification" - ucRunner "github.com/wjlin0/pathScan/pkg/projectdiscovery/uncover/runner" - "github.com/wjlin0/pathScan/pkg/result" - "github.com/wjlin0/pathScan/pkg/util" "golang.org/x/net/context" "net/http" "os" "path/filepath" + "pathScan/pkg/common/identification" + ucRunner "pathScan/pkg/projectdiscovery/uncover/runner" + "pathScan/pkg/result" + "pathScan/pkg/util" "strconv" "strings" "sync" diff --git a/pkg/runner/scan.go b/pkg/runner/scan.go index 86103e8..ba803fa 100644 --- a/pkg/runner/scan.go +++ b/pkg/runner/scan.go @@ -4,12 +4,12 @@ import ( "bytes" "crypto/tls" "github.com/projectdiscovery/gologger" - "github.com/wjlin0/pathScan/pkg/result" "io" "math/rand" "net" "net/http" "net/url" + "pathScan/pkg/result" "regexp" "strings" "time" diff --git a/pkg/runner/util.go b/pkg/runner/util.go index a7b8408..c4ed06c 100644 --- a/pkg/runner/util.go +++ b/pkg/runner/util.go @@ -9,10 +9,10 @@ import ( "github.com/tj/go-update" "github.com/tj/go-update/progress" githubUpdateStore "github.com/tj/go-update/stores/github" - "github.com/wjlin0/pathScan/pkg/util" "io" "os" "path/filepath" + "pathScan/pkg/util" "runtime" "strings" ) @@ -23,7 +23,7 @@ func (o *Options) DownloadDict() error { return fmt.Errorf("打开主目录时出错:%s\n", err.Error()) } - path := filepath.Join(home, ".config", "pathScan", "dict", "v"+Version) + path := filepath.Join(home, ".config", "pathScan", "dict") if fileutil.FileExists(filepath.Join(path, ".check")) { gologger.Info().Msgf("远程字典下载成功->%s", path) return nil