本文整理汇总了Python中whois.whois方法的典型用法代码示例。如果您正苦于以下问题:Python whois.whois方法的具体用法?Python whois.whois怎么用?Python whois.whois使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类whois
的用法示例。
在下文中一共展示了whois.whois方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: whoisSorgu
# 需要导入模块: import whois [as 别名]
# 或者: from whois import whois [as 别名]
def whoisSorgu(url,dosyaAdi):
query = whois.whois(url)
print "[+]Domain: ", query.domain
print "[+]Update time: ", query.get('updated_date')
print "[+]Expiration time: ", query.get('expiration_date')
print "[+]Name server: ", query.get('name_servers')
print "[+]Email: ", query.get('emails')
rapor = open(dosyaAdi, "a")
raporIcerik=""
raporIcerik+="[+]Domain: "+query.domain+"\n"
raporIcerik+="[+]Update time: "+str(query.get('updated_date'))+"\n"
raporIcerik+="[+]Expiration time: "+str(query.get('expiration_date'))+"\n"
raporIcerik+="[+]Name server: "+str(query.get('name_servers'))+"\n"
raporIcerik+="[+]Email: "+str(query.get('emails'))+"\n"
rapor.write(raporIcerik)
rapor.close()
示例2: whois_ip
# 需要导入模块: import whois [as 别名]
# 或者: from whois import whois [as 别名]
def whois_ip(ip):
# Default to not found
cidr, ranges = "CIDR not found", "Range not found"
# Get whois for IP. Returns a list with dictionary
ip_dict = IPWhois(ip).lookup_rws()
if ip_dict['nets'][0].get('cidr'):
cidr = ip_dict['nets'][0].get('cidr')
if ip_dict['nets'][0].get('range'):
ranges = ip_dict['nets'][0].get('range')
sleep(2)
return cidr, ranges
示例3: ip
# 需要导入模块: import whois [as 别名]
# 或者: from whois import whois [as 别名]
def ip(self):
whois_data = IPWhois(self.artifact['name'])
try:
data = whois_data.lookup_whois()
if data is not None:
self.artifact['data']['whois'] = {}
# collect ASN information
self.artifact['data']['whois']['asn'] = data['asn']
self.artifact['data']['whois']['asn']['cidr'] = data['asn_cidr']
self.artifact['data']['whois']['asn']['description'] = data['asn_description']
self.artifact['data']['whois']['asn']['country'] = data['asn_country_code']
if 'nets' in data.keys() and len(data['nets']) > 0:
net_data = data['nets'][0]
self.artifact['data']['whois']['address'] = net_data['address']
self.artifact['data']['whois']['state'] = net_data['state']
self.artifact['data']['whois']['emails'] = net_data['emails']
except Exception as err:
warning('Caught unhandled exception: %s' % str(err))
示例4: LogPattern_search
# 需要导入模块: import whois [as 别名]
# 或者: from whois import whois [as 别名]
def LogPattern_search(Line):
global ResTimestamp
global ResRequestEx
global ResRefererEx
try:
# Group is [0]: timestamp, [1]: file request, [2]: referer
ResRegEx = CompRegEx.match(Line).group(1, 2, 3)
ResTimestamp = ResRegEx[0]
ResRequestEx = ResRegEx[1]
if ResRegEx[2] is not '-':
ResRefererEx = ResRegEx[2]
except:
# Except direct connexion
pass
# Domain extraction (for whois)
# TODO: find a way for whois request behind a HTTP proxy
示例5: dns
# 需要导入模块: import whois [as 别名]
# 或者: from whois import whois [as 别名]
def dns():
description = """
Targets, whether it be a company or a person, may utilize domains in order to
display web content. Domains, especially those that are not properly configured,
give penetration testers great opportunity to gather sensitive information in the
form of metadata, whether it be an address from a WHOIS lookup, or nameservers."""
form = forms.DNSForm()
if flask.request.method == "POST":
whois_data = whois.whois(flask.request.form["url"])
# Subdomain enumeration using crt.sh
_subdomain = subdomain_search(flask.request.form["url"])
subdomain = [y['domain'] for y in to_dict_from_json(_subdomain)]
# Re-render with appopriate parameters
return flask.render_template('dns.html', title="DNS Enumeration Module",
user=user, description=description,
form=form, whois=whois_data, subdomain=subdomain)
else:
return flask.render_template('dns.html', title="DNS Enumeration Module",
user=user,description=description,
form=form, whois=None, subdomain=None)
# register filters
示例6: __init__
# 需要导入模块: import whois [as 别名]
# 或者: from whois import whois [as 别名]
def __init__(self):
"""Everything that should be initiated with a new object goes here."""
try:
self.whoxy_api_key = helpers.config_section_map("WhoXY")["api_key"]
try:
balance_endpoint = self.whoxy_balance_uri.format(self.whoxy_api_key)
balance_json = requests.get(balance_endpoint,timeout=self.requests_timeout).json()
live_whois_balance = balance_json['live_whois_balance']
reverse_whois_balance = balance_json['reverse_whois_balance']
if live_whois_balance < 50:
click.secho("[*] You are low on WhoXY whois credits: {} credits".format(live_whois_balance),fg="yellow")
if reverse_whois_balance < 50:
click.secho("[*] You are low on WhoXY reverse whois credits: {} credits".format(reverse_whois_balance),fg="yellow")
except requests.exceptions.Timeout:
click.secho("\n[!] The connection to WhoXY timed out!",fg="red")
except requests.exceptions.TooManyRedirects:
click.secho("\n[!] The connection to WhoXY encountered too many redirects!",fg="red")
except requests.exceptions.RequestException as error:
click.secho("\n[!] The connection to WhoXY encountered an error!",fg="red")
click.secho("L.. Details: {}".format(error),fg="red")
except Exception:
self.whoxy_api_key = None
click.secho("[!] Did not find a WhoXY API key.",fg="yellow")
示例7: check_whois
# 需要导入模块: import whois [as 别名]
# 或者: from whois import whois [as 别名]
def check_whois():
for line in open(sys.argv[1], "r", encoding="utf8"):
if line[0]== '#':
pass
else:
try:
w = whois.whois(line[:-1])
print("""
=============== Domain: {} ==============
NameServer: {} \n
Name: {} \n
Organization: {} \n
Register Date: {} \n
Expiration Date: {} \n
=========================================""".format(line[:-1], w.name_servers, w.name, w.org , w.creation_date, w.expiration_date))
except:
print("WHOIS NOT FOUND: {}".format(line[:-1]))
示例8: whois_lookup
# 需要导入模块: import whois [as 别名]
# 或者: from whois import whois [as 别名]
def whois_lookup():
"""Perform whois."""
try:
print colored('Enter a URL to get whois data', 'green')
domain = raw_input(colored('(netpwn: whois) > ', 'red'))
target = [domain]
targets = whois(target[0])
print colored('name: ' + targets['name'], 'green')
print colored('city: ' + targets['city'], 'green')
print colored('zipcode: ' + targets['zipcode'], 'green')
print colored('country: ' + targets['country'], 'green')
print colored('state: ' + targets['state'], 'green')
print colored('registrar: ' + targets['registrar'], 'green')
print colored('address : ' + targets['address'], 'green')
print colored('org : ' + targets['org'], 'green')
for domains in targets['domain_name']:
print colored('DNS: ' + domains, 'green')
for emails in targets['emails']:
print colored('emails : ' + emails, 'green')
except TypeError:
print colored('Cannot retrieve information', 'red')
示例9: test_simple_ascii_domain
# 需要导入模块: import whois [as 别名]
# 或者: from whois import whois [as 别名]
def test_simple_ascii_domain(self):
domain = 'google.com'
whois(domain)
示例10: whois
# 需要导入模块: import whois [as 别名]
# 或者: from whois import whois [as 别名]
def whois(self, w_url):
try:
whois_query = whois.whois(w_url)
self.whois_result = whois_query
return self.whois_result
except:
print("Could not find perform whois")
示例11: whois_target
# 需要导入模块: import whois [as 别名]
# 或者: from whois import whois [as 别名]
def whois_target(host):
# Technically this is still passive recon
# because you still aren't hitting target
w = whois.whois(host)
return w.text, w.emails, w
示例12: whoisnew
# 需要导入模块: import whois [as 别名]
# 或者: from whois import whois [as 别名]
def whoisnew(domain):
try:
w = whois.whois(domain)
return dict(w)
except:
return {}
示例13: test_simple_unicode_domain
# 需要导入模块: import whois [as 别名]
# 或者: from whois import whois [as 别名]
def test_simple_unicode_domain(self):
domain = 'нарояци.com'
whois(domain)
示例14: test_unicode_domain_and_tld
# 需要导入模块: import whois [as 别名]
# 或者: from whois import whois [as 别名]
def test_unicode_domain_and_tld(self):
domain = 'россия.рф'
whois(domain)
示例15: test_ipv4
# 需要导入模块: import whois [as 别名]
# 或者: from whois import whois [as 别名]
def test_ipv4(self):
""" Verify ipv4 addresses. """
domain = '172.217.3.110'
whois_results = whois(domain)
if isinstance(whois_results['domain_name'], list):
domain_names = [_.lower() for _ in whois_results['domain_name']]
else:
domain_names = [whois_results['domain_name'].lower()]
self.assertIn('1e100.net', domain_names)
self.assertIn('ns1.google.com', [_.lower() for _ in whois_results['name_servers']])