hitman
is a command-line tool written in Rust that extracts IPv4, IPv6 addresses, and fully qualified domain names (FQDNs) from a text file. It uses the clap
crate for command-line argument parsing and the ripgrep
crate for efficient regular expression searching.
- Extract IPv4 addresses
- Extract IPv6 addresses
- Extract FQDNs
- Input via file or standard input
- Output to screen or file
- Quiet mode for suppressing stdout output when writing to a file
- Ensure you have Rust and Cargo installed. If not, install them from here.
- Clone the repository:
git clone https://github.com/yourusername/hitman.git cd hitman
- Build the project:
cargo build --release
You can use hitman
by providing a text file as input or by piping text via standard input.
cargo run -- --file sample.txt
cat sample.txt | cargo run
To save the extracted results to a file:
cargo run -- --file sample.txt --out output.txt
To suppress output to the screen when saving results to a file, use the -q
flag:
cargo run -- --file sample.txt --out output.txt -q
-f, --file <FILE>
: Specify the input file to read.-o, --out <FILE>
: Specify the output file to write results.-q, --quiet
: Quiet mode, no output to stdout.
# Extract from a file and display on screen
cargo run -- --file sample.txt
# Extract from a file and save to output.txt
cargo run -- --file sample.txt --out output.txt
# Extract from standard input and display on screen
cat sample.txt | cargo run
# Extract from standard input and save to output.txt quietly
cat sample.txt | cargo run -- --out output.txt -q
This project is licensed under the GPL-3.0 license. See the LICENSE file for details.