Added color and README
This commit is contained in:
parent
37157fb8b8
commit
4cf3df7e2c
27
README.md
27
README.md
@ -1,3 +1,28 @@
|
|||||||
# PTR Stream
|
# PTR Stream
|
||||||
|
|
||||||
## More to come
|
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.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
- [python](https://www.python.org/)
|
||||||
|
- [aiodns](https://pypi.org/project/aiodns/) *(pip install aiodns)*
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python ptrstream.py [options]
|
||||||
|
```
|
||||||
|
|
||||||
|
| Argument | Description |
|
||||||
|
| ---------------------- | ------------------------------------------------------------ |
|
||||||
|
| `-c`, `--concurrency` | Control the speed of lookups. *(Default = 50)* |
|
||||||
|
| `-t`, `--timeout` | Timeout for DNS lookups. |
|
||||||
|
| `-r`, `--resolvers` | File containing DNS servers to use for lookups. *(Optional)* |
|
||||||
|
|
||||||
|
## 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...
|
@ -60,7 +60,12 @@ async def main():
|
|||||||
tasks = []
|
tasks = []
|
||||||
results_cache = []
|
results_cache = []
|
||||||
|
|
||||||
|
if args.resolvers:
|
||||||
|
with open(args.resolvers) as file:
|
||||||
|
dns_servers = [server.strip() for server in file.readlines()]
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
if not args.resolvers:
|
||||||
dns_servers = []
|
dns_servers = []
|
||||||
while not dns_servers:
|
while not dns_servers:
|
||||||
try:
|
try:
|
||||||
@ -85,8 +90,7 @@ async def main():
|
|||||||
for exclude in ('undefined.hostname.localhost', 'localhost', '127.0.0.1'):
|
for exclude in ('undefined.hostname.localhost', 'localhost', '127.0.0.1'):
|
||||||
if result == exclude:
|
if result == exclude:
|
||||||
continue
|
continue
|
||||||
if not result.endswith('.in-addr.arpa') and result != ('undefined.hostname.localhost') and result != ('localhost.'):
|
print(f'\033[96m{ip.ljust(15)}\033[0m \033[90m->\033[0m \033[93m{result}\033[0m')
|
||||||
print(f'{ip.ljust(15)} -> {result}')
|
|
||||||
results_cache.append(f'{ip}:{result}')
|
results_cache.append(f'{ip}:{result}')
|
||||||
|
|
||||||
if len(results_cache) >= 1000:
|
if len(results_cache) >= 1000:
|
||||||
@ -101,6 +105,7 @@ if __name__ == '__main__':
|
|||||||
parser = argparse.ArgumentParser(description='Perform asynchronous reverse DNS lookups.')
|
parser = argparse.ArgumentParser(description='Perform asynchronous reverse DNS lookups.')
|
||||||
parser.add_argument('-c', '--concurrency', type=int, default=50, help='Control the speed of lookups.')
|
parser.add_argument('-c', '--concurrency', type=int, default=50, help='Control the speed of lookups.')
|
||||||
parser.add_argument('-t', '--timeout', type=int, default=5, help='Timeout for DNS lookups.')
|
parser.add_argument('-t', '--timeout', type=int, default=5, help='Timeout for DNS lookups.')
|
||||||
|
parser.add_argument('-r', '--resolvers', type=str, help='File containing DNS servers to use for lookups.')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
|
Loading…
Reference in New Issue
Block a user