How to Use Python to decrypt the basic VBS application code

Source: Internet
Author: User

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:

 
 
  1. #! /Usr/bin/env Python
  2. # Encoding = UTF-8
  3. Import sys, WConio, OS
  4. Def printgoodnews (news ):
  5. Oldcolor = WConio. gettextinfo () [4]
  6. WConio. textcolor (WConio. GREEN)
  7. Print news
  8. WConio. textcolor (oldcolor)
  9. Usage = u "Help: this tool must be executed in the command line. If this file is named a.exe
  10. Enter a.exe demo. vbs or a demo. vbs in the command.
  11. Http://www.djhui.net/minute-to-second competition
  12. """
  13. If _ name __= = "_ main __":
  14. If len (sys. argv) = 1:
  15. Printgoodnews (usage)
  16. Sys. exit (-1)
  17. Vbs = sys. argv [1]
  18. If vbs [-4:]. lower ()! = ". Vbs" or not OS. path. exists (vbs ):
  19. 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)
  20. Else:
  21. Printgoodnews (u "http://www.djhui.net/second contention \ n """)
  22. Printgoodnews (u "starting to decrypt % s, please wait... \ n" % vbs)
  23. Printgoodnews (u "started to read the file % s... \ n" % vbs)
  24. Rf = open (vbs, 'R ')
  25. Rfrf1 = rf. read ()
  26. Rf. close ()
  27. Rf1rf1 = rf1.lower (). replace ('execute ', 'intercept ')
  28. Rf1rf1 = rf1 + "" \ nSub Intercept (ee)
  29. OutPutFile = "decode.txt"
  30. Set objFSO = CreateObject ("Scripting. FileSystemObject ")
  31. Set objTXT = objFSO. CreateTextFile (OutPutFile, True, False)
  32. ObjTXT. Write ee
  33. ObjTXT. Close
  34. Set ob1_sh = CreateObject ("WScript. Shell ")
  35. Ob1_sh. Run OutPutFile
  36. WScript. Quit
  37. End Sub """
  38. Printgoodnews (u "starts writing temporary files... \ n """)
  39. Rf = open ('temp. vbs ', 'w ')
  40. Rf. write (rf1)
  41. Rf. close
  42. Del rf
  43. Del rf1
  44. Printgoodnews (u "Start decryption... \ n """)
  45. OS .system('cscript.exe temp. vbs> nul 2> nul ')
  46. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.