Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Zarcolio/grepaddr

Use grepaddr to extract (grep) all kinds of addresses from stdin like URLs (incl. IPv4/IPv6), IP addresses & ranges (IPv4/IPv6), e-mail addresses, MAC addresses.
https://github.com/Zarcolio/grepaddr

bugbounty command-line ctf ctf-tools e-mail extract grep-like hacking ip-addresses ipv4 ipv6 mac-address pentesting python python3 recon reconnaissance urls

Last synced: about 1 month ago
JSON representation

Use grepaddr to extract (grep) all kinds of addresses from stdin like URLs (incl. IPv4/IPv6), IP addresses & ranges (IPv4/IPv6), e-mail addresses, MAC addresses.

Awesome Lists containing this project

README

        

![](https://img.shields.io/github/license/Zarcolio/grepaddr) ![](https://badges.pufler.dev/visits/Zarcolio/grepaddr) ![](https://img.shields.io/github/stars/Zarcolio/grepaddr) ![](https://img.shields.io/github/forks/Zarcolio/grepaddr) ![](https://img.shields.io/github/issues/Zarcolio/grepaddr) ![](https://img.shields.io/github/issues-closed-raw/Zarcolio/grepaddr) ![](https://img.shields.io/github/issues-pr/Zarcolio/grepaddr) ![](https://img.shields.io/github/issues-pr-closed-raw/Zarcolio/grepaddr)

# About [GrepAddr](https://github.com/Zarcolio/grepaddr)
GrepAddr takes input from stdin and extracts different kinds of addresses from stdin like URLs, IP addresses, e-mail addresses, MAC addresses and more. Essentially it's grep, but for interesting addresses.

Because the script uses regexp, it's very common to get false positives for FQDNs.
The options --resolve (FQDNs only) --iana and --private can be used to reduce the number of false positives.

# Why use GrepAddr?
Several tools and scripts exist on the internet which similar functionality but usually only for a single address type, for example xurlsx, xpath-url-extraction and relative-url-extractor. Little/none of them can grep as many addresses type like GrepAddr can. You can use GrepAddr when doing a pen test or CTF, or when persuing a bug bounty.

# Install
GrepAddr should be able to grep addreases with a default Kali Linux installation without installing additional Python packages.
Just run:
```
git clone https://github.com/Zarcolio/grepaddr
cd grepaddr
sudo bash install.sh
```
When using the installer in an automated environment, use the following command for an automated installation:
```
sudo bash install.sh -auto
```

If you're running into trouble running GrepAddr, please drop me an issue and I'll try to fix it :)

# Usage
```
usage: grepaddr [-h] [-fqdn] [-srv] [-email] [--port] [--iana] [--private] [--resolve] [-ipv4] [-cidr4]
[-ipv6] [-cidr6] [-mac] [-url] [-relurl] [--baseurl ] [--basetag] [-csv ] [-decode ]
[-unescape ]

Use GrepAddr to extract different kinds of addresses from stdin. If no arguments are given, addresses
of all types are shown.

optional arguments:
-h, --help show this help message and exit
-fqdn Extract fully qualified domain names.
-srv Extract DNS SRV records.
-email Extract e-mail addresses.
--port Include :port for extraction.
--iana Extract FQDNs with IANA registered TLDs , use with -fqdn, -srv or -email . No
impact on other options.
--private Extract FQDNs with TLDs for private use, use with -fqdn. No impact on other options.
--resolve Display only those FQDNs that can be resolved. Cannot be used together with
--iana or --private. No impact on other options.
-ipv4 Extract IP version 4 addresses.
-cidr4 Extract IP version 4 addresses in CIDR notation.
-ipv6 Extract IP version 6 addresses.
-cidr6 Extract IP version 6 addresses in CIDR notation.
-mac Extract MAC addresses.
-url Extract URLs (FQDN, IPv4, IPv6, mailto and generic detection of schemes).
-relurl Extract relative URLs.
--basetag Search for base URL in and prepend it to URLS. Use with -url and/or -relurl.
--baseurl Provide a base URL which is prepended to relative URLS starting at root. Use
with -url and/or -relurl.
-csv Save addresses found to this CSV file.
-decode URL decode input this many times before extracting FQDNs.
-unslash Unescape slashes within input this many times before extracting FQDNs.
```
# Examples
It's really easy to grep all supported addresses from stdin, just run:
```
wget -qO - https://twitter.com|grepaddr -csv twitter.csv
```
Want to extract addresses of certain type? Choose one of the options, for example -mac and run:
```
wget -qO - https://nl.wikipedia.org/wiki/MAC-adres|grepaddr -mac
```
Want to grep FQDNs with a private TLD, just run:
```
wget -qO - https://serverfault.com/questions/17255/top-level-domain-domain-suffix-for-private-network|grepaddr -fqdn --private
```
Want to extract FQDNs and show only resolved FQDNs URLs needed to be decoded first, just run:
```
wget -qO - https://twitter.com|grepaddr -fqdn --resolve --decode 1
```
Want to grep all addresses with the least chance of false positives without having to wait for resolving FQDNs:
```
wget -qO - https://twitter.com|grepaddr --iana
```
Want to extract all addresses and convert relative URLs starting at the root to an absolute URL:
```
wget -qO - https://twitter.com|grepaddr --base https://twitter.com
```
Want to extract addresses from a binary, use it together with strings:
```
string binary.ext|grepaddr
```
When looking for URLs from the current user hive within Windows' registry, run these commands:

Within Windows:
```
reg export HKCU hkcu.reg
```
Within your favorite Unix-like OS:
```
dos2unix -f hkcu.reg
strings hkcu.reg|grepaddr -url
```

# Contribute?
Do you have some usefull additions to GrepAddr:

* [![PR's Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](https://github.com/Zarcolio/grepaddr/pulls)
* [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/zarcolio.svg?style=social&label=Contact%20me)](https://twitter.com/zarcolio)