Board logo

标题: 关于 批处理中 密码输入隐藏 我老师给出的解释 [打印本页]

作者: bjsh     时间: 2007-4-19 21:25    标题: 关于 批处理中 密码输入隐藏 我老师给出的解释

关于那段

  Quote:

  1. : by Herbert Kleebauer
  2. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3. @echo off
  4. echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5x>in.com
  5. set /p password=Enter password:<nul
  6. for /f "tokens=*" %%i in ('in.com') do set password=%%i
  7. pause
  8. del in.com
  9. echo.
  10. echo The Password is:"%password%"
  11. pause
         BJSH发表于:  2007-04-19  08:13

中的
echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5x>in.com
这一句问了一下我的老师;他给我讲解是这样的:我觉得更清楚更容易理解些;
拿出来分享一下

这个例子中的文件名是加了单引号,这就意味着这是一个外部命令,
也就是说,它是要被执行的。

in.com经过反汇编后,代码如下:

00000000: 685031                    push 3150
00000003: 58                        pop ax     ; AX=3150
00000004: 353030                    xor ax,3030 ; AX=0160
00000007: 50                        push ax
00000008: 5B                        pop bx ; BX=0160
00000009: 50                        push ax
0000000A: 5A                        pop dx ; DX=0160
0000000B: 42                        inc dx
0000000C: 42                        inc dx
0000000D: 42                        inc dx  ; DX=0163
0000000E: 666823622323              push 23236223
00000014: 6658                      pop eax ; EAX=23236223
00000016: 662D56406024              sub eax,24604056 ; EAX=FEC321CD
0000001C: 6650                      push eax
0000001E: 665D                      pop ebp ; EBP=FEC321CD
00000020: 66332F                    xor ebp,dword ptr [bx] ; EBP=EBP ^ [0160]
00000023: 66312F                    xor dword ptr [bx],ebp ; [0160]=FEC321CD
                                                            ; +0160 CD
                                                            ; +0161 21
                                                            ; +0162 C3
                                                            ; +0163 FE
其中+0160 与 +0161中的两个字节CD 21反汇编出来就是int 21h指令
+0162中的C3反汇编出来就是ret指令
最后那个+163中的FE是DOS输入功能0Ah的参数(前面的DX=0163就是指向了这个FE),
表示最多允许输入254个字符(包括回车在内)
00000026: 352B2B                    xor ax,2B2B  ; AX=0AE6,其中0Ah是DOS功能号,
                                                  ; E6没有用处
00000029: 7535                      jnz 00000060 ; 这里肯定会发生跳转,相当于jmp 160
0000002B: 78                                     ; 最后的78无用
0000002C: 0D                                     ; 0D与0A是echo时自动
0000002D: 0A                                     ; 产生的回车换行符
程序跳转到160后,就会执行以下指令:
int 21h ; 此时AH=0Ah, DX=0163h, 因此执行DOS的输入功能,
        ; 输入内容自动保存到+165开始的缓冲区中,而for循环会把各个字符逐个读出
ret     ; 程序返回到操作系统,自动结束

总结一下,这个in.com的作用是通过键盘输入一串字符,长度不超过254个(含回车)。
这个批处理还是比较巧妙的,它用一串可显示的字符串构造了一个可执行代码,实现了
键盘输入功能,配合for循环使得在批处理中可以实现不回显输入。

P.S.: 根据分析,这个批处理中的echo语句所包含的一堆乱码里的最后
      那个字符(即>前面++u5x中的x)可以删除不要。也可就是说,
          echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5x>in.com
      可以改成
          echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>in.com
作者: sisos     时间: 2007-4-19 23:32
虽然看了有点晕,但是基本理解了是怎么一回事,谢谢lz
作者: htysm     时间: 2007-4-20 00:26
强。
作者: wydos     时间: 2007-4-20 01:00
强!不过还是看不懂!
作者: estar     时间: 2007-4-20 02:00
来晚了,加分顶!
作者: hulongzhuo     时间: 2007-4-20 04:26
不错,正要这样一个代码!!!!
作者: 13579246810     时间: 2007-4-20 06:22
感激 涕零 !!太伟大了!
作者: flyinspace     时间: 2007-4-20 07:23


  Quote:
Originally posted by bjsh at 2007-4-19 08:25 AM:
关于那段

中的
echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5x>in.com
这一句问了一下我的老师;他给我讲解是这样的:我觉得更清楚更容易理解些;
拿出来分 ...

哦。这个倒是明白。。。

不过没还要他想得巧妙:)汇编高手来着呢。
作者: zqz0012005     时间: 2007-4-20 07:49
我靠!echo还有这等功能!
作者: caucfeiyu     时间: 2007-4-24 09:46
新手啊,看不懂!还得继续学习啊!学无止境啊!
作者: yzshde007     时间: 2007-4-25 23:44
呵呵 ``没有永远的绝对``我相信我能超过你``
作者: lxmxn     时间: 2007-4-26 01:52
不错,终于可以解释那一段是什么原理了。

