HostCollision Documentation

repository·master·Indexed 20 days ago

https://github.com/pmiaowu/hostcollision

A specialized Java-based tool for host collision detection during penetration testing. It identifies internal systems requiring specific host bindings by scanning protocols against IP and host data sources. Supports configurable scanning protocols, thread management, and result exportation in CSV and TXT formats.

Tokens
1.6K
Snippets
5
Records
8
Agent score
22%

What's inside HostCollision

  1. HostCollision Directory Structure

    master

    The project structure is organized as follows:

    • HostCollision.jar: The main executable program.
    • config.yml: Configuration file containing program settings.
    • dataSource/: Directory containing input data:
      • ipList.txt: Input IP addresses (one per line).
      • hostList.txt: Input host addresses (one per line).
  2. Run HostCollision with default configuration

    master

    To run the tool using the default settings defined in config.yml, execute the JAR file without any arguments. The program will automatically read data from the dataSource directory (specifically ipList.txt and hostList.txt) to perform host collision matching.

    Upon completion, the tool generates a result file in the root directory named in the format YYYY-MM-DD_8digitRandomNumber.csv (or .txt depending on config).

    java -jar HostCollision.jar
  3. Compile HostCollision from source

    master

    HostCollision is a Java Maven project requiring Java 1.8. To compile the project:

    1. Import the source code into IntelliJ IDEA.
    2. Open /HostCollision/pom.xml to install the required dependencies (this may take some time on the first run).
    3. Build the project.

    Output Locations:

    • Compiled files: /HostCollision/target/HostCollision/
    • JAR file: /HostCollision/target/HostCollision/HostCollision.jar
    • Configuration file: /HostCollision/target/HostCollision/config.yml
    java -version # Ensure Java 1.8 is installed
  4. Use HostCollision CLI arguments

    master

    You can override the default config.yml settings by passing command-line arguments.

    Example Scenario: To set the scan protocol to http, limit the maximum threads to 1, export results in both csv and txt formats, and use custom IP/Host files located in the current directory:

    java -jar HostCollision.jar -sp "http" -t 1 -o "csv,txt" -ifp "./ips.txt" -hfp "./hosts.txt"
    java -jar HostCollision.jar -sp "http" -t 1 -o "csv,txt" -ifp "./ips.txt" -hfp "./hosts.txt"
  5. Export scan results to CSV or TXT

    master

    You can export the results of a successful collision using the -o (or --output) flag. Supported formats are csv and txt. Multiple formats can be specified by separating them with a comma.

    CSV Output Fields: When exporting to CSV, the following columns are generated:

    • 协议 (Protocol)
    • ip
    • host
    • 标题 (Title)
    • 匹配成功的数据包大小 (Matched packet size)
    • 原始的数据包大小 (Original packet size)
    • 绝对错误的数据包大小 (Absolute error packet size)
    • 相对错误的数据包大小 (Relative error packet size)
    • 匹配成功的数据包状态码 (Matched status code)
    • 原始的数据包状态码 (Original status code)
    • 绝对错误的数据包状态码 (Absolute error status code)
    • 相对错误的数据包状态码 (Relative error status code)

    TXT Output Format: 协议:%s, ip:%s, host:%s, title:%s, 匹配成功的数据包大小:%s, 状态码:%s 匹配成功

  6. Reference HostCollision CLI flags

    master

    Use the following flags to configure the scanning behavior:

    FlagLong FlagDescription
    -h-helpDisplay help documentation
    -sp-scanProtocolAllowed scanning protocols (e.g., http,https)
    -ifp-ipFilePathPath to the IP data source (e.g., ./dataSource/ipList.txt)
    -hfp-hostFilePathPath to the Host data source (e.g., ./dataSource/hostList.txt)
    -t-threadTotalMaximum number of total threads (e.g., 6)
    -o-outputExport format, comma-separated (e.g., csv,txt)
    -ioel-isOutputErrorLogWhether to output error logs (true to enable, false to disable)
    -cssc-collisionSuccessStatusCodeStatus codes considered a successful collision, comma-separated (e.g., 200,301,302)
    -dsn-dataSampleNumberNumber of data sample requests; set to 0 or less to disable this feature
    java -jar HostCollision.jar -h
  7. CLI Reference for HostCollision

    master

    HostCollision is a command-line tool used for scanning protocols against IP and Host data to identify collisions. Use the following flags to configure the scan behavior, data sources, and output formats.

    Options options = new Options();
    options.addOption("h", "help", false, "帮助");
    options.addOption("sp", "scanProtocol", true, "允许的扫描协议,使用逗号分割<例如:http,https>");
    options.addOption("ifp", "ipFilePath", true, "ip数据来源地址<例如:./dataSource/ipList.txt>");
    options.addOption("hfp", "hostFilePath", true, "host数据来源地址<例如:./dataSource/hostList.txt>");
    options.addOption("t", "threadTotal", true, "程序运行的最大线程总数<例如:6>");
    options.addOption("o", "output", true, "导出格式,使用逗号分割<例如:csv,txt>");
    options.addOption("ioel", "isOutputErrorLog", true, "是否将错误日志输出<例如:true 输出/false 关闭>");
    options.addOption("cssc", "collisionSuccessStatusCode", true, "认为碰撞成功的状态码,使用逗号分割<例如: 200,301,302>");
    options.addOption("dsn", "dataSampleNumber", true, "数据样本请求次数,小于等于0,表示关闭该功能");
  8. Configure HostCollision scan parameters

    master

    When running the HostCollision CLI, you can specify the following arguments to control the execution:

    FlagLong FlagDescription
    -h--helpDisplay help documentation
    -sp--scanProtocolAllowed scan protocols, comma-separated (e.g., http,https)
    -ifp--ipFilePathPath to the IP data source file (e.g., ./dataSource/ipList.txt)
    -hfp--hostFilePathPath to the Host data source file (e.g., ./dataSource/hostList.txt)
    -t--threadTotalMaximum number of threads to run (e.g., 6)
    -o--outputExport format, comma-separated (e.g., csv,txt)
    -ioel--isOutputErrorLogWhether to output error logs (true or false)
    -cssc--collisionSuccessStatusCodeHTTP status codes considered a successful collision, comma-separated (e.g., 200,301,302)
    -dsn--dataSampleNumberNumber of data sample requests; set to 0 or less to disable this feature