[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文本处理] 批处理文本文件加解密器(带密码)

本帖最后由 0000 于 2017-2-2 15:53 编辑

批处理文本文件加解密器(带密码)
注:加密很长的中文文件时可能会不稳定。
算法有点长,请耐心浏览
已补上2楼的坑,请放心使用

加密:
  1. @echo off
  2. title 纯文本加解密工具1.0(加密)
  3. rem 退格符
  4. rem 标记感叹号
  5. set exc=!
  6. rem 标记引号
  7. set quo="
  8. rem 标记caret号
  9. set car=^^
  10. setlocal ENABLEDELAYEDEXPANSION
  11. rem 标记大写字母
  12. set CAP=ABCDEFGHIJKLMNOPQRSTUVWXYZ
  13. for /l %%n in (0,1,25) do (set CAP_!CAP:~%%n,1!=!CAP:~%%n,1!)
  14. echo 纯文本加解密工具1.0(加密) BY 0000
  15. :setfile
  16. set /p file=文件名称:
  17. if "!file!"=="" (echo 无效的文件名&goto setfile)
  18. set file=!file:"=!
  19. if "!file!"=="" (echo 无效的文件名&goto setfile)
  20. echo "!file!"|findstr /R /C:"[*?]">nul&&(echo 无效的文件名&goto setfile)
  21. set file_1=!file:~-1!
  22. if "!file_1!"=="/" (echo 无效的文件名&goto setfile)
  23. if "!file_1!"=="\" (echo 无效的文件名&goto setfile)
  24. dir /a-d "!file!">nul 2>nul||(echo 无效的文件名&goto setfile)
  25. dir /a-d "!file!\">nul 2>nul&&(echo 无效的文件名&goto setfile)
  26. :setpswd
  27. call :inputpswd 6 *
  28. rem 获取密码内容
  29. set /a pswd_a=1%pswd:~0,3%-900
  30. set /a pswd_b=1%pswd:~3,3%-900
  31. call :getfile2
  32. set /p =分析中. . .   *****/*****( 0%%)<nul
  33. call :getline "!file!"
  34. set ln_n=0
  35. for /f "usebackq tokens=* eol= delims= " %%L in ($tmp$.txt) do (
  36.   set /a ln_n=!ln_n!+1
  37.   set ln_!ln_n!=%%L
  38. )
  39. del $tmp$.txt
  40. rem 去引号
  41. for /l %%n in (1,1,%ln_n%) do (
  42.   set "ln_%%n=!ln_%%n:~1,-1!"
  43.   set "ln_%%n=!ln_%%n:""="!"
  44. )
  45. set _n=1
  46. set ln=!ln_1!
  47. set chars=
  48. set chars_n=0
  49. :getchars
  50. if %_n% gtr %ln_n% goto getc0
  51. if "!ln!"=="" goto getc1
  52. set lna=!ln:~0,1!
  53. set ln=!ln:~1!
  54. rem 先考虑引号,感叹号,等号和冒号
  55. if "!lna!" == "!quo!" (
  56.   rem 判断字母是否存在
  57.   if not "!char_qu!"=="-1" (
  58.     set chars=!chars!!quo!
  59.     set /a chars_n=!chars_n!+1
  60.     rem 字母已存在标志
  61.     set char_qu=-1
  62.   )
  63.   goto getchars
  64. )
  65. if "!lna!"=="!exc!" (
  66.   if not "!char_ex!"=="-1" (
  67.     set chars=!chars!!exc!
  68.     set /a chars_n=!chars_n!+1
  69.     set char_ex=-1
  70.   )
  71.   goto getchars
  72. )
  73. if "!lna!"=="=" (
  74.   if not "!char_eq!"=="-1" (
  75.     set chars=!chars!=
  76.     set /a chars_n=!chars_n!+1
  77.     set char_eq=-1
  78.   )
  79.   goto getchars
  80. )
  81. if "!lna!"==":" (
  82.   if not "!char_as!"=="-1" (
  83.     set chars=!chars!:
  84.     set /a chars_n=!chars_n!+1
  85.     set char_as=-1
  86.   )
  87.   goto getchars
  88. )
  89. rem 大写字母判断
  90. if "!CAP_%lna%!"=="%lna%" (
  91.   if not "!charCAP_%lna%!"=="-1" (
  92.     set chars=!chars!!lna!
  93.     set /a chars_n=!chars_n!+1
  94.     set charCAP_!lna!=-1
  95.   )
  96. ) else (
  97.   if not "!char_%lna%!"=="-1" (
  98.     set chars=!chars!!lna!
  99.     set /a chars_n=!chars_n!+1
  100.     set char_!lna!=-1
  101.   )
  102. )
  103. goto getchars
  104. :getc1
  105. set sh1=    %_n%
  106. set sh2=    %ln_n%
  107. set /a sh3=%_n%*100/%ln_n%
  108. set sh3= %sh3%
  109. set /p =分析中. . .   %sh1:~-5%/%sh2:~-5%(%sh3:~-2%%%)<nul
  110. set /a _n=%_n%+1
  111. set ln=!ln_%_n%!
  112. goto getchars
  113. :getc0
  114. set /p =正在加密. . .     0/%sh2:~-5%( 0%%)<nul
  115. set _n=%chars_n%
  116. rem 打乱字符表
  117. :randchars
  118. if %_n% lss 0 goto ran0
  119. set /a k=%random%*%_n%/32768
  120. set /a k1=%k%+1
  121. set chars=!chars:~0,%k%!!chars:~%k1%!!chars:~%k%,1!
  122. set /a _n=%_n%-1
  123. goto randchars
  124. :ran0
  125. set _n=%chars_n%
  126. rem 标记字符位置
  127. :setcharnum
  128. set /a _n=%_n%-1
  129. if %_n% lss 0 goto setcn0
  130. set _c=!chars:~%_n%,1!
  131. rem 先考虑引号,感叹号,等号和冒号
  132. if "!_c!" == "!quo!" (
  133.   set char_qu=!_n!
  134.   goto setcharnum
  135. )
  136. if "!_c!"=="!exc!" (
  137.   set char_ex=!_n!
  138.   goto setcharnum
  139. )
  140. if "!_c!"=="=" (
  141.   set char_eq=!_n!
  142.   goto setcharnum
  143. )
  144. if "!_c!"==":" (
  145.   set char_as=!_n!
  146.   goto setcharnum
  147. )
  148. rem 大写字母判断
  149. if "!CAP_%_c%!"=="%_c%" (
  150.   set charCAP_!_c!=!_n!
  151. ) else (
  152.   set char_!_c!=!_n!
  153. )
  154. goto setcharnum
  155. :setcn0
  156. rem 随机产生字符平移参数
  157. set /a move_max=%chars_n%/2
  158. if %move_max% gtr 30 set move_max=30
  159. :setmove
  160. set /a move_a=%move_max%*%random%/32767+1
  161. set /a move_b=%move_max%*%random%/32767+1
  162. if %random% lss 16384 set /a move_a=-%move_a%
  163. if %random% lss 16384 set /a move_b=-%move_b%
  164. rem 通过复数运算得到密码数[ (字符平移参数a + 字符平移参数b * i) * ((密码前三位 + 100) + (密码后三位 + 100) * i) = 密码数]
  165. call :complex %move_a% %move_b% * %pswd_a% %pswd_b% seed_a seed_b
  166. call :complex %seed_a% %seed_b% / %pswd_a% %pswd_b% a b
  167. rem 检查运算是否正确
  168. if not "%a%"=="%move_a%" goto setmove
  169. if not "%b%"=="%move_b%" goto setmove
  170. rem 检查字符平移参数是否互质(保证密码唯一性)
  171. if %a% lss 0 set /a a=-%a%
  172. if %b% lss 0 set /a b=-%b%
  173. :setm1
  174. if %a% gtr %b% (set /a a=%a% %% %b%) else (set /a b=%b% %% %a%)
  175. set /a ab=%a%*%b%
  176. if "%ab%"=="0" (
  177.   set /a a_b=%a%+%b%
  178.   if not "!a_b!"=="1" goto setmove
  179. ) else (
  180.   goto setm1
  181. )
  182. set _n=1
  183. set ln=!ln_1!
  184. set enc=
  185. set enc_n=0
  186. set /a move=-%move_a%
  187. (
  188.   echo TXT_ENCRIPT_1.0 BY 0000
  189.   echo %seed_a%_%seed_b%
  190.   echo;!chars!
  191. )>"!file2!"
  192. :encriptline
  193. if %_n% gtr %ln_n% goto enc0
  194. if "!ln!"=="" goto enc1
  195. set lna=!ln:~0,1!
  196. set ln=!ln:~1!
  197. rem 先考虑引号,感叹号,等号和冒号
  198. if "!lna!"=="!quo!" (call :setenc "!char_qu!"&goto encriptline)
  199. if "!lna!"=="!exc!" (call :setenc "!char_ex!"&goto encriptline)
  200. if "!lna!"=="=" (call :setenc "!char_eq!"&goto encriptline)
  201. if "!lna!"==":" (call :setenc "!char_as!"&goto encriptline)
  202. rem 大写字母判断
  203. if "!CAP_%lna%!"=="%lna%" (call :setenc "!charCAP_%lna%!") else (call :setenc "!char_%lna%!")
  204. goto encriptline
  205. :enc1
  206. call :setenc "-1"
  207. set sh1=    %_n%
  208. set sh2=    %ln_n%
  209. set /a sh3=%_n%*100/ln_n
  210. set sh3= %sh3%
  211. set /p =正在加密. . . %sh1:~-5%/%sh2:~-5%(%sh3:~-2%%%)<nul
  212. set /a _n=%_n%+1
  213. set ln=!ln_%_n%!
  214. goto encriptline
  215. :enc0
  216. echo;%enc%>>"!file2!"
  217. echo 加密成功!                                      
  218. echo 已保存到 !file2! !exc!                                       
  219. echo ay|choice>nul
  220. pause
  221. goto end
  222. rem Functions
  223. :getline
  224. rem 禁止延迟变量
  225. setlocal DISABLEDELAYEDEXPANSION
  226. (
  227.   for /f "usebackq tokens=* eol= delims= " %%L in (%1) do (
  228.     set _L=%%L
  229.     rem 加引号
  230.     call set _L="%%_L:"=""%%"
  231.     call set _L=%%_L:!=!exc!%%
  232.     call :getecho
  233.   )
  234. )>$tmp$.txt
  235. goto end
  236. :getecho
  237. echo;%_L:^=!car!%
  238. goto end
  239. :setenc
  240. set m=%1
  241. set m=!m:~1,-1!
  242. if "!m!"=="-1" goto sete1
  243. set /a m=%m%+%move%
  244. if %m% lss 0 set /a m=%m%+%chars_n%
  245. if %m% geq %chars_n% set /a m=%m%-%chars_n%
  246. :sete1
  247. set enc=!enc!%m%_
  248. set /a enc_n=%enc_n%+1
  249. if "%enc_n%"=="8" (
  250.   echo;!enc!>>"!file2!"
  251.   set enc=
  252.   set enc_n=0
  253.   set /a move=!move!-!move_b!
  254.   if !move! lss 0 set /a move=!move!+!chars_n!
  255.   if !move! gtr !chars_n! set /a move=!move!-!chars_n!
  256. )
  257. goto end
  258. :complex
  259. rem complex a实 a虚 符号 b实 b虚 实变量名 虚变量名
  260. if "%3"=="*" (
  261.   set /a comp_x=%1*%4-%2*%5
  262.   set /a comp_y=%1*%5+%2*%4
  263.   set /a comp_k=1
  264. )
  265. if "%3"=="/" (
  266.   set /a comp_x=%2*%5+%1*%4
  267.   set /a comp_y=%2*%4-%1*%5
  268.   set /a comp_k=%4*%4+%5*%5
  269. )
  270. set /a %6=%comp_x%/%comp_k%
  271. set /a %7=%comp_y%/%comp_k%
  272. goto end
  273. :inputpswd
  274. set pswd=
  275. set pswdkey=
  276. set pswdblank=
  277. set pswdstar=
  278. set /a pswdn1=%1-1
  279. set /p =密码(6位数字):<nul
  280. for /l %%n in (1,1,%1) do (set pswdblank= !pswdblank!)
  281. :inp1
  282. if not "%pswd%"=="" if not "!pswd:~%pswdn1%,1!"=="" (
  283.   echo;
  284.   goto end
  285. )
  286. for /f "tokens=*" %%f in ('xcopy /w . . 2^>nul') do (
  287.   set pswdkey=%%f
  288.   goto inp2
  289. )
  290. :inp2
  291. set pswdkey=!pswdkey:~-1!
  292. if "!pswdkey!"=="" (
  293.   if not "!pswd!"=="" (
  294.     set pswd=!pswd:~0,-1!
  295.     set pswdstar=!pswdstar:~1,-1!
  296.   )
  297. )
  298. for /l %%n in (0,1,9) do (
  299.   if "!pswdkey!"=="%%n" (
  300.     set pswd=!pswd!!pswdkey!
  301.     set pswdstar=%2!pswdstar!
  302.   )
  303. )
  304. set /p =密码(6位数字):!pswdblank!!pswdstar!<nul
  305. goto inp1
  306. :getfile2
  307. setlocal DISABLEDELAYEDEXPANSION
  308. for %%F in ("%file%") do (set "file2=%%~dpnF_Encript%%~xF")
  309. set "file2=%file2:!=!exc!%"
  310. endlocal&set "file2=%file2%"
  311. goto :end
  312. :end
复制代码

解密
  1. @echo off
  2. title 纯文本加解密工具1.0(解密)
  3. rem 退格符
  4. setlocal ENABLEDELAYEDEXPANSION
  5. echo 纯文本加解密工具1.0(解密) BY 0000
  6. :setfile
  7. set /p file=文件名称:
  8. if "!file!"=="" (echo 无效的文件名&goto setfile)
  9. set file=!file:"=!
  10. if "!file!"=="" (echo 无效的文件名&goto setfile)
  11. echo "!file!"|findstr /R /C:"[*?]">nul&&(echo 无效的文件名&goto setfile)
  12. set file_1=!file:~-1!
  13. if "!file_1!"=="/" (echo 无效的文件名&goto setfile)
  14. if "!file_1!"=="\" (echo 无效的文件名&goto setfile)
  15. dir /a-d "!file!">nul 2>nul||(echo 无效的文件名&goto setfile)
  16. dir /a-d "!file!\">nul 2>nul&&(echo 无效的文件名&goto setfile)
  17. for /f "usebackq tokens=* delims=" %%t in ("!file!") do (
  18.   if not "%%t"=="TXT_ENCRIPT_1.0 BY 0000" (
  19.     echo 该文件未被加密
  20.     goto setfile
  21.   ) else (
  22.     rem 直接跳出for循环
  23.     goto setpswd
  24.   )
  25. )
  26. :setpswd
  27. call :inputpswd 6 *
  28. rem 获取密码内容
  29. set /a pswd_a=1%pswd:~0,3%-900
  30. set /a pswd_b=1%pswd:~3,3%-900
  31. call :getfile2
  32. for /f "usebackq skip=1 tokens=1,2 delims=_" %%a in ("!file!") do (
  33.   set seed_a=%%a
  34.   set seed_b=%%b
  35.   goto setmove
  36. )
  37. :setmove
  38. rem 通过复数运算得到字符平移参数[ (密码数a + 密码数b * i) * ((密码前三位 + 100) + (密码后三位 + 100) * i) = 字符平移参数]
  39. call :complex %seed_a% %seed_b% / %pswd_a% %pswd_b% move_a move_b
  40. call :complex %move_a% %move_b% * %pswd_a% %pswd_b% a b
  41. rem 检查运算是否正确
  42. if not "%a%"=="%seed_a%" (echo 密码不正确&goto setpswd)
  43. if not "%b%"=="%seed_b%" (echo 密码不正确&goto setpswd)
  44. rem 检查字符平移参数是否互质
  45. set a=%move_a%
  46. set b=%move_b%
  47. if %a% lss 0 set /a a=-%a%
  48. if %b% lss 0 set /a b=-%b%
  49. :setm1
  50. if %a% gtr %b% (set /a a=%a% %% %b%) else (set /a b=%b% %% %a%)
  51. set /a ab=%a%*%b%
  52. if "%ab%"=="0" (
  53.   set /a a_b=%a%+%b%
  54.   if not "!a_b!"=="1" (echo 密码不正确&goto setpswd)
  55. ) else (
  56.   goto setm1
  57. )
  58. set /p =正在解密. . . *****/*****( 0%%)<nul
  59. copy nul "!file2!" >nul
  60. call :getchar
  61. set /p chars=<$tmp$.txt
  62. del $tmp$.txt
  63. set _n=0
  64. set ln_n=0
  65. for /f "usebackq skip=3 delims= eol= " %%a in ("!file!") do (set /a ln_n=!ln_n!+1)
  66. set dec=
  67. set chars=!chars:~%move_a%!!chars:~0,%move_a%!
  68. for /f "usebackq skip=3 tokens=1,2,3,4,5,6,7,8 delims=_" %%a in ("!file!") do (
  69.   call :setdec %%a
  70.   call :setdec %%b
  71.   call :setdec %%c
  72.   call :setdec %%d
  73.   call :setdec %%e
  74.   call :setdec %%f
  75.   call :setdec %%g
  76.   call :setdec %%h
  77.   set sh1=    !_n!
  78.   set sh2=    !ln_n!
  79.   set /a sh3=!_n!*100/!ln_n!
  80.   set sh3= !sh3!
  81.   set /p =正在解密. . . !sh1:~-5!/!sh2:~-5!(!sh3:~-2!%%^)<nul
  82.   set /a _n=!_n!+1
  83.   set chars=!chars:~%move_b%!!chars:~0,%move_b%!
  84. )
  85. echo;!dec!>>"!file2!"
  86. echo 解密成功!                                       
  87. echo 已保存到 !file2! ^^!
  88. echo ay|choice>nul
  89. start notepad "!file2!"
  90. pause
  91. goto end
  92. rem Functions
  93. :setdec
  94. if "%1"=="" goto end
  95. if "%1"=="-1" goto setd1
  96. set dec=!dec!!!chars:~%1,1!
  97. goto end
  98. :setd1
  99. echo;!dec!>>"!file2!"
  100. set dec=
  101. goto end
  102. :getchar
  103. rem 禁止延迟变量
  104. setlocal DISABLEDELAYEDEXPANSION
  105. for /f "usebackq skip=2 tokens=* delims= eol= " %%t in ("%file%") do (
  106.   echo;%%t>$tmp$.txt
  107.   goto end
  108. )
  109. goto end
  110. :complex
  111. rem complex a实 a虚 符号 b实 b虚 实变量名 虚变量名
  112. if "%3"=="*" (
  113.   set /a comp_x=%1*%4-%2*%5
  114.   set /a comp_y=%1*%5+%2*%4
  115.   set /a comp_k=1
  116. )
  117. if "%3"=="/" (
  118.   set /a comp_x=%2*%5+%1*%4
  119.   set /a comp_y=%2*%4-%1*%5
  120.   set /a comp_k=%4*%4+%5*%5
  121. )
  122. set /a %6=%comp_x%/%comp_k%
  123. set /a %7=%comp_y%/%comp_k%
  124. goto end
  125. :inputpswd
  126. set pswd=
  127. set pswdkey=
  128. set pswdblank=
  129. set pswdstar=
  130. set /a pswdn1=%1-1
  131. set /p =密码(6位数字):<nul
  132. for /l %%n in (1,1,%1) do (set pswdblank= !pswdblank!)
  133. :inp1
  134. if not "%pswd%"=="" if not "!pswd:~%pswdn1%,1!"=="" (
  135.   echo;
  136.   goto end
  137. )
  138. for /f "tokens=*" %%f in ('xcopy /w . . 2^>nul') do (
  139.   set pswdkey=%%f
  140.   goto inp2
  141. )
  142. :inp2
  143. set pswdkey=!pswdkey:~-1!
  144. if "!pswdkey!"=="" (
  145.   if not "!pswd!"=="" (
  146.     set pswd=!pswd:~0,-1!
  147.     set pswdstar=!pswdstar:~1,-1!
  148.   )
  149. )
  150. for /l %%n in (0,1,9) do (
  151.   if "!pswdkey!"=="%%n" (
  152.     set pswd=!pswd!!pswdkey!
  153.     set pswdstar=%2!pswdstar!
  154.   )
  155. )
  156. set /p =密码(6位数字):!pswdblank!!pswdstar!<nul
  157. goto inp1
  158. :getfile2
  159. setlocal DISABLEDELAYEDEXPANSION
  160. for %%F in ("%file%") do (set "file2=%%~dpnF_Decript%%~xF")
  161. set "file2=%file2:!=!exc!%"
  162. endlocal&set "file2=%file2%"
  163. goto :end
  164. :end