我想以后一些批处理不能完成的简单功能的汇编代码,如果都为ASCII码中可显示字符,应该都可以用这个方法来构造吧。
作者: wert123     时间: 2007-6-2 10:22
厉害啊~~~

[ Last edited by wert123 on 2007-6-2 at 10:25 AM ]
作者: qzwqzw     时间: 2007-6-2 10:37
这里是usenet上关于in.com的讨论
其中提到了in.com的源码
可惜是摩托罗拉的汇编代码
看起来是有些费劲

  Quote:
===== dd9d6451a63628c6 - 067a017af143d6a8 =====
===== alt.msdos.batch.nt - need no echo for set /p - Mon, Nov 24 2003 9:40 =====


Uno wrote:
> > @echo off
> > echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>in.com
> > set  /p password=Enter password:<nul
> > for /f "tokens=*" %%i in ('in.com') do set password=%%i
> > del in.com
> > echo.
> > echo The Password is:"%password%"

> It doesn't work,the first character echoed is

What doesn't work? It works fine here in W2k.

> This works:

Let's take a look at your source:

        @=$100
        br.w    start                ; a short branch would be sufficient, but
                                     ; you wouldn't need the branch instruction
                                     ; at all if you would put the data behind the code

handle: dc.w    0                    ; you don't need this variable
fil:    dc.b    "c:\temp\oihjs",0    ; why do you need this file, write to stdout

sor:    blk.b   120,0                ; 120 needles bytes in your code

start:  move.w   #fil,r1
        eor.w    r2,r2
        move.b   #$3c,m0
        trap     #$21                ; how about testing the carry flag for errors?
                                     ; why don't save the handle
        move.w   #0,r5
pro:    move.b   #$07,m0
        trap     #$21
        cmp.b    #$0d,r0
        beq.b    fin
        move.b   r0,sor(r5.w)        ; why not test for buffer overflow (>120 characters)
        inc.w    r5
        br.b     pro

fin:    move.w   #fil,r1
        move.b   #2,r0
        move.b   #$3d,m0             ; you have already opend the file with fct 0x3c
        trap     #$21                ; why do you open it again?
        move.w   r0,handle           ; why not just put the handle in BX
        move.w   #sor,r1
        move.w   handle,r3
        move.w   #38,r2              ; why do you write 38 bytes to the file? write
        move.b   #$40,m0             ; exactly as many bytes as read in the loop above
        trap     #$21
        move.b   #$4c,m0             ; if you don't use the return code a simple ret is
        trap     #$21                ; shorter

> echo Enter password
> pass.com
> set /p a=<c:\temp\oihjs

Write to stdout in pass.com (there is no need to generate a
temporary file) and use:

for /f "tokens=*" %%i in ('pass.com') do set a=%%i
> echo Password is %a%
> del c:\temp\oihjs
> del pass.com



===== 64caaf380175e875 - 10adb2216a0e63ab =====
===== alt.msdos.batch.nt - New Project: Creating a web form to make a batch file execute on ausers machine? - Thurs, Jan 16 2003 11:37 =====


Musafir wrote:

> Herbert Kleebauer <k...@unibwm.de> wrote in message <news:3E266907.56E09070@unibwm.de>...

> > @echo off
> > echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>in.com
> > set  /p password=Enter password:<nul
> > for /f "tokens=*" %%i in ('in.com') do set password=%%i
> > del in.com
> > echo.
> > echo The Password is:"%password%"

> How does that work?? in.com is a program that takes the user input
> without echo-ing it to the console? I also noticed that changing the
> variable 'password' to 'pass' causes the script to fail.

in.com just writes the typed text to stdout. Whether you name the
variable password or pass doesn't matter at all. What do you mean
with the script fails?


> I guess the crux of the question is, how do you get to that crazy
> stream of characters for in.com?

in.com is a 5 line assembler program:

        move.b  #$0a,m0
        move.w  #buf,r1
        trap    #$21
        rts.w
buf:    dc.b    80

The same code with opcodes in the ascii range (so you can use the
echo command to dynamically generate it) is a little bit longer:

        move.w  #$160^$3030,-(sp)
        move.w  (sp)+,r0
        eor.w   #$3030,r0
        move.w  r0,-(sp)
        move.w  (sp)+,r3
        move.w  r0,-(sp)
        move.w  (sp)+,r1
        inc.w   r1
        inc.w   r1
        inc.w   r1
        move.l  #$23236223,-(sp)
        move.l  (sp)+,r0
        sub.l   #$24604056,r0
        move.l  r0,-(sp)
        move.l  (sp)+,r4
        eor.l   (r3.w),r4
        eor.l   r4,(r3.w)
        eor.w   #$2b2b,r0
        bne.b   $160


===== 6366179533ac8f8f - 3d2c548f8a5ee250 =====
===== comp.os.msdos.misc - Password input.... - Fri, Oct 4 2002 1:18 =====


Philip Harris wrote:

