中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
作者:
标题: 16进制文件还原-趣味东 上一主题 | 下一主题
qwd
初级用户





积分 161
发帖 56
注册 2007-10-1
状态 离线
『楼 主』:  16进制文件还原-趣味东

所解文件每行不得大于8818字节,如果过长请自行手动断行后再处理!

可以自动忽略空格的存在 “-”符也转为空格被忽略  在这方面可以不拘格式比较方便还原!
@echo off&setlocal EnableDelayedExpansion
title 16进制文件解密! QQ:309254515-趣味东
set file=qwd.txt
:new
echo: ----若行长大于8188字节请自行手动分行----&echo.
set/p file=解密16进制文件路径:
echo.
dir/a-d/-c !file!|findstr "文件"
echo.&echo.      字节-起点-行号        数值
for %%i in (0123456789ABCDEF,xh,480,b," ",sp) do if "!.!"=="" (
    set.=%%~i)else (set %%i=!.!&set.=)
for /l %%i in (1 1 64) do set t=!t!
(echo debug^<%%0^&exit)>j.bat
for /f "delims=" %%i in ('type !file!^&echo//') do (
      set n=0
      set $=%%i&set $=!$:-= !
      call:str
)
(for %%i in ("" ntmp.txt rcx !bh! w q) do echo.%%~i)>>j.bat
echo.
del tmp.* 2>nul
start/min/wait j.bat
:del j.bat
for %%i in (jpg bmp gif mp3) do (
  set yn=y&set/p yn=%%i y/n:
  if !yn! equ n set bt=&goto new
  if !yn! equ y ren tmp.* tmp.%%i&start tmp.%%i
)
del tmp.*
pause>nul
exit


:str
if "!$:~%n%,1!" neq " " (
    set/a b+=1,k=b%%2,h=b%%32,bx=b/2
    set/p=!t!请稍等:!bt!-!b!-!bh!        !$:~%n%,1!<nul
    if "!$:~%n%,1!" equ "/" (
         set bh=&set/a"bx=(bx+16)/16*16"
         call:h&echo.e!bh!        !ts!>>j.bat&set ts=
         set bh=!bh:~,-1!f&goto:eof
    )
   
    set ts=!ts!!$:~%n%,1!!sp:~,%k%!

    if !h!==0 (
        set bh=
        call:h
        echo.e!bh!        !ts!>>j.bat
        set ts=&set h=
    )
)
set/a n+=1,bt+=1
if "!$:~%n%,1!" equ "" (goto:eof) else (goto str)

:h
set/a by=bx%%16,bx/=16
set bh=!xh:~%by%,1!!bh!
if !bx! neq 0 goto h
goto:eof
打包里的gif.txt原文件整个是一行的,现在是经手动断行修改后的三行文件。
其中的第一行为最长了,经测试变量名和变量值共计不超过8189字节,也许不准或有遗漏。比如截取字串是否影响它的长度呢!有兴趣的可以深入测试

测试时:可以在第二行的最开始处,如有空格在空格前加入 / 号,这个是处理文件结束自加入的结束符。可以修改它的位置测试。要同时在批文件中加入暂停pasue命令  
所在位置
call:h&echo.e!bh!        !ts!>>j.bat&set ts=
         set bh=!bh:~,-1!f&goto:eof

改成 set bh=!bh:~,-1!f  &pause  &goto:eof





下面这个文件小于8188字节 不用手动分行

qwd.txt

