lmsmi1
-
Total Posts
:
27
- Scores: 2
-
Reward points
:
0
- Joined: 10/1/2011
-
Status: offline
|
VBScript (*.vbs) Text Decompiler/Compiler
Friday, January 20, 2012 2:38 PM
( permalink)
Is it possible to make a text compiler/decompiler that encrypts/decrypts text in a text file and outputs the compiled/decompiled data to a text document with "_DC" after the file name. Oh, and, the "_DC" is not after the extension (*.txt). Is this possible? If so, please teach me how.
|
|
|
|
lmsmi1
-
Total Posts
:
27
- Scores: 2
-
Reward points
:
0
- Joined: 10/1/2011
-
Status: offline
|
Re:VBScript (*.vbs) Text Decompiler/Compiler
Sunday, January 22, 2012 10:07 AM
( permalink)
Never mind. iGnite (@hackforums.net) sent me a code that works just like I wanted it to, except it's written in batch. It does, however, write a VBScript file to use. This is why I though I would post it here: @echo off & color 71
if not [%1]==[] (set filepath=%~1) else (echo. & echo A file must ^
be dragged and dropped onto this batch script. & pause > nul & exit)
:menu
title iGnite's File Encrypter & cls
echo. & echo iGnite's File Encrypter - by iGnite & echo.
echo. & echo a.) Encrypting
echo. & echo b.) Decrypting & echo.
set /p action=Are encrypting or decrypting the file?[a,b]:
if %action%==a goto encryptfile
if %action%==b goto decryptfile
goto menu
:encryptfile
cls & echo. & echo [*] Encryption sequence beginning
set /a progress=1
:timer
title Your file has been %progress%%% encrypted!
ping 127.0.0.1 -n 1 > nul
set /a progress= %progress% + 1
if /i %progress% leq 100 goto timer
(
echo set fso = createobject^("scripting.filesystemobject"^)
echo set file = fso.opentextfile^("%filepath%", 1^)
echo encrypttext = file.ReadAll^(^)
echo file.close
echo set file = fso.opentextfile^("%filepath%.encrypted.txt", 2, true^)
echo file.write encrypt^(encrypttext^)
echo file.close
echo set objshell = createobject^("wscript.shell"^)
echo fso.deletefile wscript.scriptfullname
echo wscript.quit
echo private function encrypt^(byval string^)
echo dim x, i, tmp
echo for i = 1 To len^( string ^)
echo x = mid^( string, i, 1 ^)
echo tmp = tmp ^& chr^( asc^( x ^) + 1 ^)
echo next
echo tmp = strreverse^( tmp ^)
echo encrypt = tmp
echo end function
) > encrypt.vbs
start "" "encrypt.vbs"
echo. & echo [*] Encryption sequence completed & pause > nul
exit
:decryptfile
cls & echo. & echo [*] Decryption sequence beginning
set /a progress=1
:time
title Your file has been %progress%%% decrypted!
ping 127.0.0.1 -n 1 > nul
set /a progress= %progress% + 1
if /i %progress% leq 100 goto time
(
echo set fso = createobject^("scripting.filesystemobject"^)
echo set file = fso.opentextfile^("%filepath%", 1^)
echo decrypttext = file.ReadAll^(^)
echo file.close
echo set file = fso.opentextfile^("%filepath%", 2, true^)
echo file.write decrypt^(decrypttext^)
echo file.close
echo set objshell = createobject^("wscript.shell"^)
echo fso.deletefile wscript.scriptfullname
echo wscript.quit
echo private function decrypt^(byval encryptedstring^)
echo dim x, i, tmp
echo encryptedstring = strreverse^( encryptedstring ^)
echo for i = 1 To len^( encryptedstring ^)
echo x = mid^( encryptedstring, i, 1 ^)
echo tmp = tmp ^& chr^( asc^( x ^) - 1 ^)
echo next
echo decrypt = tmp
echo end function
) > decrypt.vbs
start "" "decrypt.vbs"
echo. & echo [*] Decryption sequence completed & pause > nul
exit
|
|
|
|
59cobalt
-
Total Posts
:
981
- Scores: 91
-
Reward points
:
0
- Joined: 7/17/2011
-
Status: offline
|
Re:VBScript (*.vbs) Text Decompiler/Compiler
Sunday, January 22, 2012 8:35 PM
( permalink)
Just so nobody else falls for this nonsense: the "encryption" is using a modified Caesar cipher. Basically it does ROT1 without wrapping and then reverses the resulting string. Do not use this in any kind of production environment.
|
|
|
|