mirror of
https://github.com/adulau/DomainClassifier.git
synced 2024-11-07 11:56:25 +00:00
potentialdomain() is now called at the init
To avoid confusion the method name domain() has been renamed to potentialdomain().
This commit is contained in:
parent
b32ff4a776
commit
80dc03f59c
2 changed files with 6 additions and 5 deletions
|
@ -30,6 +30,7 @@ class Extract:
|
||||||
self.presolver.lifetime = 1.0
|
self.presolver.lifetime = 1.0
|
||||||
self.bgprankingserver = 'pdns.circl.lu'
|
self.bgprankingserver = 'pdns.circl.lu'
|
||||||
self.vdomain = []
|
self.vdomain = []
|
||||||
|
self.domain = self.potentialdomain()
|
||||||
|
|
||||||
"""__origin is a private function to the ASN lookup for an IP address via
|
"""__origin is a private function to the ASN lookup for an IP address via
|
||||||
the Team Cymru DNS interface. ipadd is a string contain the IP address in a
|
the Team Cymru DNS interface. ipadd is a string contain the IP address in a
|
||||||
|
@ -74,12 +75,12 @@ class Extract:
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
"""domain method extracts potential domains matching any
|
"""potentialdomain method extracts potential domains matching any
|
||||||
string that is a serie of string with maximun 63 character separated by a
|
string that is a serie of string with maximun 63 character separated by a
|
||||||
dot. The method used the rawtext defined at the instantiation of the class.
|
dot. The method used the rawtext defined at the instantiation of the class.
|
||||||
This return a list of a potential domain."""
|
This return a list of a potential domain."""
|
||||||
|
|
||||||
def domain(self):
|
def potentialdomain(self):
|
||||||
self.domain = []
|
self.domain = []
|
||||||
domain = re.compile(r'\b([a-zA-Z\d-]{,63}(\.[a-zA-Z\d-]{,63})+)\b')
|
domain = re.compile(r'\b([a-zA-Z\d-]{,63}(\.[a-zA-Z\d-]{,63})+)\b')
|
||||||
for x in domain.findall(self.rawtext):
|
for x in domain.findall(self.rawtext):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import domainclassifier
|
import domainclassifier
|
||||||
|
|
||||||
c = domainclassifier.Extract( rawtext = "www.xxx.com this is a text with a domain called test@foo.lu another test abc.lu something a.b.c.d.e end of 1.2.3.4 foo.be www.belnet.be http://www.cert.be/ www.public.lu www.allo.lu quuxtest www.eurodns.com something-broken-www.google.com www.google.lu trailing test www.facebook.com www.nic.ru www.youporn.com 8.8.8.8 201.1.1.1")
|
c = domainclassifier.Extract( rawtext = "www.xxx.com this is a text with a domain called test@foo.lu another test abc.lu something a.b.c.d.e end of 1.2.3.4 foo.be www.belnet.be http://www.cert.be/ www.public.lu www.allo.lu quuxtest www.eurodns.com something-broken-www.google.com www.google.lu trailing test www.facebook.com www.nic.ru www.youporn.com 8.8.8.8 201.1.1.1", nameservers = ['149.13.33.69'])
|
||||||
print c.domain()
|
#print c.potentialdomain()
|
||||||
print c.validdomain(extended=True)
|
print c.validdomain(extended=True)
|
||||||
print "US:"
|
print "US:"
|
||||||
print c.localizedomain(cc='US')
|
print c.localizedomain(cc='US')
|
||||||
|
|
Loading…
Reference in a new issue