Decrypts html files encrypted by HtmlShip
[Author] zhouzhen [Est]
[Information Source] Code Security http://www.securitycode.cn
I haven't been here for a long time. I wrote the script and basically achieved the goal. It's a coincidence :)
The Code is as follows:
#! /Usr/bin/python
# Coding = gb2312
Import sys
Import webbrowser, OS
If len (sys. argv) <2:
Print usage: UnHtmlShip. py encodehtml
Print will pop up after running, click Allow activex
Print "UnHtmlShip.htm will be generated in the program directory"
Sys. exit (1)
Pypath = OS. path. abspath (OS. path. dirname (sys. argv [0])
Pypath = pypath. replace (\,\\)
DecodeHtmlpath = pypath + \ UnHtmlShip.htm
# Insert code that mainly works
Add = ""; var fso, ts;
Fso = new ActiveXObject ("Scripting. FileSystemObject"); "" +
"Ts = fso. OpenTextFile (" "+" + decodeHtmlpath + "+", 8, true); "+
"Ts. WriteLine (w );
Ts. Close ();"""
# Obtain the file size, in bytes
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 t:
Print error occur
Sys. exit (0)