pathScan

command module
v1.5.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

pathScan 是一个用Go编写的路径扫描、信息收集、指纹探索工具,它允许您快速可靠的扫描URL地址。这是一个非常简单的工具。

GitHub Repo stars

特征

  • 快速发现路径、快速从网络空间中收集信息、指纹识别
  • 丰富的内置字典,自动下载字典,可远程加载目标或远程加载字典
  • 可持续递归扫描,恢复上次扫描进度
  • 从网络空间测绘中发现目标,从持续的扫描中发现目标
  • 支持使用HTTP/SOCKS5代理
  • 可自定义请求头,可自定义指纹识别规则
  • 通过hash,len指定跳过
  • 结果可回调处理

先决条件

Note: 在安装 pathScan 之前,请确保安装 libpcap 用于数据包捕获的库。

要在 Linux 上安装 libpcap:sudo apt install -y libpcap-dev ,在 Mac 上安装: brew install libpcap

安装pathScan

pathScan需要go1.21才能安装成功。执行一下命令

go install -v github.com/wjlin0/pathScan@latest

下载准备运行的二进制文件

# windows
wget https://github.com/wjlin0/pathScan/releases/download/v1.5.3/pathScan_v1.5.3_windows_amd64.zip
#linux macos
OS=$(uname -s | tr '[:upper:]' '[:lower:]'); ARCH=$(uname -m); [ "$ARCH" = "x86_64" ] && ARCH="amd64"; rm -rf /tmp/pathScan && wget "https://github.com/wjlin0/pathScan/releases/download/v1.5.3/pathScan_v1.5.3_""$OS"_"$ARCH"".zip" -O /tmp/pathScan.zip && unzip /tmp/pathScan.zip -d /tmp/pathScan && sudo mv /tmp/pathScan/pathScan /usr/local/bin/pathScan && sudo chmod +x /usr/local/bin/pathScan && rm -rf /tmp/pathScan && pathScan

用法

  • 更多用法查看 BLOG
pathScan -h
pathScan 1.5.3 Go 扫描、信息收集工具 

Usage:
  pathScan [flags]

Flags:
输入:
   -u, -url string[]           目标(以逗号分割)
   -list string[]              从文件中,读取目标
   -tr, -target-remote string  从远程加载目标
   -tc, -target-channel        从通道中加载目标
   -resume string              使用resume.cfg恢复扫描
   -mf, -match-file string     指纹文件目录或文件

递归:
   -r, -recursive            递归扫描
   -rt, -recursive-time int  递归扫描深度 (default 3)

子域名收集:
   -s, -sub                   子域名收集
   -sq, -sub-query string[]   需要收集的域名 (支持从文件中录入 -sq /tmp/sub-query.txt)
   -sl, -sub-limit int        每个搜索引擎返回的至少不超过数 (default 1000)
   -so, -sub-output string    子域名搜索结果保存 支持csv格式输出
   -se, -sub-engine string[]  子域名搜索引擎 [shodan censys fofa quake hunter zoomeye netlas criminalip publicwww hunterhow binary shodan-idb anubis-spider sitedossier-spider fder bing-spider chinaz-spider google-spider ip138-spider qianxun-spider rapiddns-spider baidu-spider yahoo-spider] (default all)

被动发现:
   -a, -api                        被动发现
   -as, -api-server string         中间人劫持代理端口 (default ":8081")
   -ac, -api-ca-path string        中间人劫持证书路径
   -ah, -api-allow-hosts string[]  允许的hosts (支持从文件中录入 -ah /tmp/allow-hosts.txt 支持 *.wjlin0.com 写法) (default ["*"])

引擎:
   -uc, -uncover                  启用打开搜索引擎
   -uq, -uncover-query string[]   搜索查询
   -ue, -uncover-engine string[]  支持的引擎 [shodan censys fofa quake hunter zoomeye netlas criminalip publicwww hunterhow binary] (default fofa)
   -uf, -uncover-field string     引擎返回字段 (ip,port,host) (default "host")
   -ul, -uncover-limit int        发现要返回的结果 (default 200)
   -uo, -uncover-output string    搜索引擎查询结果保存 支持csv格式输出

跳过:
   -su, -skip-url string[]          跳过的目标(以逗号分割,支持从文件读取 -su /tmp/skip-url.txt)
   -sc, -skip-code string[]         跳过状态码(以逗号分割,支持从文件读取 -sc /tmp/skip-code.txt, 支持 5xx、300-399 )
   -sh, -skip-hash string           跳过指定hash
   -sbl, -skip-body-len string[]    跳过body固定长度(支持 100-200,即长度为100~200之间的均跳过,支持 从文件中读取 -sbl /tmp/skip-body-len.txt)
   -sbr, -skip-body-regex string[]  跳过body正则匹配(以逗号分割,支持从文件读取 -sbr /tmp/skip-regex.txt)

扫描字典:
   -ps, -path string[]       路径(以逗号分割)
   -pf, -path-file string[]  从文件中,读取路径
   -pr, -path-remote string  从远程加载字典
   -ldd, -load-default-dict  目标超过一个时,是否加载默认字典
   -lad, -load-api-dict      是否加载api字典

输出:
   -o, -output string  输出文件路径(可忽略)
   -csv                csv格式输出
   -html               html格式输出
   -silent             简略输出
   -nc, -no-color      无颜色输出
   -vb, -verbose       详细输出模式
   -v, -version        输出版本