> I have spent a short while trying to get an NT/dos batch file to
> prompt for and get a password (without coughing it to the screen)
> I'm newly returned to dos programming from many years as a Unix
> scripting expert (if it can't be done in sed it can't be done!)
> so when I noticed that everyone seems to write/call/delete temporary
> like there's no tomorrow I was a bit saddened (what happens if two
> people are running the same thing at the same time...)  So I took
> a long look at the web,applied my devious mind and came up with
> the following.

All this debug code just because you are worried about
temporary files? Here a solution with a temporary file (in.com):

@echo off
echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>in.com
set  /p password=Enter password:<nul
for /f "tokens=*" %%i in ('in.com') do set password=%%i
del in.com
echo.
echo The Password is:"%password%"


===== 12b5947a81662410 - 481fa996c5f6ca92 =====
===== alt.msdos.batch.nt - Hiding Password input from user - Thurs, May 2 2002 3:35 =====


Eric wrote:

> I have a script I use in Win2K which will accept input from a user,
> and I have used it for numerous things in the past.  However, now I
> have an implimentation which requires a user to input thier password.
> What I would like to do, is at the point where the user is inputing
> the password, hide that output from the screen.  Either by masking it,
> or hiding it all together.  Any suggestions???

@echo off
echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>in.com
set  /p password=Enter password:<nul
for /f "tokens=*" %%i in ('in.com') do set password=%%i
del in.com
echo.
echo The Password is:"%password%"

::
:: The source code:
::
::        @=$100
::        move.w  #$160^$3030,-(sp)
::        move.w  (sp)+,r0
::        eor.w   #$3030,r0
::        move.w  r0,-(sp)
::        move.w  (sp)+,r3
::        move.w  r0,-(sp)
::        move.w  (sp)+,r1
::        inc.w   r1
::        inc.w   r1
::        inc.w   r1
::        move.l  #$23236223,-(sp)
::        move.l  (sp)+,r0
::        sub.l   #$24604056,r0
::        move.l  r0,-(sp)
::        move.l  (sp)+,r4
::        eor.l   (r3.w),r4
::        eor.l   r4,(r3.w)
::        eor.w   #$2b2b,r0
::        bne.b   $160


===== 1c25426d9a8ab4b6 - 4ab6d4497df2d023 =====
===== alt.lang.asm - Ad-hoc Parsing? - Wed, Dec 29 2004 5:23 =====


Phil Carmody wrote:
> Herbert Kleebauer <k...@unibwm.de> writes:
> > The whole sub thread is about the statement, that batch scripting in
> > DOS/Windows is at least as flexible as csh/sh/bash scripting in
> > Unix/Linux.
> Therefore
> if people (T.M., Robert, myself) have been discussing the unix
> shell without explicitly mentioning an OS, that means they have been making
> statements _strictly_ about just the shell itself.

Maybe you should switch from your write only mode to read mode.
The discussion was about Linux compared to Windows:

  +---------------------------------------------------------------------
  | From: "T.M. Sommers" <t...@nj.net>
  | Subject: Re: [ Attn: Randy ] Ad-hoc Parsing?
  | Date: Thu, 16 Dec 2004 18:38:13 GMT
  |
  | > and this is exactely where Linux completely fails,
  | > and why almost no real final users want to use it.
  |
  | Linux has plenty of users; so does BSD.
  |
  | There are more people in the world than grannies and tots.  If
  | you are aiming your OS at grannies and tots, then obviously it
  | must be usable by them, but if you are aiming your OS at people
  | who want to get real work done, then you have different
  | requirements.  One of the biggest advantages of Unix-like shells
  | is that they allow the user to do things that the creator of the
  | shell never imagined.
  +---------------------------------------------------------------------

The statement in the above posting is, that the command
line interface in Unix is more powerful and flexible than
the command line interface in Windows, because of the much
better Unix-like shells (sh, csh, bash, ...) used in Unix/Linux
compared to the command.com/cmd.exe shells in DOS/Windows.

My answer was, that scripts in DOS/Windows (using the less
powerful shells command.com or cmd.exe) are at least as
flexible as the Unix scripts using the more powerful
Unix-like shells, because they can extend their abilities
by directly including CPU instructions (because of the
header free .com file format).

Your statement: "It (bash) can execute the .com file as
easily as a command.com or cmd.exe batch file can", can
in the above context only be interpreted as "It (bash
in Unix) can ....". This is simple wrong. Then you changed
your mind and said, that you meant "It (bash in Windows) can ...".
This simple doesn't make any sense in the above context.

When I say, that, despite the less powerful Windows shells,
Windows scripting is as flexible as Unix scripting because
of the ability to include CPU instructions, then it doesn't
make any sense to say, bash in Windows can also include
CPU instructions and therefore bash scripts (in Windows)
are at least as flexible as bash scripts (in UNIX).

> > The reason is, that there is a header free executable
> > file format in DOS/Windows which makes it possible to directly
> > embed cpu instructions within a DOS/Windows batch script.

> WRONG. For fuck's sake, Herbert, evolve. Your logic is just plain crap.
> Therefore you cannot logically say that
> the existence of .COM files "makes it possible to" do anything
> of the sort.

