pathScan

command module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

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

GitHub Repo stars

特征

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

用法

pathScan -h
Usage:
  pathScan [flags]

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

安装pathScan

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

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

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

wget https://github.com/wjlin0/pathScan/releases/download/v1.1.4/pathScan_v1.1.4_windows_amd64.zip
wget https://github.com/wjlin0/pathScan/releases/download/v1.1.4/pathScan_v1.1.4_linux_amd64.zip

Docker

# 已提供docker文件自行编译
docker build -t pathScan .
docker run --rm --name pathScan -it pathScan  -u https://wjlin0.com -vb

自行编译

git clone https://github.com/wjlin0/pathScan.git && cd pathScan
go install github.com/goreleaser/goreleaser@latest
goreleaser release --snapshot --skip-publish --skip-docker --rm-dist

运行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 -ue fofa,quake,zoomeye -uc -uq "baidu.com" -sd -o output/baidu/baidu.csv -csv

自定义指纹

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

version: "v1.0.0"
rules:
  - name: "Thinkphp"
    matchers:
      - type: regex
        part: header
        regex:
          - "ThinkPHP"
  - name: "Apache"
    matchers:
      - type: regex
        part: header
        name: Apache
        regex: 
          - "Server: .*?([aA]{1}pache[/]?[\\d\\.]*) ?"
        group: 1
  - name: "Nginx"
    matchers:
      - type: regex
        name: nginx
        part: header
        regex: 
          - "Server: .*?([nN]{1}ginx[/]?[\\d\\.]*) ?"
        group: 1 # 指定后匹配的名字为正则匹配后的第1个元素

集成到自己的工具中

package main

import (
    "fmt"
    "github.com/projectdiscovery/gologger"
    "github.com/wjlin0/pathScan/pkg/result"
    "github.com/wjlin0/pathScan/pkg/runner"
    "github.com/wjlin0/pathScan/pkg/util"
    "os"
    "os/signal"
    "path/filepath"
    "time"
)

func main() {
	options := &runner.Options{Url: []string{
		"https://localhost:8000",
	},
		RateHttp:    2,
		TimeoutTCP:  2 * time.Second,
		TimeoutHttp: 2 * time.Second,
		ResultBack: func(result *result.TargetResult) {
			fmt.Println(result)
		},
		Method: "GET",
		Path: []string{
			"/",
		},
	}
	run, err := runner.NewRunner(options)
	if err != nil {
		gologger.Print().Msg(fmt.Sprintf("无法创建Runner: %s", err.Error()))
		os.Exit(0)
	}
	if run == nil {
		os.Exit(0)
	}

	c := make(chan os.Signal, 1)
	signal.Notify(c, os.Interrupt)
	go func() {
		for range c {
			gologger.Info().Msg("CTRL+C 按下: Exiting")
			filename := util.RandStr(30) + ".cfg"
			fmt.Println(filepath.Join(runner.DefaultResumeFolderPath(), filename))
			err := run.Cfg.MarshalResume(filename)
			if err != nil {
				gologger.Error().Msgf("无法创建 resume 文件: %s", err.Error())
			}
			os.Exit(1)
		}
	}()
	err = run.Run()
	if err != nil {
		gologger.Fatal().Msgf("无法 运行: %s", err.Error())
	}
	run.Cfg.CleanupResumeConfig()
}

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.

Jump to

Keyboard shortcuts

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