This article is reposted from the blog in seconds.] If we want to decrypt VBS, we can use many programming languages. However, if you want to use the Python language for implementation, you can achieve better results, and the application is simple. Here we will introduce how to use Python to decrypt VBS.
Python decryption VBS code example:
- #! /Usr/bin/env Python
- # Encoding = UTF-8
- Import sys, WConio, OS
- Def printgoodnews (news ):
- Oldcolor = WConio. gettextinfo () [4]
- WConio. textcolor (WConio. GREEN)
- Print news
- WConio. textcolor (oldcolor)
- Usage = u "Help: this tool must be executed in the command line. If this file is named a.exe
- Enter a.exe demo. vbs or a demo. vbs in the command.
- Http://www.djhui.net/minute-to-second competition
- """
- If _ name __= = "_ main __":
- If len (sys. argv) = 1:
- Printgoodnews (usage)
- Sys. exit (-1)
- Vbs = sys. argv [1]
- If vbs [-4:]. lower ()! = ". Vbs" or not OS. path. exists (vbs ):
- Printgoodnews (u "sorry, the file '% s' you entered is not a VBS script file with \ n effect or
The file does not exist. Please enter \ nHttp: // Www.Djhui.net \ n in seconds to compete "% vbs)
- Else:
- Printgoodnews (u "http://www.djhui.net/second contention \ n """)
- Printgoodnews (u "starting to decrypt % s, please wait... \ n" % vbs)
- Printgoodnews (u "started to read the file % s... \ n" % vbs)
- Rf = open (vbs, 'R ')
- Rfrf1 = rf. read ()
- Rf. close ()
- Rf1rf1 = rf1.lower (). replace ('execute ', 'intercept ')
- Rf1rf1 = rf1 + "" \ nSub Intercept (ee)
- OutPutFile = "decode.txt"
- Set objFSO = CreateObject ("Scripting. FileSystemObject ")
- Set objTXT = objFSO. CreateTextFile (OutPutFile, True, False)
- ObjTXT. Write ee
- ObjTXT. Close
- Set ob1_sh = CreateObject ("WScript. Shell ")
- Ob1_sh. Run OutPutFile
- WScript. Quit
- End Sub """
- Printgoodnews (u "starts writing temporary files... \ n """)
- Rf = open ('temp. vbs ', 'w ')
- Rf. write (rf1)
- Rf. close
- Del rf
- Del rf1
- Printgoodnews (u "Start decryption... \ n """)
- OS .system('cscript.exe temp. vbs> nul 2> nul ')
- Printgoodnews (u "decrypted... \ n """)
The above describes how to decrypt VBS using Python.
This article reposted from the blog in seconds to compete, the original link: http://www.djhui.net/post/442.html