Skip to main content

A Python-Based VBScript Code Obfuscator

Project description

VBScrambler - A Python-Based VBScript Code Obfuscator

header image_vbscrambler

VBScrambler is a Python based VBScript code obfuscator which essentially takes VBScript as a form of input, either file or inline code, and provides an obfuscated VBScript one liner as output. The obfuscation works by taking the original VBScript, performing a byte shift on the supplied code. It will then take the garbage-looking code and insert it into a randomly generated deobfuscation script in VB, which will reverse the byte shift and then execute its contents.

The shift works similar to ROT13 with a randomly supplied shift value ranging from -5 to 7. Larger numbers tend to prevent the generated script from executing, producing errors. Other errors can occur when copying generated code from console, as special characters, especially in Linux, may not copy correctly.

Optional arguments:

  • -c, --content Supply inline VBScript. (This must be the last argument supplied)
  • -f, --file Supply a .vbs file to obfuscate (supports multi-line)
  • -o, --output Save generated output to file [filename.vbs]
  • -s, --shift Manually specify a shift value If no argument is provided, the script will prompt the user for code to obfuscate.

help image_vbscrambler

Example:

Obfuscating the following VBScript using the command: python3 VBScrambler.py -s 5 -f ps.vbs

Dim shell,command
command = "powershell.exe -nologo -command ""New-Item C:\text\vbstest.txt -Force"""
Set shell = CreateObject("WScript.Shell")
shell.Run command,0

Generates the following VBScript code:

lgwi = "":for i = 1 to 163: lgwi = lgwi + chr(Asc(mid("Inr%xmjqq1htrrfsihtrrfsi%B%'ut|jwxmjqq3j}j%2stqtlt%2htrrfsi%''Sj|2Nyjr%H?ayj}ya{gxyjxy3y}y%2Ktwhj'''Xjy%xmjqq%B%HwjfyjTgojhy-'\Xhwnuy3Xmjqq'.xmjqq3Wzs%htrrfsi15",i,1)) - (5)):Next:Execute lgwi:

Errors and issues

After extensively testing various VBScripts, I've discovered that certain scritps will produce errors with specific shift number combinations (typically 1 out of 10) when using the default provided range. If you encounter an error, try either adjusting the shfit number manually, or simply run it again to get a potentially new value.

Another issue occurs in Linux more often than in Windows where the console doesn't properly print the shifted ASCII characters properly, thus copying the printed code could skip some characters. If you run into this, use the -o option to print to a file and use a text editor such as Sublime which handles special characters well.

Future plans

  • Support for JScript, selectable via flags

DISCLAIMER: Use at your own risk, for educational and demonstration purposes only!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vbscrambler-0.1.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

VBScrambler-0.1.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file vbscrambler-0.1.1.tar.gz.

File metadata

  • Download URL: vbscrambler-0.1.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.0

File hashes

Hashes for vbscrambler-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4b370bc9bf51628aa81b2efa3b67e624fdfbdd75bf61e1aef2fe0218db5ddf99
MD5 82e32bc3f3799dd949ae571eee938b59
BLAKE2b-256 10ebb5bcbd9b9c2e58da1e989dff06beb773cc26daac8f7eba73495bf6746eda

See more details on using hashes here.

File details

Details for the file VBScrambler-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: VBScrambler-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.0

File hashes

Hashes for VBScrambler-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 50a5f039afefb19f8a6449b6ad7f43371395e02d3c017d44ffa40d929d9836fd
MD5 3e1c97020f78dc194ba49dbafbc9906c
BLAKE2b-256 518ce3fdd9bc2a96b75e1f7d8281d3819a4356d0aab79797747adc3c2ef29eb0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page