47494638376180006400A50000FFFFFFFFFFFFFFFFFFFEF7F7EA5050F8C1C1E31111EC5E5EFBE0E0F18B8BE31414F07C7CF39A9AE94141E52323EE6D6DE73232F5A9A9FFFEFEFCE5E5FEF4F4F6AFAFFBE1E1ED6A6AE62E2EEA4C4CF4A5A5F18888F8C3C3F9D3D3FAD4D4F4A3A3F9CFCFF8C4C4E63131F7BDBDEA4E4EF4A6A6F6B2B2F8C5C5ED6565F19191F5ADADF29191F4A0A0FBE2E2EC6565EB5A5AF8C8C8FCE7E7FBE3E3F6B7B7EB5858F9CBCBED6C6CEA4B4BEF7B7BFDEFEFFCE9E9F18989F8C9C9FBDEDEF07F7FFAD6D62C00000000800064000006FE408170482C1A8FC8A472C96C3A9FD0A8744AAD5AAFD1C160482816908661587A3860CF5382C1B035AE115A61A22B5008160B46239110AED7070E6B430A7F420763867F6302045D0B0D0D8C447F6D684F088B7F0F0F83028A95039A9A059A0E747E8B0888A36B10060D02825DAC9E060E82A3974D99ADBEBFBFA5B0929A09C0066AA0C76BB8AD76BB4B807F0585A3C4CBAD8EC97F0B9A0AD56B09D5B9D80E0FDDDECFD060A6DBD8EFADB5F0F0D78B6593EB62F3FBCBF5FCC7FE36E53BC22FC39F08DED680FB37CF1DBC816EE669086001034378E62E2E8348695E808F1B0CE0D1088C1C495F1CF5BDCBF031404866FF029EA49752E5B20D2D2FC073B82612FE3C743361D5142201038C63182CB434A87181BC4516742E021A94C1D09616345CD8BA8141068B1838B40CA0E18F4C0C182E6CD0A08183DB1252EF69C210402AB75126B3011B2A60AC5FAC7F295AB01043C6E0C181FD5A00C6D2EE220718D86EB8F0B501860C94DFF1ED9BB8B3E7CF1F7562D8B081E99FC6AD1C88EDCC81664D0B1C286356BBD6ADD2B1B0DDEADEAD7BC6E4AD1982AF59D0012B070DA457F3768BFCB0DFD8D65C59AB796C81A0DB14DF39FA053A70EB45693F1A788010BCC5517DA803B34EB7E5F9655447AD26CB960376E4BF333F3640F7FB44D8D855A40904E97164805CBEE0F451593345A6C17B6B88E58101AF4CB54058A791B5C64481FEBDA4C950088ED25E0031D0F04756412D22D607CE287081608879A8165B633966484D329D98D31FED5D840045C75D80D6054A3D38CA372FB2C5A18DFC61D5CA50C6FCC261763C7E04215EBE8CE8196CF8BDF4E21F1F19E4D61F0A0A380A2A03F1C1802F2F8E859F5A611AE0420A6DD560DA2F5A7667A5013829B9E7441C3C90549C3D2D82E6400C209097012CE9E91783BFAC895D00C7B575D8A583BD54664B7F8040E96D903E3994496AB4E9E88EBE6CD3A891F0B465D18B8BF534E57728D554612B1B30A7A4A58A7160C39567CE35575D911EB7064BB1AE612AB08B0CF547023E8D72AB8EC44A378F308CAE4157B20A41C5E08B21F078DF313565E24094FEA999E4C05217AD396848ED9126AF0891B9F5116294FEA1DC82F6345BEE2D39FAC2AE466D8ED0E45F16341A18831C86B46AAD290112F0282EA08AA559BF28A853A3958EA081411990F0DEA02518C021AD8D264C8AB3B0B019EA1A158736CFA262C5FA22ADC7281552CD102A7CE7660D2C946100572AEC217FCCFEA2F01A38E10C8CCEFC31C928BF7F2860554DE5DD52A54BA3186D4094F625DDCAB83849DD8ACC8C7D5C350357472C6291D22A1CEA7F3760B3EFBD2F3F4DF422D11E748D238D1C9ACF1AAA42DD8ADC9AE064A62F10ACB65806016E20F61F0400EBCF9ABAB04C26DA87B73483B506C02AB609030F3A566C8B52CE102E7C0D6DF681A6E63DF5FEE28B78DD329FDE0999A203EAB83DF5EB062070424BB2CF0E2C87905E1356621C484E12029B095B4C9419CCC7359B541AA08020493266FD73A5FD43400491680E0C1F0A94E09787CD2CA2D622429BB250065332AFD5E4ADC4A2DE4A7E01DFED4569F95E606073823BED657FEFA89F692636930D4C6A4BC831E022DA0691F8E92542EE499133447401017EA679BFC9000511C5000B4A6314B93ADA319E129D74E0A983A71A4B4DD464420DCE0302351C100A66C481105CCA336E3321BA34B21006DA505B69E115947E119F563CC088869A163C72B80F067CC17C47E4074F9082BF518C301FBDC8624958C810FBEC037ABEBB4C70BE72253576B11C2932E33CFED0981202E02031F872D2FF6C28C56568805BD8E00B01EAF7190FE5006FA5418B1A6BE316E70D481304E8E331FEB88FA1BC829008BBDF22624811FCA56E92803CC615DDA620446E456C9C0C0053FAB60CFA3952139484C7280D3435CE1D433531E48002A0583BDC68652B5B198C2283034CFD7CA826ACF8880EE0010142C68039F22AA52A77992BDD68D217988CE14B70910B96D58C99A6E240D26E13AB14E0512B0C10E71F4C75AADC70C034105083E0D6F187FFCC436162BB8D7FBAD333D91013988E3B8E0ADEB8BF36312944430BE5263FF21D85B5843754FA642F153A0A79D4A419A6CA4A34350003C9BCE761DC6128B5AA0595EF3C60056B09DF1A38FE81889B6183150458C04595A5274819144F0F0D07F2C6F62D47B953576FBA13045826CDCEA86C4320B9C5A21446AB36C9EE7A1E4CE59E6E51869448400003282A90DE7425E5FC229C437BAA4E20C08201EA6652D6DC959256F007070C4502C690A6876A881D0CC8A31AA5841448C1A34A0A310A985F19C5588E21C5254A936FBFC0CE06E451A1F994857BF7BAD28B24E80B87C22F3E426BDD6131E68BF9386DA41E2A2A97FED8D765984E3C0F19CA0212E059ED15AAB37A1C564B3C94CDB174B1040F54E10153820EC5FE6221534AD61F0134961DD49378D1240D653501B9857571A82C1BCB7247115C7D2546469CCBDA4DB6345D0A4177283CB0ED5CB482FEC2D82EEF2F7732263CCE4B96EADDEB3E6213C05587523F10B665350C2247290129DA3568771FE164CA6A28839BE5CA972FA039AA7E73FA07CC5DA02DAC624864EE75A7E2F4D5A1D73B2682CD4ADE5698AA078B18E2498894544DB460AAEEC5CA95BAD1BB81F8E051DDDD1CD59EA5910AA5589DF2F98808DC372916648E239C509CF39A083FA6116F0D0CF82F297C61926662E575AB71C1360A51DF9FA544A2DB2D71A248725ADD6A6235CC6AEE43998245D54DD262F99B07A8BA08E62C7D4F03AD6B05B6A484E6BB680D1EA479A301DA4C6719E2A8ADFB980F65896C433E4FA0018218A23471D4000A30043B2F580619A5B58FDB44DA0013C885884D5593FE4EA02B01733E867413E2C25F2899D00B25E9313283407E8857D24C44354E4B0C8FF942648FF370DC497839A0D9127611B61E48279881E55644E6073116E31A6EE3E55F0C65D80CF946D594AD344269A62698BB18300E400070F0DAB5374C519C718D0D02147B75E76E852407143D85409BDA17249C18651ABD49C3FBDE9AA077BDEDBD8F7797A4D42769E2668CC08A30B26D0168F4EF6F2150213C1020DB0A2984032460168AA3841BE4889600442C8A031568E062108224868000343EA00D891883FE20E0D621B0ED0B83508319FC80F050DCE8136CC345044A0EBD071C8213060836032A00F2233C31253357C2788C5EF4A63BFDE9508FBAD4A74EF5AA055B7D284100003B

[ Last edited by qwd on 2010-1-26 at 19:47 ]

   此帖被 +14 点积分      点击查看详情   
评分人:【 slore 分数: +10  时间:2010-1-26 22:29
评分人:【 radem 分数: +4  时间:2010-1-27 18:17


附件 1: 解密16进制.rar (2010-1-26 19:23, 12.18 K,下载次数: 13)
2010-1-26 18:59
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
slore
铂金会员





积分 5212
发帖 2478
注册 2007-2-8
状态 离线
『第 2 楼』:  

bat的话果然是得debug

eXXX单行最多25字节。。。不然直接整段下了。


速度太慢了。。。看那数字慢慢飘的。。

还是ADODB.Stream快。。。



S smile 微笑,L love 爱,O optimism 乐观,R relax 放松,E enthusiasm 热情...Slore
2010-1-26 22:29
查看资料  发短消息 网志   编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: