[原创]解密 HtmlShip 加密的 html 文件
[文章作者] zhouzhen[Est][信息来源] 代码安全 [url]http://www.securitycode.cn[/url]
好久没有来了,写了脚本,基本达到目的,取巧了 :)
[code]
#! /usr/bin/python
#coding=gb2312
import sys
import webbrowser, os
if len(sys.argv) < 2:
print 'usage: UnHtmlShip.py encodehtml\n'
print '运行后将弹出IE,点击允许activex\n'
print "将在程序目录下生成 UnHtmlShip.htm"
sys.exit(1)
pypath = os.path.abspath(os.path.dirname(sys.argv[0]))
pypath = pypath.replace('\\', '\\\\')
decodeHtmlpath = pypath + '\\\\UnHtmlShip.htm'
# 插入主要起作用的代码
add = """;var fso, ts;
fso = new ActiveXObject("Scripting.FileSystemObject"); """ + \
"""ts = fso.OpenTextFile(""" + '"' + decodeHtmlpath + '"' + """, 8, true); """ + \
"""ts.WriteLine(w);
ts.Close();"""
# 获得文件大小,单位字节
filesize = os.path.getsize(sys.argv[1])
substring = r',document.write(w);'
func = lambda(x): x.replace(substring, add)
try:
f = open(sys.argv[1], 'rb')
lines = f.readlines(filesize)
newlines = [func(x) for x in lines]
f = open(sys.argv[1], 'wb')
f.writelines(newlines)
f.close()
webbrowser.open(sys.argv[1])
except:
print 'error occur'
sys.exit(0)
[/code] document.write
好猥琐的做法... [s:266]
页:
[1]