复制代码


有建议或意见请在下方提出!

回复 1# 0000


输入文件名称:!time!.txt
系统找不到文件 13:12:38.92.txt。

无赖!
1

评分人数

    • 0000: 坑已补上技术 + 1

TOP

回复 2# CommandBatCmd


    确实有这么个坑

TOP

完全用不成。直接输入文件名不可行,输入路径就语法不正确

TOP

回复 3# 老刘1号


    批处理给我们扔下坑,但希望我们的人生无坑!
新年快乐!

TOP

回复 5# CommandBatCmd


    同乐

TOP

给你点参考,我朋友9年前的作品

VBS加密解密

Dim WshSHell,FSO
On Error Resume Next
Set WshSHell = WScript.CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Args = WScript.Arguments
Ver="1.1"
CloseTime = 5
FileName = WScript.ScriptName
FileFullName = WScript.ScriptFullName
FilePath = FSO.GetParentFolderName(FileFullName)
InsPath = FSO.GetSpecialFolder(1)
InsFullName = FSO.BuildPath(InsPath ,FileName)
Copyright="baomaboy"
QQ="QQ:25926183"
Email="Email:fty1995@163.com"
InsTitle="加密/解密VBS脚本(简易免杀版)"&Ver
InsAnswer="加密/解密VBS脚本(简易免杀版)"&Ver
RegPath1="HKEY_CLASSES_ROOT\vbsfile\shell\EnCode_VBS\"
RegValue1="加密/解密VBS脚本"&Ver
RegForm1="REG_SZ"
RegPath2="HKEY_CLASSES_ROOT\vbsfile\shell\EnCode_VBS\command\"
RegValue2="wscript.exe " & chr(34) & InsFullName & chr(34) & " " & chr(34) & "%L" & chr(34)
RegPath3="HKEY_CLASSES_ROOT\vbsfile\shell\EnCode_VBS\EnCode_Very"
RegValue3="0"
RegValue4="1"
IF FileFullName <> InsFullName then
intAnswer = MsgBox("【是】将“"+ InsAnswer +"”加入到右键菜单,"&Chr(10)&Chr(10)&"【否】将“"+ InsAnswer +"”从右键菜单删除。 ", vbQuestion + vbYesNoCancel, "安装 - "+ InsTitle +" - "+ Copyright)
    If intAnswer = vbYes Then
