ptr-search example added

This commit is contained in:
Alexandre Dulaunoy 2014-01-12 11:38:47 +01:00
parent f351bb975f
commit d0dd9d700e
2 changed files with 26 additions and 2 deletions

View file

@ -9,3 +9,26 @@ Requirements
- Python 3
- Python [redis](https://pypi.python.org/pypi/redis/) client
- Redis [LevelDB server](https://github.com/KDr2/redis-leveldb)
- [netaddr](https://github.com/drkjam/netaddr)
Usage
-----
```shell
./bin/ptr-search.py -s 108.4.0.0/28
108.4.0.1,L100.RCMDVA-VFTTP-20.verizon-gni.net
108.4.0.2,pool-108-4-0-2.rcmdva.fios.verizon.net
108.4.0.3,pool-108-4-0-3.rcmdva.fios.verizon.net
108.4.0.4,pool-108-4-0-4.rcmdva.fios.verizon.net
108.4.0.5,pool-108-4-0-5.rcmdva.fios.verizon.net
108.4.0.6,pool-108-4-0-6.rcmdva.fios.verizon.net
108.4.0.7,pool-108-4-0-7.rcmdva.fios.verizon.net
108.4.0.8,pool-108-4-0-8.rcmdva.fios.verizon.net
108.4.0.9,pool-108-4-0-9.rcmdva.fios.verizon.net
108.4.0.10,pool-108-4-0-10.rcmdva.fios.verizon.net
108.4.0.11,pool-108-4-0-11.rcmdva.fios.verizon.net
108.4.0.12,pool-108-4-0-12.rcmdva.fios.verizon.net
108.4.0.13,pool-108-4-0-13.rcmdva.fios.verizon.net
108.4.0.14,pool-108-4-0-14.rcmdva.fios.verizon.net
108.4.0.15,pool-108-4-0-15.rcmdva.fios.verizon.net
```

View file

@ -14,7 +14,7 @@ import netaddr
argParser = argparse.ArgumentParser(description='ptr-db: Search PTR records')
argParser.add_argument('-s', action='append', help='IPv4 subnet to lookup')
argParser.add_argument('-v', action='store_true', default=False, help='Dump queries')
argParser.add_argument('-v', action='store_true', default=False, help='Verbose output including non-existing PTR records')
args = argParser.parse_args()
if args.s is None:
@ -32,4 +32,5 @@ for subnet in args.s:
if ptr is not None:
print (str(ip)+","+str(r.get(ip), 'utf-8'))
else:
print (str(ip))
if args.v:
print (str(ip))