Batch Text Document Cryptor/Decryptor

Author Message
lmsmi1

  • Total Posts : 27
  • Scores: 2
  • Reward points : 0
  • Joined: 10/1/2011
  • Status: offline
Batch Text Document Cryptor/Decryptor Saturday, January 21, 2012 2:45 PM (permalink)
0
I am currently making a text document cryptor & decryptor. Here is how it will work:
 
To make a normal ENGLISH text document (*.txt) encrypted, just drag and drop a text document onto the batch file. It will then output the encrypted file with an additional "_C" after the name, NOT THE EXTENSION (ex. "Hello.txt" outputted to "Hello_C.txt"). The process of decrypting crypted text documents will work similar to crypting them. All you will have to do is drag and drop the crypted document onto the decryptor batch file, and it will output a file with an additional "_DC" in the filename, not after the extension, once again. So, here is an example of what will happen:
 
For Crypting:
 
1. I drag and drop a normal text document ("Hello.txt") onto the cryptor batch file.
2. It outputs a whole new file ("Hello_C.txt").
3. I try to read it. I can't because it is encrypted.
 
For Decrypting:
 
1. I drag and drop a crypted text document (ex. Hello_C.txt . It doesn't have to have the additional "_C" in the filename, okay?) onto the decryptor batch file.
2. It outputs a whole new file called "Hello_DC.txt".
3. I try to read it. I can because it is now decrypted. YAY!
 
So that is how it will work. Can someone please explain to me what I need to do in order to make this? Like give me the commands and stuff?

 
#1
    lmsmi1

    • Total Posts : 27
    • Scores: 2
    • Reward points : 0
    • Joined: 10/1/2011
    • Status: offline
    Re:Batch Text Document Cryptor/Decryptor Sunday, January 22, 2012 6:59 AM (permalink)
    0
    SOLVED: iGnite made me one:
     
    Here is the code:
     
    @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
  •  
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9