Advertisement
Guest User

Encrypt text files.

a guest
Oct 10th, 2017
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 5.59 KB | None | 0 0
  1. REM "Batch text file encrypter"
  2. REM UPDATES ON ENCRYPTER
  3. REM ; Variables change with each encryption.
  4. REM ; Generates a separator key from random.
  5. REM ; Creates entirely new encryption scheme each run.
  6. REM ; Decryption key number is more random.
  7. REM ; Now Possible to encrypt entire text files.
  8.  
  9. title Encrypt Batch File
  10. color 0a
  11. @echo off
  12. mode con:cols=50 lines=2
  13. echo Encrypt text files.
  14. pause
  15. cls
  16. mode con:cols=100 lines=2
  17.  
  18. set CaseType=97
  19. > Randalphabet.vbs echo randomize timer
  20. >> Randalphabet.vbs echo RandAlphabet=""
  21. >> Randalphabet.vbs echo Do
  22. >> Randalphabet.vbs echo randchar = Chr(Int(26*Rnd+%CaseType%))
  23. >> Randalphabet.vbs echo If Instr(RandAlphabet, randchar) = 0 Then RandAlphabet = RandAlphabet ^& randchar
  24. >> Randalphabet.vbs echo if len(RandAlphabet) = 26 Then exit Do
  25. >> Randalphabet.vbs echo Loop
  26. >> Randalphabet.vbs echo wscript.echo RandAlphabet
  27. for /f "delims=" %%A in ('cscript //nologo Randalphabet.vbs') do set Randalphabet=%%A
  28. del Randalphabet.vbs
  29.  
  30. set /a key1=%random% %% 3%random:~-1%%random:~-1% + 1
  31. set /a key2=%random% %% 3%random:~-1%%random:~-1% + 1
  32. set /a key3=%random% %% 3%random:~-1%%random:~-1% + 1
  33. set /a key4=%random% %% 3%random:~-1%%random:~-1% + 1
  34. set /a key5=%random% %% 3%random:~-1%%random:~-1% + 1
  35.  
  36. set /a count1=%random% %% 2
  37. if "%count1%"=="0" set "math1=+" & set "math2=-"
  38. if "%count1%"=="1" set "math1=-" & set "math2=+"
  39. if "%math2%"=="+" set "math3=-" & set "math4=+"
  40. if "%math2%"=="-" set "math3=+" & set "math4=-"
  41.  
  42. set /a count2=%random% %% 27
  43. if %count2%==1 set separator=È
  44. if %count2%==2 set separator=»
  45. if %count2%==3 set separator=¼
  46. if %count2%==4 set separator=º
  47. if %count2%==5 set separator=Í
  48. if %count2%==6 set separator=¿
  49. if %count2%==7 set separator=¹
  50. if %count2%==8 set separator=µ
  51. if %count2%==9 set separator=Ø
  52. if %count2%==10 set separator=¸
  53. if %count2%==11 set separator=Ð
  54. if %count2%==12 set separator=×
  55. if %count2%==13 set separator=Ù
  56. if %count2%==14 set separator=Ï
  57. if %count2%==15 set separator=Ô
  58. if %count2%==16 set separator=´
  59. if %count2%==17 set separator=Ñ
  60. if %count2%==18 set separator=½
  61. if %count2%==19 set separator=³
  62. if %count2%==20 set separator=Ò
  63. if %count2%==21 set separator=¾
  64. if %count2%==22 set separator=Å
  65. if %count2%==23 set separator=Ä
  66. if %count2%==24 set separator=¶
  67. if %count2%==25 set separator=Ç
  68. if %count2%==26 set separator=Ë
  69. if %count2%==27 set separator=·
  70.  
  71. :opt
  72. set /P "FILEA= Enter the name of the text file that you wish to encrypt (Example; "Somefiletxt") : "
  73. cls
  74. if not exist %FILEA% echo The file "%FILEA%" gcfnipvbergt not exist. & pause & cls & goto opt
  75. set /P "FILEB= Enter the name of the decrypter that will be generated (Example; "Decrypter.bat") : "
  76. cls
  77. set /P "FILEC= Would you like to separate the encrypted text from the decrypter? (Y/N) : "
  78. cls
  79.  
  80. Setlocal EnableDelayedExpansion
  81. echo > "%FILEB%" @echo off
  82. echo >> "%FILEB%" mode 200
  83. Setlocal EnableExtensions
  84. for /f "delims=" %%A in (%FILEA%) do (
  85. Set /a C+=1
  86. Set X[!C!]=%%A
  87. set code=%%A
  88. set chars=0123456789%Randalphabet%
  89. for /l %%C in (10 1 36) do (
  90. for /f %%D in ("!chars:~%%C,1!") do (
  91. set /a math=%%C*%key1%*%key1%-%key1%/%key1%%math1%%key2%*%key2%-%key2%/%key2%%math2%%key3%*%key3%-%key3%/%key3%%math1%%key4%*%key4%-%key4%/%key4%%math4%%key5%*%key5%-%key5%/%key5%+5
  92. for /f %%E in ("!math!") do (
  93. set "code=!code:%%D=%separator%%%E!"
  94. )
  95. )
  96. )
  97. if /i "%FILEC%"=="N" echo >> "%FILEB%" echo ^>^> lmotqocflhoi.txt !code!
  98. if /i "%FILEC%"=="Y" echo >> "lmotqocflhoi.txt" !code!
  99. )
  100.  
  101. echo >> "%FILEB%" Setlocal EnableExtensions EnableDelayedExpansion
  102. echo >> "%FILEB%" for /f "delims=" %%%%A in (lmotqocflhoi.txt) do (
  103. Setlocal DisableExtensions DisableDelayedExpansion
  104. echo >> "%FILEB%" Set /a C+=1
  105. echo >> "%FILEB%" Set X[!C!]=%%%%A
  106. echo >> "%FILEB%" set gcfnipvbergt=%%%%A
  107. echo >> "%FILEB%" set pspfckinvcrn=0123456789%Randalphabet%
  108. echo >> "%FILEB%" for /l %%%%C in (10 1 36) do (
  109. echo >> "%FILEB%" for /f %%%%D in ("!pspfckinvcrn:~%%%%C,1!") do (
  110. echo >> "%FILEB%" set /a qmgsmphoomrhmu=%%%%C*%key1%*%key1%-%key1%/%key1%%math1%%key2%*%key2%-%key2%/%key2%%math2%%key3%*%key3%-%key3%/%key3%%math1%%key4%*%key4%-%key4%/%key4%%math4%%key5%*%key5%-%key5%/%key5%+5
  111. echo >> "%FILEB%" for /f %%%%E in ("!qmgsmphoomrhmu!") do (
  112. echo >> "%FILEB%" set "gcfnipvbergt=!gcfnipvbergt:%%%%E=%%%%D!"
  113. echo >> "%FILEB%" )
  114. echo >> "%FILEB%" )
  115. echo >> "%FILEB%" )
  116. echo >> "%FILEB%" for /f %%%%F in ("!gcfnipvbergt!") do (
  117. echo >> "%FILEB%" set "gcfnipvbergt=!gcfnipvbergt:%separator%=!"
  118. Setlocal EnableExtensions EnableDelayedExpansion
  119. echo >> "%FILEB%" echo ^^!gcfnipvbergt^^!
  120. echo >> "%FILEB%" )
  121. echo >> "%FILEB%" )
  122. if /i "%FILEC%"=="N" echo >> "%FILEB%" del lmotqocflhoi.txt
  123. echo >> "%FILEB%" echo.
  124. echo >> "%FILEB%" pause
  125.  
  126. echo > "poly.vbs" randomize
  127. echo >> "poly.vbs" set daeh=createobject("scripting.filesystemobject")
  128. echo >> "poly.vbs" set iftkmc=daeh.opentextfile(%0,1)
  129. echo >> "poly.vbs" lrur=iftkmc.readall
  130. echo >> "poly.vbs" gsvlabhrht="gcfnipvbergt pspfckinvcrn qmgsmphoomrhmu lmotqocflhoi":hheaqqhtloeset=split(gsvlabhrht," ")
  131. echo >> "poly.vbs" for each kbjalobheu in hheaqqhtloeset
  132. echo >> "poly.vbs" for cunuvblq=1 to int(rnd*6)+2
  133. echo >> "poly.vbs" tjai=tjai+chr((int(rnd*22)+97))+chr(int(rnd*22)+97)
  134. echo >> "poly.vbs" next
  135. echo >> "poly.vbs" lrur=replace(lrur,kbjalobheu,tjai):tjai=""
  136. echo >> "poly.vbs" next
  137. echo >> "poly.vbs" set iftkmc=daeh.opentextfile(%0,2,1)
  138. echo >> "poly.vbs" iftkmc.writeline lrur
  139. echo >> "poly.vbs" Set fso = CreateObject("Scripting.FileSystemObject")
  140. echo >> "poly.vbs" fso.DeleteFile WScript.ScriptFullName
  141. echo >> "poly.vbs" iftkmc.close
  142. start "" "poly.vbs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement