邪恶八进制信息安全团队技术讨论组's Archiver

zhouzhen 2007-9-2 22:25

[原创]解密 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 &#39;usage: UnHtmlShip.py encodehtml\n&#39;
  print &#39;运行后将弹出IE,点击允许activex\n&#39;
  print "将在程序目录下生成 UnHtmlShip.htm"
  sys.exit(1)


pypath = os.path.abspath(os.path.dirname(sys.argv[0]))
pypath = pypath.replace(&#39;\\&#39;, &#39;\\\\&#39;)
decodeHtmlpath = pypath + &#39;\\\\UnHtmlShip.htm&#39;


# 插入主要起作用的代码
add = """;var fso, ts;
fso = new ActiveXObject("Scripting.FileSystemObject"); """ + \
"""ts = fso.OpenTextFile(""" + &#39;"&#39; + decodeHtmlpath + &#39;"&#39; + """, 8, true); """ + \
"""ts.WriteLine(w);
ts.Close();"""

# 获得文件大小,单位字节
filesize = os.path.getsize(sys.argv[1])


   

substring = r&#39;,document.write(w);&#39;
func = lambda(x): x.replace(substring, add)

try:
  
    f = open(sys.argv[1], &#39;rb&#39;)
    lines = f.readlines(filesize)

    newlines = [func(x) for x in lines]

    f = open(sys.argv[1], &#39;wb&#39;)
    f.writelines(newlines)

    f.close()
        
    webbrowser.open(sys.argv[1])
except:
  print &#39;error occur&#39;
  sys.exit(0)
[/code]

remax 2007-9-3 13:28

document.write
好猥琐的做法... [s:266]

页: [1]
© 1999-2008 EvilOctal Security Team