WshSHell.RegWrite RegPath1,RegValue1,RegForm1
WshSHell.RegWrite RegPath2,RegValue2,RegForm1
WshSHell.RegWrite RegPath3,RegValue4,RegForm1
FSO.GetFile(FileFullName).Copy(InsFullName)
WshSHell.popup _
"添加脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _
"添加注册表项:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+ _
chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "Copyright(C)  " + Copyright +"   " & QQ &"   " + Email _
, CloseTime, "安装成功 - "+ InsTitle +" - "+ Copyright, 0 + 64
end if
        If intAnswer = vbNo Then
WshSHell.RegDelete RegPath3
WshSHell.RegDelete RegPath2
WshSHell.RegDelete RegPath1
FSO.DeleteFile InsFullName
WshSHell.popup _
"删除脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _
"删除注册表项:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+ _
chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "Copyright(C)  " + Copyright +"   " & QQ &"   " + Email _
, CloseTime, "卸载成功 - "+ InsTitle +" - "+ Copyright, 0 + 64
end if
ELSE
Package = WScript.Arguments.Item(0)
PkgName=FSO.GetBaseName(Package)
PkgPath=FSO.GetParentFolderName(Package)
Set ReadFile = FSO.OpenTextFile(Package, 1)
ReadAllTextFile=ReadFile.ReadAll
if left(ReadAllTextFile,10)<>"Rem EnCode" then
EnCodePanDuan="Rem EnCode-Easy By QQ:25926183"
CodeString=ReadAllTextFile
For i=1 To Len(CodeString)
TempNum = Asc(Mid(CodeString,i,1))
If TempNum = 13 Then
TempNum = 28
ElseIf TempNum = 10 Then
TempNum = 29
elseif TempNum=34 Then
TempNum = 18
elseif TempNum>96 and TempNum<110 then
TempNum=TempNum+13
elseif TempNum>109 and TempNum<123 then
TempNum=TempNum-13
elseif TempNum>47 and TempNum<53 then
TempNum=TempNum+5
elseif TempNum>52 and TempNum<58 then
TempNum=TempNum-5
End If
ThisText = ThisText & chr(TempNum)
Next
Call EnCodeFile
Else
Call UnCodeFile
end if
End if
Set WshSHell = Nothing
Set FSO = Nothing
Set Args = Nothing
WScript.Quit(0)
Sub EnCodeFile()
Set NewFile = FSO.CreateTextFile(FSO.BuildPath(PkgPath ,PkgName&"_Encode.VBS"), True)
NewFile.WriteLine(EnCodePanDuan)
NewFile.WriteLine("ExeString="&chr(34)&ThisText&chr(34))
NewFile.WriteLine("Execute("&chr(34)&"For i=1 To Len(ExeString)"&chr(34)&"&vbCrLf&"&chr(34)&"TempNum = Asc(Mid(ExeString,i,1))"&chr(34)&"&vbCrLf&"&chr(34)&"If TempNum = 28 Then"&chr(34)&"&vbCrLf&"&chr(34)&"TempNum = 13"&chr(34)&"&vbCrLf&"&chr(34)&"ElseIf TempNum = 29 Then"&chr(34)&"&vbCrLf&"&chr(34)&"TempNum = 10"&chr(34)&"&vbCrLf&"&chr(34)&"elseif TempNum=18 Then"&chr(34)&"&vbCrLf&"&chr(34)&"TempNum = 34"&chr(34)&"&vbCrLf&"&chr(34)&"elseif TempNum>96 and TempNum<110 then"&chr(34)&"&vbCrLf&"&chr(34)&"TempNum=TempNum+13"&chr(34)&"&vbCrLf&"&chr(34)&"elseif TempNum>109 and TempNum<123 then"&chr(34)&"&vbCrLf&"&chr(34)&"TempNum=TempNum-13"&chr(34)&"&vbCrLf&"&chr(34)&"elseif TempNum>47 and TempNum<53 then"&chr(34)&"&vbCrLf&"&chr(34)&"TempNum=TempNum+5"&chr(34)&"&vbCrLf&"&chr(34)&"elseif TempNum>52 and TempNum<58 then"&chr(34)&"&vbCrLf&"&chr(34)&"TempNum=TempNum-5"&chr(34)&"&vbCrLf&"&chr(34)&"End If"&chr(34)&"&vbCrLf&"&chr(34)&"ThisText = ThisText & chr(TempNum)"&chr(34)&"&vbCrLf&"&chr(34)&"Next"&chr(34)&")")
NewFile.WriteLine("Execute(ThisText)")
NewFile.Close
WshShell.popup chr(10) &_
"加密成功了!保存为文件:"+ chr(10) &chr(10) & _
FSO.BuildPath(PkgPath ,PkgName&"_Encode.VBS")+chr(10)+chr(10)+ _
chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "Copyright(C)  " + Copyright +"   " & QQ &"   " + Email _
, CloseTime, EnCodePanDuan +" - "+ Copyright, 0 + 64
End Sub
Sub UnCodeFile()
Set ReadFile = FSO.OpenTextFile(Package, 1)
ReadLineTextFile1=ReadFile.ReadLine
ReadLineTextFile2=ReadFile.ReadLine
ReadLineTextFile3=ReadFile.ReadLine
ReadFile.Close
Set NewFile = FSO.CreateTextFile(FSO.BuildPath(PkgPath ,PkgName&"_Uncode.VBS"), True)
NewFile.WriteLine(ReadLineTextFile2)
NewFile.WriteLine(ReadLineTextFile3)
NewFile.WriteLine("EnCodePanDuan="&chr(34)&ReadLineTextFile1&chr(34)&vbCrLf&"EnCodePD="&chr(34)&"Rem EnCode-Very By QQ:25926183"&chr(34)&vbCrLf&"For i=1 To Len(ThisText)"&vbCrLf&"TempNum = Asc(Mid(ThisText,i,1))"&vbCrLf&"TempChar = Chr(TempNum)"&vbCrLf&"if EnCodePanDuan=EnCodePD then"&vbCrLf&"If TempChar = Chr(58) Then"&vbCrLf&"TempChar = Chr(13)"&vbCrLf&"End If"&vbCrLf&"End If"&vbCrLf&"ThisTextTem = ThisTextTem & TempChar"&vbCrLf&"Next")
NewFile.WriteLine("strCode = (ThisTextTem)"&vbCrLf&"Set WshSHell = WScript.CreateObject("&chr(34)&"WScript.Shell"&chr(34)&")"&vbCrLf&"Set FSO = CreateObject("&chr(34)&"Scripting.filesystemobject"&chr(34)&")"&vbCrLf&"FileName = WScript.ScriptName"&vbCrLf&"Set fC = FSO.OpenTextFile(FileName, 2, true)"&vbCrLf&"fC.Write strCode"&vbCrLf&"fC.Close"&vbCrLf&"Set WshSHell = Nothing"&vbCrLf&"Set FSO = Nothing"&vbCrLf&"WScript.Quit(0)")
NewFile.Close
WScript.Sleep 1500
WshSHell.Run (chr(34)&FSO.BuildPath(PkgPath ,PkgName&"_Uncode.VBS")&chr(34)), vbHide
WshShell.popup chr(10) &_
"解密成功了!保存为文件:"+ chr(10) &chr(10) & _
FSO.BuildPath(PkgPath ,PkgName&"_Uncode.VBS")+chr(10)+chr(10)+ _
chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "Copyright(C)  " + Copyright +"   " & QQ &"   " + Email _
, CloseTime, "解密成功 - "+ InsTitle +" - "+ Copyright, 0 + 64
End Sub
逍遥@浪子@反病毒
http://hi.baidu.com/luckboy039

