Coloring added
This commit is contained in:
parent
4cf3df7e2c
commit
1b3fb6b722
BIN
.screens/preview.png
Normal file
BIN
.screens/preview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 74 KiB |
@ -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.
|
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
|
## Requirements
|
||||||
- [python](https://www.python.org/)
|
- [python](https://www.python.org/)
|
||||||
- [aiodns](https://pypi.org/project/aiodns/) *(pip install aiodns)*
|
- [aiodns](https://pypi.org/project/aiodns/) *(pip install aiodns)*
|
||||||
@ -21,8 +23,6 @@ python ptrstream.py [options]
|
|||||||
## Now what?
|
## 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.
|
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.
|
Output to elastic search possibly.
|
||||||
|
|
||||||
Still a work in progress I guess...
|
Still a work in progress I guess...
|
||||||
|
26
ptrstream.py
26
ptrstream.py
@ -87,12 +87,28 @@ async def main():
|
|||||||
for task in done:
|
for task in done:
|
||||||
ip, result = task.result()
|
ip, result = task.result()
|
||||||
if result:
|
if result:
|
||||||
for exclude in ('undefined.hostname.localhost', 'localhost', '127.0.0.1'):
|
if result in ('127.0.0.1','localhost'):
|
||||||
if result == exclude:
|
print(f'\033[35m{ip.ljust(15)}\033[0m \033[90m-> {result}\033[0m')
|
||||||
continue
|
elif ip in result:
|
||||||
print(f'\033[96m{ip.ljust(15)}\033[0m \033[90m->\033[0m \033[93m{result}\033[0m')
|
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}')
|
results_cache.append(f'{ip}:{result}')
|
||||||
|
|
||||||
if len(results_cache) >= 1000:
|
if len(results_cache) >= 1000:
|
||||||
stamp = time.strftime('%Y%m%d')
|
stamp = time.strftime('%Y%m%d')
|
||||||
with open(f'ptr_{stamp}_{seed}.txt', 'a') as file:
|
with open(f'ptr_{stamp}_{seed}.txt', 'a') as file:
|
||||||
|
Loading…
Reference in New Issue
Block a user