I never said this. I said, it "makes it practicable". I have
a whole collection of such small com programs (which consist of
a few echo lines only) which I include in batch files. But I would
never have done this, if I had to include Win32 exe files. It
also would be possible, but it is impractical.

> > The statement "It (bash) can execute the .com file as easily as
> > a command.com or cmd.exe batch file can" without the addition
> > "when bash is used in DOS/Windows" is not true. If it were true,
> > than bash used with any operating system had to be able to execute
> > .com files.

> Nope - it was a comparison of one scripting language to another
> scripting language. I make no reference to the OS it is running
> on; you ASSume that bash runs only under unix. I'm not going to
> feel guilt that you are ignorant that bash runs under MS windows
> too.

Something with your logic must be wrong. Command.com and cmd.exe
are bound to DOS/Windows, therefore a command/cmd script can
always initiate the execution of .com program (it doesn't
execute the com program itself). Bash is not bound to DOS/Windows,
so bash can't always initiate the execution of .com program. Only
when used in DOS/Windows, bash also can start a .com program.
Therefore the statement "It (bash) can execute the .com file
as easily as a command.com or cmd.exe batch file can" simple
is wrong.

> I repeatedly made statements about bash. You interpreted them
> to only refer to bash on unix. Your mistake. Get over it.

The same mistake. You didn't make statements about bash, but
about bash in Windows. A statement about bash has to be true
independent of the operating system.  

> > echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>in.com
> > is nothing but this CPU instructions:
> > And this is possible because of the .com file format.

> Rearrange the following 5 letters to make a word - WRNOG.
> If it's possible in unix to create ELF binaries using sh, then it (the
> ability to drop small executables) _cannot_ be "because of the .com file
> format".

You really should start to read: "is NOTHING but this CPU instructions".
Now show me your elf binary which "is NOTHING but this CPU instructions"

