本帖最后由 email10t 于 2015-3-6 20:57 编辑
- @echo off
- :: ax = b8h
- :: bx = bbh
- :: cx = b9h
- :: dx = bah
- :: sp = bch
- :: bp = bdh
- :: si = beh
- :: di = bfh
-
- setlocal
-
- if not exist "c:\windows\system32\debug.exe" goto no_debug
-
- set dq="
- set excla=!
- md temp
- cd temp
-
- goto :length
-
- :main
- echo e 0100 b8 0 13 bb %1 0 b9 %hex% ba %y% %x% bd 16 1 cd 10 b8 0 4c cd 21 >1.txt
- (echo rcx & echo 16 & echo n temp & echo w & echo q) >>1.txt
- debug<1.txt>nul
- echo[!str!>>echoing
- copy /b temp+echoing writing.com >nul
- del 1.txt
- del TEMP
- del echoing
- del $
- writing
- cd..
- rd/s/q temp
-
- endlocal
- endlocal
- goto :eof
-
- :hexconvert
- set hexstring=0123456789abcdef
- set /a h3=(strlen^>^>12)^&15
- set /a h2=(strlen^>^>8)^&15
- set /a h1=(strlen^>^>4)^&15
- set /a h0=(strlen^>^>0)^&15
- set hex=!hexstring:~%h1%,1!!hexstring:~%h0%,1! !hexstring:~%h3%,1!!hexstring:~%h2%,1!
- set /a h3=(x^>^>4)^&15
- set /a h2=(x^>^>0)^&15
- set /a h1=(y^>^>4)^&15
- set /a h0=(y^>^>0)^&15
- set x=!hexstring:~%h1%,1!!hexstring:~%h0%,1!
- set y=!hexstring:~%h3%,1!!hexstring:~%h2%,1!
- goto main
-
- :length
- set x=%2
- set y=%3
- set str=%4
-
-
- setlocal enabledelayedexpansion
-
- if not "!str:~0,1!" == "!dq!" goto returning
- set str=!str:~1,-1!&rem 删除引号
- if not "!str!" == "" set str=!str:""=^"!&rem 反向转义
- :returning
- echo[!str!>$
- for /f %%@ in ("$") do set/a strlen=%%~z@-2
- goto hexconvert
-
- :no_debug
-
- echo 我机器上没有 debug :(
- goto :eof
复制代码
|