Grep Domainnames from text with domgrep
This commit is contained in:
17
domgrep.py
Executable file
17
domgrep.py
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
pattern=re.compile(r'\d+\.\d+\.\d+\.\d+')
|
||||||
|
for line in sys.stdin:
|
||||||
|
line=line.strip()
|
||||||
|
if not line.lower().startswith('http'):
|
||||||
|
line="http://"+line
|
||||||
|
try:
|
||||||
|
p=urlparse(line)
|
||||||
|
if not pattern.search(p.netloc):
|
||||||
|
print(p.netloc)
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
pass
|
||||||
Reference in New Issue
Block a user