端口扫描:
   -n, -naabu                       端口扫描
   -port string                     端口(80,443, 100-200)
   -tp, -top-ports string           top端口(100,200,300)
   -ns, -naabu-scan-type string     端口扫描类型(SYN/CONNECT) (default "s")
   -sn, -naabu-host-discovery       只允许主机发现
   -Pn, -skip-host-discovery        跳过主机发现
   -no, -naabu-output string        端口扫描结果保存 支持csv格式输出
   -nsi, -naabu-source-ip string    端口扫描源IP
   -nsp, -naabu-source-port string  端口扫描源端口
   -ne, -naabu-exclude-cdn          端口扫描排除cdn

工具:
   -clear                          清理历史任务
   -gh, -get-hash                  计算hash
   -shm, -skip-hash-method string  指定hash的方法(sha256,md5,sha1) (default "sha256")

配置:
   -rs, -retries int                 重试
   -p, -proxy string                 代理
   -f, -favicon                      自动识别favicon
   -resolvers string[]               自定义DNS列表( 文件或逗号隔开 )
   -pa, -proxy-auth string           代理认证,以冒号分割(username:password)
   -st, -scan-target                 只进行目标存活扫描
   -nn, -not-new                     允许重定向
   -sdl, -scan-domain-list string[]  从响应中中发现其他域名(逗号隔开,支持文件读取 -sdl /tmp/otherDomain.txt)
   -sd, -scan-domain                 从响应中发现其他域名

请求头参数:
   -m, -method string[]          请求方法 [GET HEAD POST PUT PATCH DELETE CONNECT OPTIONS TRACE] (default ["GET"])
   -ua, -user-agent string[]     User-Agent (支持从文件中录入 -ua /tmp/user-agent.txt)
   -c, -cookie string            cookie
   -auth, -authorization string  Auth请求头
   -header string[]              自定义请求头,以逗号隔开 (支持从文件中录入 -header /tmp/header.txt)
   -b, -body string              自定义请求体

速率:
   -t, -thread int         线程 (default 30)
   -rl, -rate-limit int    每秒允许的HTTP连接数 (default 150)
   -nr, -naabu-rate int    端口扫描速率 (default 1000)
   -timeout int            超时时间 (default 10)
   -wt, -wait-timeout int  自定义任务结束前的等待,一般用于结束结束时间果断,导致无法发现更多目标 (default 3)

更新:
   -update             更新版本
   -um, -update-match  更新指纹识别库
   -am, -auto-match    跳过自动检查更新


EXAMPLES:

运行 pathScan 扫描路径, 指定单个目标 跳过404输出:
    $ pathScan -u https://example.com/ -sc 404

运行 pathScan 递归扫描 指定单个目标:
    $ pathScan -r -u https://example.com/ -sc 404 

运行 pathScan 搜索引擎 并指定多个路径:
    $ pathScan -uc -ue fofa -uq 'app="tomcat"' -pf "/,/api/v1/user"

运行 pathScan 收集子域名 指定输出:
    $ pathScan -s -sq 'example.com' -csv -o out.csv

运行 pathScan 端口扫描 并指定前1000个端口:
    $ pathScan -u example.com -n -csv -o out.csv -tp 1000

运行 pathScan 收集子域名 并端口扫描:
    $ pathScan -s -sq 'example.com' -n -port 80,443,8080 -csv -o out.csv 

其他文档可在以下网址获得: https://github.com/wjlin0/pathScan/

运行pathScan

pathScan -t https://wjlin0.com
# 从管道中加载
cat url.txt | pathScan -tc
# 恢复上次扫描
pathScan -resume Hc7wUXRoH2G1RjrNgjB2OMzXlXo1Hg.cfg
# 输出
pathScan -u https://wjlin0.com -csv -output 1.csv
# 自定义请求头
pathScan -u https://wjlin0.com -header User-Agent:pathScan/1.8,Cookie:a=1  -header a:1
# 跳过指定hash,指定长度
pathScan -u https://wjlin0.com -sh 291583051dfea8f6e512e25121cb09209b8e57402f0d32dcd8d1b611f16a3b20 -sbl 114763

收集某个资产

pathScan -s -sq baidu.com -sd -o output/baidu/baidu.csv -csv

自定义指纹

采用配置文件的方式,可自定义加载指纹识别库 -> pathScan-match 如果您掌握某些系统的指纹识别方法 欢迎至指纹识别库中提交 pull

rules:
  - name: "ctfd"
    matchers:
      - type: regex
        part: body
        regex:
          - <small class=(?:['"]{1}.*)> ?Powered by CTFd ?</small>

集成到自己的工具中

package main

import (
	"fmt"
	"github.com/projectdiscovery/gologger"
	"github.com/wjlin0/pathScan/pkg/result"
	"github.com/wjlin0/pathScan/pkg/runner"
	"os"
)

func main() {
	options := &runner.Options{Url: []string{
		"https://wjlin0.com/",
	},
		Timeout: 2,
		ResultBack: func(result *result.Result) {
			fmt.Println(result)
		},
		Method: []string{"GET"},
		Path:   []string{"/"},
	}
	run, err := runner.NewRunner(options)
	if err != nil || run == nil {
		if err != nil {
			gologger.Print().Msg(fmt.Sprintf("Unable to create Runner:%s", err.Error()))
			os.Exit(-1)
		}
		return
	}
	panic(run.RunEnumeration())
}

pathScan 支持默认配置文件位于下面两个路径,它允许您在配置文件中定义任何标志并设置默认值以包括所有扫描。

  • $HOME/.config/pathScan/config.yaml
  • $HOME/.config/pathScan/provider-config.yaml

警告

由于这个项目是自己一个人开发,在发布前没有做什么测试,都是在后面自己使用的时候发现问题才回去修复bug,所以大家尽量看到有新版本,即使更新

我向下适配也做得不好,可能一些在线校对的(比如 字典、html模板等下载),不会去适配低版本,为了大家的体验还是尽量选择更新

感谢

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
example command
pathScan command
pprof-text command
pkg
api

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL