本文整理汇总了Python中lxml.etree.HTML.split方法的典型用法代码示例。如果您正苦于以下问题:Python HTML.split方法的具体用法?Python HTML.split怎么用?Python HTML.split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lxml.etree.HTML
的用法示例。
在下文中一共展示了HTML.split方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doit
# 需要导入模块: from lxml.etree import HTML [as 别名]
# 或者: from lxml.etree.HTML import split [as 别名]
def doit(d):
if '<div' in d:
d = decode_first(d)
for p in decode_payloads(d):
urls = []
if 'application/x-shockwave-flash' in p:
t = 'flash'
x=p.strip().splitlines()[-2].replace("'",'"').split('"')
url_b=x[1].split('/')[1]
sh =x[-2].decode('hex').strip("\x00")
urls = re.findall('"(/'+url_b+'.*?)"',p)
payload_url = re.findall('(http.*)',sh)[0]
elif 'data:application/x-silverlight' in p:
t = 'silverlight'
x = HTML(re.findall('"(.*?)"',p)[0])
for i in x.xpath('//param'):
if i.attrib['name'] == 'source':
urls = [i.attrib['value']]
elif i.attrib['name'] == 'initParams':
vals = dict(map(lambda x: tuple(x.split('=')),i.attrib['value'].split('&')))
sh = vals['shell32'].decode('hex').strip("\x00")
payload_url = re.findall('(http.*)',sh)[0]
elif 'CollectGarbage' in p:
t = 'ie'
x= p.strip().splitlines()[-1].replace("'",'"').split('"')
payload_url = x[1] + ' rc4 key: %s' % x[-2]
sh = re.findall('"([0-9a-f]+)"\+',p,re.I)[0].decode('hex')
else:
t = 'unknown'
sh_hash = hashlib.sha256(sh).hexdigest()
print '[+] found %s exploit' % t
if urls:
print '[+] additional exploits:', ', '.join(urls)
print '[+] payload url:', payload_url
print '[+] shellcode hash:',sh_hash
if args.save:
n = args.dir + '/exp.%s.%s.txt' % (t,hashlib.sha256(p).hexdigest())
with open(n,'w') as f:
f.write(p)
print '[+] js saved to', n
if sh:
n = args.dir + '/exp.%s.%s.sh.bin' % (t,sh_hash)
with open(n,'w') as f:
f.write(sh)
print '[+] shellcode saved to', n