> > > I can't live without features like independent stdout/stderr
> > > redirecting and ${//} in bash, and the powerful single and double
> > > quoting rules in all sensible unix shells, so I certainly can say
> > > that I need the additional flexibility that bash gives me.

> > Sorry, but that is "functionality" but not "flexibility". I never
> > said, that bash isn't much more powerful than comannd.com/cmd.exe.

> > In this sub thread  "flexibility" was defined by:

> > "T.M. Sommers" wrote:

> > > One of the biggest advantages of Unix-like shells
> > > is that they allow the user to do things that the creator of the
> > > shell never imagined.

> That is a statement about shells.

Yes, about the flexibility of a shell but you are speaking about the
functionality of shell.


> > Now let's make a little test how flexible bash is. Let us do
> > something which "the creator of the shell never imagined"
> > (maybe the creator of the bashl had imagined this, so it is build
> > into bash already, then we will have to find another example).

> OK, you're still talking about shells. Excellent, you've stayed
> on topic for a whole paragraph.

I'm always on topic. And on topic here means bash in Unix, not
bash in Windows.

> > Here a solution for DOS/Windows which don't even use the
> > advanced features of cmd.exe so it can also be executed
> > in pure DOS.
> > Now show us a much easier solution using bash/Linux.

> What the _fuck_ has linux got to do with a comparison between shells?

Because this whole sub thread is about scripting in Unix/Linux
using Unix-lile shells compared to scripting in Windows using
command.com/cmd.exe.


> -- 8< --------------------------------------------------------------------
> #!/bin/sh
> umask 0
> rm -f y_n.com
> echo -e 'Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=\r'>y_n.com
:
> -- 8< --------------------------------------------------------------------
> So, what was the flexibility advantage that batch files have over
> bash scripts again?

That will run only in DOS/Windows but we are speaking about
the flexibility of unix-like scripts in Unix. Come on, you
told us:
          > Is 45 bytes not a small enough ELF executable for you?

and this is an assembly group, so use your assembly skills and show
us how easy it is to extend the ability of bash in Linux to allow
a mouse click on a YES and NO button. As I have shown, 7 echo lines
are sufficent in a DOS batch script (no extrnal program needed).

> You're ->this<- close to joining
> The_Sage and alex the yepper in the killfile.

After the logic you have presented in this thread, I'm not sure
whether you are not The_Sage.


===== 3be1f9dcb404d3c0 - bf942de44bb610da =====
===== alt.msdos.batch.nt - masking passwords - Sun, Aug 4 2002 11:29 =====


ian wrote:

> I have a script which requires the user to enter a password, How would
> I stop the password from being displayed on the screen. I have been
> able to do this in windows 95\98\ME but the script doesn't seem to
> work the same in NT\2k\XP and I'm not quite sure why. Any help would
> be appreciated

In 2k/XP you can use the following (in NT you have to replace the
"set /p" line by "echo Enter password"):

@echo off
echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>in.com
set  /p password=Enter password:<nul
for /f "tokens=*" %%i in ('in.com') do set password=%%i
del in.com
echo.
echo The Password is:"%password%"

::
:: The source code:
::
::        @=$100
::        move.w  #$160^$3030,-(sp)
::        move.w  (sp)+,r0
::        eor.w   #$3030,r0
::        move.w  r0,-(sp)
::        move.w  (sp)+,r3
::        move.w  r0,-(sp)
::        move.w  (sp)+,r1
::        inc.w   r1
::        inc.w   r1
::        inc.w   r1
::        move.l  #$23236223,-(sp)
::        move.l  (sp)+,r0
::        sub.l   #$24604056,r0
::        move.l  r0,-(sp)
::        move.l  (sp)+,r4
::        eor.l   (r3.w),r4
::        eor.l   r4,(r3.w)
::        eor.w   #$2b2b,r0
::        bne.b   $160


===== 9d94049fbdc871f7 - d6c02181c6d79618 =====
===== comp.os.msdos.programmer - DOS debug.exe and 16-bit I/O? - Fri, Oct 28 2005 7:45 =====


Scuch wrote:
> Now i know there's a less simple way to do it: use Debug to assemble a
> tiny program.  But im trying to avoid this solution, or installing any
> third-party software.  Part of the idea is the ability to tell a
> customer over the phone to just pull up a command prompt and read bytes
> back to me if they ever have a problem.

And why don't you give the customer a "first-party software" written
by yourself? All you need is a in instruction and a simple output
routine. If you don't want to use a binary you can also use a batch
file. Here an example of a simple byte IO (you have to modify it, if
you want word IO):

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>in.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU WwX0GwUY Wv;ovBX2Gv0ExGIuht6>>in.com
echo ?@}IIHpkg~K=H?U_PgRN@k?k?GzBNEr@NWbMs?Qm`LKLFQp{@PEKH@`Qpk>>in.com
echo w@CI?J_KE@qo{Oe{\O{Xv@EuxCq`{SfkP?@oko@CaBEFANO@PrTj@{Pe~r>>in.com
echo ?B@K?B?K0x>>in.com

::in.com 8 379
::echo %errorlevel%

in.com 7 379
if not errorlevel 1 echo busy=0
if     errorlevel 1 echo busy=1
in.com 6 379
if not errorlevel 1 echo ack=0
if     errorlevel 1 echo ack=1
in.com 5 379
if not errorlevel 1 echo pe=0
if     errorlevel 1 echo pe=1
in.com 4 379
if not errorlevel 1 echo slct=0
if     errorlevel 1 echo slct=1
in.com 3 379
if not errorlevel 1 echo error=0
if     errorlevel 1 echo error=1
in.com 2 379
if not errorlevel 1 echo NUL=0
if     errorlevel 1 echo NUL=1
in.com 1 379
if not errorlevel 1 echo NUL=0
if     errorlevel 1 echo NUL=1
in.com 0 379
if not errorlevel 1 echo NUL=0
if     errorlevel 1 echo NUL=1

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

The source:

; 5.11.04 in hex1 hex2
; read bit hex1 from inport hex2 to errorlevel (0-1)
; if hex1>7 erorlevel is set to read byte (0-255)

        @=$100

        move.w  #$81,r5
        eor.w   r2,r2
        move.b  -1.b(r5.w),r2
        bsr.w   get_hex
        move.w  r1,r3
        bsr.w   get_hex
        in.b    r1,r0
        cmp.w   #8,r3
        bhs.b   _10
        btst.w  r3,r0
        scs.b   r0
_10:    move.b  #$4c,m0
        trap    #$21

get_hex:
        eor.w   r1,r1
        move.w  #_10,_200
_10:    dec.w   r2
        bmi.b   _30
        eor.w   r0,r0
        move.b  (r5.w),r0
        inc.w   r5
        or.b    #$20,r0
        cmp.b   #'0',r0
        blo.b   _20
        cmp.b   #'f',r0
        bhi.b   _20  
        cmp.b   #'9',r0
        bls.b   _40
        cmp.b   #'a',r0
        blo.b   _20
        sub.b   #'a'-'9'-1,r0
_40:    sub.b   #'0',r0
        lsl.w   #4,r1
        add.w   r0,r1
        move.w  #_30,_200
        br.b    _10
_20:    jmp.w   (_200)
_30:    rts.w
_200:   dc.w    0


作者: tyh     时间: 2007-6-2 11:29
后面的看懵了。
作者: blue812     时间: 2007-8-3 14:54
不错,学习了.
作者: agmindiy     时间: 2007-8-4 14:27
还是看不懂
作者: agmindiy     时间: 2007-8-4 14:27
请问最后那个删除的效果是什么???
作者: agmindiy     时间: 2007-8-4 14:28
汇编太深奥了,寒寒
作者: agmindiy     时间: 2007-8-4 14:28
我也想成为那样的高手
作者: long626201     时间: 2007-8-30 20:54
全E文

作者: voiL     时间: 2007-8-31 12:38
终于有点明白它的意思了..谢谢兄台了哈...
作者: rockdong     时间: 2007-8-31 16:15
头都大了,也没有看懂,留着以后理解吧!
作者: xxi     时间: 2007-8-31 18:47
你老师的汇编,不错嘛
作者: 13514975717     时间: 2007-10-7 21:40
太强啦
作者: hxwxyz     时间: 2007-10-8 22:52
看不懂哦
作者: happyiori     时间: 2007-11-15 16:59
一串字符就可以生成这么强的in.com文件,强。今天算是彻底见识了汇编NB的地方了。
多谢楼主分享,用你的代码我又修改了下解决了我迫切需要解决的问题。

请问各位这段代码出自何处?
作者: huahua0919     时间: 2007-11-15 21:04
汇编不懂!
作者: vlem     时间: 2007-11-16 12:35
简直就不是一般的强啊
作者: z310394543     时间: 2007-11-17 19:31
强啊  留名
以后学习
作者: haiou327     时间: 2007-11-17 22:56
重定符和空设备输入用到这里真是一个妙字啊

[ Last edited by haiou327 on 2007-11-17 at 10:58 PM ]
作者: dfy     时间: 2007-11-25 00:21
看不懂!还得继续学习啊!
作者: xiaoyuer1101     时间: 2007-11-25 00:39
基本看不懂。。
作者: abelwy     时间: 2007-12-22 20:05
刚开始,这些都不懂哦
作者: would2008     时间: 2007-12-23 14:49
妙!设计的太妙了,将汇编和批处理完美地结合了起来.
作者: p1509101     时间: 2008-4-2 18:20
看不懂 不过会引用就可以啦~~
作者: xtanbmy     时间: 2008-4-7 19:45
偶也看不懂
作者: binggao     时间: 2008-4-9 12:18
晕了 真的是太复杂了
作者: chd611     时间: 2008-4-10 12:47
果然学无止境,看也看不懂呢。。。
作者: fourme2009     时间: 2008-4-12 13:04
看不懂,我晕死
作者: would     时间: 2008-4-15 23:38
神人一個
原來echo可以做到咁的地步
真是強
多謝
作者: kyo0407     时间: 2008-4-16 08:05
echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5x>in.com
不懂~
作者: zw4123     时间: 2008-4-16 11:17
厉害 这么简单的一段那么强
作者: llrrqq     时间: 2008-4-16 15:11
说实话没看明白没看懂.
作者: wangyc     时间: 2008-4-30 15:01
高手
作者: blown     时间: 2008-7-26 17:28
for /f "tokens=*" %%i in ('in.com') do set password=%%i

这句不明白,for命令怎么是in.com连接的!
作者: laihaibin08     时间: 2008-10-19 17:28
看不懂!!!!
作者: wltx0808     时间: 2008-10-21 08:30
看不明白 汇编语言我不懂啊
作者: heyaowei124242     时间: 2008-12-14 16:12
不太懂啊~~~
作者: wanxibing     时间: 2008-12-22 22:48    标题: 能否用批处理读出加密的密码文件

能否用批处理读出加密的密码文件
在批处理输入密码然后加密,以后执行再来解密,我用批处理编了个文件夹加密程序代码如下,请大家批正;把以下代码保存为 文件夹加密.bat 输入 "13242905978"
姑且作为sn吧,初次密码自定

@echo off
title 隐藏文件夹专家
color 0f
set Errorlevel=
Cd.>"%~dp0a.txt"
If "%Errorlevel%"=="1" goto hderr
If "%Errorlevel%"=="0" goto sta
:sta
del "%~dp0a.txt" /f /s /q >nul 2>nul
if not exist %windir%\wxbhidefold.dll goto snNZ
if  exist %windir%\wxbhidefold.dll goto mimanz
:mimanz
ECHO.
echo.
echo                     欢迎使用宛希兵专用文件夹创建查看删除程序
echo                     ========================================
echo.
echo                                  !警告!
ECHO.
echo                        !为了本文件的安全请你设置个人密码!
echo.
echo                        以防他人使用本软件!导致不良后果。
ECHO.
set mima=
set /p mima=请你输入个人8位数以上密码以便验证:
for /f %%d in (%windir%\wxbhidefold.dll) do set m=%%d
if  "%m%"=="%mima%" goto bigen
if not "%m%"=="%mima%" goto MIMACOWU
if errorlevel==1 goto MIMACOWU
:snNZ
cls
color 1f
ECHO.
echo.
echo                     欢迎使用宛希兵专用文件夹创建查看删除程序
echo                     ========================================
echo.
echo                                  !警告!
ECHO.
echo                    !为了本文件的安全请你输入sn码,验证你的权限!
echo.
echo                          以防他人使用本软件!导致不良后果。
ECHO.
set sn=13242905978
set /p snnz=请你输入sn码验证你的权限:
if /i "%snnz%"=="" goto nokong
if  /i "%snnz%"=="%sn%" goto scyx
if  not "%snnz%"=="%sn%" goto sncowu1

:scyx
cls
color 0f
ECHO.
echo.
echo                     欢迎使用宛希兵专用文件夹创建查看删除程序
echo                     ========================================
echo.
echo                                  !警告!
ECHO.
echo                        !为了本文件的安全请你设置个人密码!
echo.
echo                        以防他人使用本软件!导致不良后果。
ECHO.
set mima=
set /p mima=请你设定个人密码最好8位数以上:
if /i "%mima%"=="" goto nokong
if exist %windir%\wxbhidefold.dll ATTRIB.exe -A -R -H -S %windir%\wxbhidefold.dll >nul 2>nul
echo %mima% > %windir%\wxbhidefold.dll

type %windir%\wxbhidefold.dll|find "关闭状态"
if "%errorlevel%"=="0" goto nokong

cls
ECHO.
echo.
echo                     欢迎使用宛希兵专用文件夹创建查看删除程序
echo                     ========================================
color 9f
echo.
echo                         请你牢记你的个人密码!你现在的密码是:
echo.
echo                              [    %mima%   ]
echo.
echo                             记住后按任一键继续......
echo.
pause>nul                                             
goto bigen



:nokong
echo %m%>%windir%\wxbhidefold.dll
cls
color 4f
ECHO.
echo.
echo                     欢迎使用宛希兵专用文件夹创建查看删除程序
echo                     ========================================
echo.
echo       你设定的密码不能为空,这样及不安全,请重新输入你的个人安全密码
echo.
echo.
pause>nul
goto scyx
:MIMACOWU
color 4f
cls
echo.
echo                           X!X!X!你的密码有错误 !X!X!X
echo                           ---------------------------
echo.
echo                   注意大小写! 按任一键进行第二次密码输入吧?
echo.
PAUSE>NUL
GOTO mima2

:mima2
CLS
COLOR 0F
ECHO.
echo.
echo                     欢迎使用宛希兵专用文件夹创建查看删除程序
echo                     ========================================
echo.
echo                                  !第二次警告!
ECHO.
echo                        !为了文件的安全请你设置个人密码!
echo.
echo                        以防他人使用本软件!导致不良后果。
ECHO.
set mima=
set /p mima=请你输入个人8位数以上密码以便验证:
for /f %%d in (%windir%\wxbhidefold.dll) do set m=%%d
if  "%m%"=="%mima%" goto bigen
if not "%m%"=="%mima%" goto mima3
if errorlevel==1 goto mima3

:mima3
color 4f
cls
echo.
echo                           X!X!X!你的密码有错误 !X!X!X
echo                           ---------------------------
echo.
echo                   注意大小写! 按任一键进行第三次密码输入吧?
ECHO.
PAUSE>NUL 2>NUL
CLS
COLOR 0F
ECHO.
echo.
echo                     欢迎使用宛希兵专用文件夹创建查看删除程序
echo                     ========================================
echo.
echo                                  !最后警告!
ECHO.
echo                        !为了文件的安全请你设置个人密码!
echo.
echo                        以防他人使用本软件!导致不良后果。
ECHO.
set mima=
set /p mima=请你输入个人8位数以上密码以便验证:
for /f %%d in (%windir%\wxbhidefold.dll) do set m=%%d
if  "%m%"=="%mima%" goto bigen
if not "%m%"=="%mima%" goto mima4
if errorlevel==1 goto mima4

:mima4
color 4f
cls
echo.
echo                           X!X!X!你的密码有错误 !X!X!X
echo                           ---------------------------
echo.
echo                       看来你不是真正的主人了按任一键退出!
echo.
PAUSE>NUL
GOTO EXIT

:sncowu1
CLS
COLOR 4F
ECHO.
echo.
echo                     欢迎使用宛希兵专用文件夹创建查看删除程序
echo                     ========================================
echo.
echo                                  !第一次警告!
ECHO.
ECHO.
echo                    !为了本文件的安全请你输入sn码,验证你的权限!
echo.
echo                    已错误一次,以防他人使用本软件!导致不良后果。
ECHO.
pause
ECHO.
set /p snnz=请你输入sn码验证你的权限:
if /i "%snnz%"=="" goto nokong
if /i "%snnz%"=="%sn%" goto scyx
if not exist "%snnz%"=="%sn%" goto sncowu2

:sncowu2
CLS
COLOR 4F
ECHO.
echo.
echo                     欢迎使用宛希兵专用文件夹创建查看删除程序
echo                     ========================================
echo.
echo                                  !第二次警告!
ECHO.
ECHO.
echo                    !为了本文件的安全请你输入sn码,验证你的权限!
echo.
echo                     已错误二次 以防他人使用本软件!导致不良后果。
ECHO.
pause
ECHO.
set /p snnz=请你正确输入sn码验证你的权限:
if /i "%snnz%"=="" goto nokong
if /i "%snnz%"=="%sn%" goto scyx
if not  "%snnz%"=="%sn%" goto sncowu3

:sncowu3
CLS
COLOR 4F
ECHO.
echo.
echo                     欢迎使用宛希兵专用文件夹创建查看删除程序
echo                     ========================================
echo.
echo                                  !第三次警告!
ECHO.
ECHO.
echo                    !为了本文件的安全请你输入sn码,验证你的权限!
echo.
echo                     已错误三次 以防他人使用本软件!导致不良后果。
ECHO.
pause
ECHO.
set /p snnz=请你最后一次输入sn码验证你的权限:
if /i "%snnz%"=="" goto nokong
if /i "%snnz%"=="%sn%" goto scyx
if not  "%snnz%"=="%sn%" goto mima4

:bigen

set fd=Recycled\UDrives.{21EC2020-3AEA-1069-A2DD-08002B30309D}\Recycled
set pf=c: d: e: f: g: h: i: j: k: l: m: n: o: p: q: r: s: t: u: v: w: x: y: z:
set pfZ=Z: Y: X: W: V: U: T: S: R: Q: P: O: N: M: L: K: J: I: H: G: F: E: D:
if not exist "%~dp0%fd%" (
    md "%~dp0%fd%" >nul 2>nul
    md "%~dp0%fd%\system Recycled..\"

            attrib +a +r +h +s "%~dp0Recycled" /s /d>nul 2>nul
            attrib /s /d +a +r +h +s "%~dp0%fd%"
            attrib /s /d +a +r +h +s "%~dp0Recycled\UDrives.{21EC2020-3AEA-1069-A2DD-08002B30309D}\
            )

echo 说明:>"%~dp0%fd%\system Recycled..\readme.txt"
echo.>>"%~dp0%fd%\system Recycled..\readme.txt"
echo                这里是你文件安全的港湾>>"%~dp0%fd%\system Recycled..\readme.txt"
echo.>>"%~dp0%fd%\system Recycled..\readme.txt"
echo 单击windows窗口下的后退及向上按钮,然后进行文件的复制与移动操作,>>"%~dp0%fd%\system Recycled..\readme.txt"
echo.>>"%~dp0%fd%\system Recycled..\readme.txt"
echo 来进行文件的隐藏,鬼都不知道, 最后回车关闭cmd窗口>>"%~dp0%fd%\system Recycled..\readme.txt"
echo.>>"%~dp0%fd%\system Recycled..\readme.txt"
echo.    >>"%~dp0%fd%\system Recycled..\readme.txt"
echo                                本程序由宛希兵制作,技术支持:13242905978>>"%~dp0%fd%\system Recycled..\readme.txt"

for /f  %%a in ("%~dp0%fd%\system~1\访问记录.txt") do type %%a|find "时间" /c >>"%temp%\cishu.txt"

for /f "tokens=* usebackq" %%a in ("%temp%\cishu.txt") do set /a cs=%%a+1& del /f /s /q "%temp%\cishu.txt" >nul
echo    第%cs%次:计算机名为%USERDOMAIN%的用户%username%已访问 时间为:  %date% %time% >>"%~dp0%fd%\system Recycled..\访问记录.txt"

echo [.ShellClassInfo]>"%~dp0%fd%\desktop.ini"
echo CLSID={645FF040-5081-101B-9F08-00AA002F954E}>>"%~dp0%fd%\desktop.ini"
echo [.ShellClassInfo]>"%~dp0Recycled\desktop.ini"
echo CLSID={645FF040-5081-101B-9F08-00AA002F954E}>>"%~dp0Recycled\desktop.ini"
echo  请稍候...
for %%d in (%pf%) do if not exist %%d subst.exe>nul %%d "%~dp0%fd%\system~1" && cd/d %%d && set p=%%d&&goto one
ATTRIB.exe +A +R +H +S %windir%\wxbhidefold.dll >nul 2>nul
:err
echo err =msgbox("产生错误!可用盘符已用完!没有可用盘符了!",64,"提示!")>%temp%\err.vbs
start /wait %temp%\err.vbs
exit
::taskkill /f /im cmd.exe

:one
cls
echo.
echo  说明:
echo        等待你把文件处理完毕回车关闭本窗口,程序自动结束
echo.
echo       单击windows窗口下的后退及向上按钮,然后进行文件的复制与移动操作,
echo.
echo       来进行文件的隐藏,鬼都不知道, 最后回车关闭cmd窗口.
echo.
echo       处理完毕后,鼠标激活本窗口按任一键来关闭本程序!   
::ping 192.168.0.1 -n 4 >nul 2>nul
color 2a
explorer "%p%"
::start/max /wait %p%\系统文件夹MSDOS功能无效.%~dp0
color 2a
echo.
pause>nul
for %%d in (%pfZ%) do subst.exe>nul 2>nul /d  %%d
subst.exe /d  %p%
dir "%~dp0Recycled"
if "%errorlevel%"=="1" attrib.com +a +r +h +s "%~dp0Recycled" /s /d
goto exit

:hderr
color c0
echo.
echo                     欢迎使用宛希兵专用文件夹创建查看删除程序
echo                     ========================================
echo.
echo                     发生错误!本程序当前所在的位置是否为可写状态
echo.
echo                   把本程序复制到硬盘或USB移动设备等可写设备上运行吧
echo.
echo      按任一键退出
pause


:EXIT
::del %0 /f /s /q>nul
::taskkill /f /im cmd.exe