TOP

以上是VBS,BAOMABOY编写的

这里是木森林的BAT版本

@echo off
:: Code by pengfei CMD@XP
:: 出处:http://www.cn-dos.net/forum/viewthread.php?tid=22254

color 27
:start
cls
echo *******************************************************************************
echo *                                                                             *
echo *                    BAT    加    密    最    终    版                        *
echo *                                                                             *
echo *******************************************************************************
echo.
echo.
echo BAT加密最终版为"BAT加密工具"的更新版本, 较上一版加密工具而言有诸多优势:
echo.
echo ★  可以一次性成功加密任何批处理文件, 更省事.
echo.
echo ★  可以由您输入任意需要加密的批处理, 加密灵活性更大.
echo.
echo ★  能够自动判断错误输入, 更加人性化.
echo.
echo 说明: 在下面输入需要加密的批处理文件, 直接输入批处理文件名为加密当前目录下的BAT,也可以带路径指定任意BAT. 当前目录下生成的encrypt.bat文件即为加密的批处理.
echo.
echo 作者:木林森  QQ:573381312  BYE
echo.
echo.
echo.
set /p file=请输入需要加密的批处理后按回车键(q=退出):
if "%file%"=="q" goto quit
echo %file%|findstr /i "\.bat$">nul && goto go
echo %file%|findstr /i "\.cmd$">nul && goto go
cls
echo ==============
echo 请正确输入!
echo ==============
echo.
echo.
echo 按任意键重新输入......
pause>nul
goto start
:go
if not exist "%file%" goto newly
if exist encrypt.bat copy encrypt.bat encryptbak.bat
echo %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a >"%tmp%\encrypt.tmp"
echo cls>>"%tmp%\encrypt.tmp"
type "%file%">>"%tmp%\encrypt.tmp"
setlocal enabledelayedexpansion
for %%i in ("%tmp%\encrypt.tmp") do (
    echo %%~zi >nul 2>nul
    set size=%%~zi
    set num=!size:~-1!
    set /a mod=!num!%%2
    if !mod! equ 0 (goto even) else (goto odd)
)
:even
copy "%tmp%\encrypt.tmp" encrypt.bat
del "%tmp%\encrypt.tmp"
cls
echo ==========================
echo 恭喜你, 批处理加密成功^^!
echo ==========================
echo.
echo.
echo 按任意键退出......
pause>nul
goto quit
dd
echo. >>"%tmp%\encrypt.tmp"
copy "%tmp%\encrypt.tmp" encrypt.bat
del "%tmp%\encrypt.tmp"
cls
echo ==========================
echo 恭喜你, 批处理加密成功^^!
echo ==========================
echo.
echo.
echo 按任意键退出......
pause>nul
goto quit
:newly
cls
echo ================================
echo 找不到批处理文件, 请重新输入!
echo ================================
echo.
echo.
echo 按任意键开始......
pause>nul
goto start
:quit
exit
逍遥@浪子@反病毒
http://hi.baidu.com/luckboy039

TOP

回复 1# 0000


    在
  1. goto :end
复制代码
这行的上面输入以下
  1. echo,变量file2的值为:"%file2%"&pause
复制代码
然后输入文件名:【!time!.txt 】测试,
看变量【file2】的值是否还是【!time!.txt 】。

TOP

返回列表