mirror of
https://github.com/adulau/DomainClassifier.git
synced 2024-11-22 18:07:07 +00:00
ipaddress() method fixed
The ipaddress returns a list of IP addresses associated with the potential domains found.
This commit is contained in:
parent
7e328b6d8a
commit
fec097149d
1 changed files with 9 additions and 9 deletions
|
@ -144,6 +144,7 @@ class Extract:
|
||||||
"""ipaddress method extracts from the domain list the valid IPv4 addresses"""
|
"""ipaddress method extracts from the domain list the valid IPv4 addresses"""
|
||||||
|
|
||||||
def ipaddress(self, extended=False):
|
def ipaddress(self, extended=False):
|
||||||
|
|
||||||
if extended is False:
|
if extended is False:
|
||||||
self.ipaddresses = []
|
self.ipaddresses = []
|
||||||
else:
|
else:
|
||||||
|
@ -151,15 +152,15 @@ class Extract:
|
||||||
|
|
||||||
for d in self.domain:
|
for d in self.domain:
|
||||||
try:
|
try:
|
||||||
socket.inet_aton(d)
|
ip = socket.gethostbyname(d)
|
||||||
except:
|
except:
|
||||||
pass
|
continue
|
||||||
else:
|
|
||||||
if extended is False:
|
if extended is False:
|
||||||
self.ipaddresses.append((d))
|
self.ipaddresses.append((ip))
|
||||||
else:
|
else:
|
||||||
orig = self.__origin(ipaddr=d)
|
orig = self.__origin(ipaddr=ip)
|
||||||
self.ipaddresses.add((d, str(orig)))
|
self.ipaddresses.add((ip, str(orig)))
|
||||||
|
|
||||||
return self.ipaddresses
|
return self.ipaddresses
|
||||||
|
|
||||||
|
@ -279,9 +280,8 @@ if __name__ == "__main__":
|
||||||
print "Ranking:"
|
print "Ranking:"
|
||||||
print c.rankdomain()
|
print c.rankdomain()
|
||||||
print "List of ip addresses:"
|
print "List of ip addresses:"
|
||||||
print c.ipaddress(extended=True)
|
print c.ipaddress(extended=False)
|
||||||
print "Include dot.lu:"
|
print "Include dot.lu:"
|
||||||
print c.include(expression=r'\.lu$')
|
print c.include(expression=r'\.lu$')
|
||||||
print "Exclude dot.lu:"
|
print "Exclude dot.lu:"
|
||||||
print c.exclude(expression=r'\.lu$')
|
print c.exclude(expression=r'\.lu$')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue