ptrstream

- Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.acid.vegas/-c.git
Log | Files | Refs | Archive | README

commit 1b3fb6b722c40531f72c893e14c6e15b137df450
parent 4cf3df7e2cb523a5f2fdf788be1a9587587c232f
Author: acidvegas <acid.vegas@acid.vegas>
Date: Thu, 23 Nov 2023 04:33:52 -0500

Coloring added

Diffstat:
A.screens/preview.png | 0
MREADME.md | 7+++----
Mptrstream.py | 26+++++++++++++++++++++-----

3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/.screens/preview.png b/.screens/preview.png
Binary files differ.
diff --git 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
@@ -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: