diff --git a/.screens/preview.png b/.screens/preview.png new file mode 100644 index 0000000..9101904 Binary files /dev/null and b/.screens/preview.png differ diff --git a/README.md b/README.md index 104ac37..f58f5ff 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ PTRStream is an asynchronous reverse DNS lookup tool developed in Python. It generates random IP addresses and performs reverse DNS lookups using various DNS servers. +![](.screens/preview.png) + ## Requirements - [python](https://www.python.org/) - [aiodns](https://pypi.org/project/aiodns/) *(pip install aiodns)* @@ -21,8 +23,6 @@ python ptrstream.py [options] ## Now what? The results are cached and saved to a file named ptr_{date}_{seed}.txt after every 1000 successful lookups. After a full loop through every IP address, a new seed will generate and start the scan again. -Might add coloring based on classification *(government, data cetner, etc)* - Output to elastic search possibly. -Still a work in progress I guess... \ No newline at end of file +Still a work in progress I guess... diff --git a/ptrstream.py b/ptrstream.py index abf8639..4f6a8d5 100644 --- a/ptrstream.py +++ b/ptrstream.py @@ -87,12 +87,28 @@ async def main(): for task in done: ip, result = task.result() if result: - for exclude in ('undefined.hostname.localhost', 'localhost', '127.0.0.1'): - if result == exclude: - continue - print(f'\033[96m{ip.ljust(15)}\033[0m \033[90m->\033[0m \033[93m{result}\033[0m') + if result in ('127.0.0.1','localhost'): + print(f'\033[35m{ip.ljust(15)}\033[0m \033[90m-> {result}\033[0m') + elif ip in result: + result = result.replace(ip, f'\033[96m{ip}\033[93m') + elif (daship := ip.replace('.', '-')) in result: + result = result.replace(daship, f'\033[96m{daship}\033[93m') + print(f'\033[35m{ip.ljust(15)}\033[0m \033[90m->\033[0m \033[93m{result}\033[0m') + elif (revip := '.'.join(ip.split('.')[::-1])) in result: + result = result.replace(revip, f'\033[96m{revip}\033[93m') + print(f'\033[35m{ip.ljust(15)}\033[0m \033[90m->\033[0m \033[93m{result}\033[0m') + elif result.endswith('.gov') or result.endswith('.mil'): + result = result.replace('.gov', f'\033[31m.gov\033[0m') + result = result.replace('.mil', f'\033[31m.gov\033[0m') + print(f'\033[35m{ip.ljust(15)}\033[0m \033[90m->\033[0m \033[93m{result}\033[0m') + elif '.gov.' in result or '.mil.' in result: + result = result.replace('.gov.', f'\033[31m.gov.\033[0m') + result = result.replace('.mil.', f'\033[31m.mil.\033[0m') + print(f'\033[35m{ip.ljust(15)}\033[0m \033[90m->\033[0m \033[93m{result}\033[0m') + else: + scary = ('.gov') + print(f'\033[35m{ip.ljust(15)}\033[0m \033[90m->\033[0m \033[93m{result}\033[0m') results_cache.append(f'{ip}:{result}') - if len(results_cache) >= 1000: stamp = time.strftime('%Y%m%d') with open(f'ptr_{stamp}_{seed}.txt', 'a') as file: