2012年7月4日星期三

PASSWORD.ASM


;小玩意,不成敬意,不要笑话
;若用dos的8号功能,可用ctrl+c来破解;
;若设置成能输入很长的密码,可能会发生溢出,导致程序自动终止。
stack segment
      cache db 10 dup ('?')
stack ends
code segment
     assume cs:code,ds:code,es:code,ss:stack
            message db 'Made by correy',24h
            email db 0dh,0ah,'Email:leguanyuan@126.com',24h
           notice db 0dh,0ah,'input password:',24h
           password db 'correy999'
     main proc
          mov ax, code
          mov ds, ax
          mov es, ax
          mov ax,stack
          mov ss,ax
          mov dx, offset message
          mov ah, 09
          int 21h
          mov dx, offset email
          mov ah, 09
          int 21h
    start:mov dx, offset notice
          mov ah, 09
          int 21h
          mov cx, 9
          mov bx,offset cache
     show:mov ah, 00
          int 16h
          cmp al, 0Dh
          je comp
        mov [bx],al
        inc bx
          mov dl, 2Ah
          mov ah, 02
          int 21h
          loop show
     comp:mov cx, 9
          mov si, offset password
          mov di, offset cache
          repz cmpsb
          jne start
          mov ah, 4Ch
          int 21h
    main endp
code ends
end main      
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;这个程序不完善,有待修改,请朋友指点
stack segment
      cache db 10 dup ('?')
stack ends
code segment
     assume cs:code,ds:code,es:code,ss:stack
          message db 'Made by correy',0
          email db 'Email:leguanyuan@126.com',0
          continue db 'press c to continue!',0
         notice db 'input password:',0
         password db 'correy999'
     main proc
          mov ax,code
          mov ds,ax
          mov ax,stack
          mov es,ax
          mov ss,ax
         
   again0: mov ax,600h    ;clear screen        
          mov bh,7h
          mov cx,0
          mov dx,184fh
          int 10h
          mov dl,0h
          mov si,offset message
    show0: mov ah,2           ;set cursor
          mov dh,0
          mov bh,0
          int 10h
          mov al,[si]
          cmp al,0         
          jz next0           
          mov ah,9
          mov cx,1
          mov bh,0
          mov bl,7h
          int 10h
          inc dl
          inc si           
          jmp show0
         
    next0:mov ah,0eh
          mov al,0dh
          int 10h
          mov al,0ah
          int 10h
         
          mov dl,0h
          mov si,offset email
    show1: mov ah,2           ;set cursor
          mov dh,1
          mov bh,0
          int 10h
          mov al,[si]
          cmp al,0         
          jz next1           
          mov ah,9
          mov cx,1
          mov bh,0
          mov bl,7h
          int 10h
          inc dl
          inc si           
          jmp show1
         
    next1:mov ah,0eh
          mov al,0dh
          int 10h
          mov al,0ah
          int 10h
         
          mov dl,0h
          mov si,offset continue
    show2: mov ah,2           ;set cursor
          mov dh,2
          mov bh,0
          int 10h
          mov al,[si]
          cmp al,0         
          jz next2           
          mov ah,9
          mov cx,1
          mov bh,0
          mov bl,7h
          int 10h
          inc dl
          inc si           
          jmp show2
         
    next2:mov ah,0eh
          mov al,0dh
          int 10h
          mov al,0ah
          int 10h
         
          mov ah,0
   inputc:int 16h  
          cmp al,99
          jnz inputc  
  
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;         
   again: mov ax,600h    ;clear screen        
          mov bh,7h
          mov cx,0
          mov dx,184fh
          int 10h
          mov dl,0h
          mov si,offset notice
    show: mov ah,2           ;set cursor
          mov dh,0
          mov bh,0
          int 10h
          mov al,[si]
          cmp al,0         
          jz input           
          mov ah,9
          mov cx,1
          mov bh,0
          mov bl,7h
          int 10h
          inc dl
          inc si           
          jmp show        
         
          mov cx, 9
          mov bx,offset cache
     input:mov ah, 00
          int 16h
          cmp al,0Dh
          jz compare
          push ax
          mov ah,3 ;read cursor
          mov bh,0
          int 10h
          mov ah,2 ;set cursor
          int 10h
          pop ax
        mov [bx],al
        inc bx
        mov ah,0eh ;show *
        mov al,2ah
        int 10h
        loop input
       
compare:mov cx, 9   ;i feeling this have mistake
          mov si, offset password
          mov di, offset cache
          repz cmpsb
          jnz again
          ret
    main endp
code ends
end main      
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;made by correy
;made in 2009.04.01
;Email:leguanyuan@126.com
;QQ:112426112
;rc me.rc
;ml /coff test.asm /link /subsystem:windows me.res
.386
.model flat,stdcall
option casemap:none
include windows.inc
include kernel32.inc
include user32.inc
includelib user32.lib
includelib kernel32.lib
.data
mebmp db "mebmp",0
szClassName db "made by correy",0
correy db "correy",0
menocorrey db "meno_correy",0
szButton db "button",0
szButtonText db "登陆",0
SZEDIT DB "eDIT",0
SZsTATIC DB "Static",0
username DB "username:",0
password DB "password:",0
input db "你输入了:",0
passwords db "correy999",0
okit db "ok",0
errormessage db "errer it",0
zeroo db "00000000",0
.data?
hInstance dd ?
hMenu dd ?
stWndClass WNDCLASSEX <>
stMsg MSG <>
hwndEdit HWND ?
buffer db 512 dup(?)
.const
me equ 07777h
.code
liuchunli proc hWnd,uMsg,wParam,lParam
   LOCAL ps:PAINTSTRUCT
   LOCAL hdc:HDC
   LOCAL hMemDC:HDC
   LOCAL rect:RECT
   mov eax,uMsg
   .if eax == WM_CREATE
    invoke LoadIcon,hInstance,me
    invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax
  
    invoke CreateWindowEx,NULL,offset SZsTATIC,offset username,\
    WS_CHILD or WS_VISIBLE,0,0,72,20,\
    hWnd,1,hInstance,NULL
  
    invoke CreateWindowEx,NULL,offset SZEDIT,offset correy,\
    ES_LEFT or WS_CHILD or WS_BORDER or WS_TABSTOP or WS_VISIBLE,\
    72,0,72,20,hWnd,2,hInstance,NULL
  
    invoke CreateWindowEx,NULL,offset SZsTATIC,offset password,\
    WS_CHILD or WS_VISIBLE,0,20,72,20,\
    hWnd,3,hInstance,NULL
  
    invoke CreateWindowEx,NULL,offset SZEDIT,0,\
    ES_LEFT or WS_CHILD or WS_BORDER or WS_TABSTOP or WS_VISIBLE or ES_PASSWORD,\
    72,20,72,20,hWnd,4,hInstance,NULL
    mov hwndEdit,eax  
  
    invoke CreateWindowEx,NULL,offset szButton,offset szButtonText,\
    WS_CHILD or WS_VISIBLE,0,40,36,18,hWnd,5,hInstance,NULL
     
    ret
  
    .ELSEIF uMsg==WM_COMMAND
        mov eax,wParam
        .IF ax==5
                invoke GetWindowText,hwndEdit,ADDR buffer,512
                mov esi,offset passwords
                mov edi,offset buffer
                mov ecx,9
                cld
                repe cmpsb
                jne show
                invoke ShowWindow,hInstance,0
                invoke MessageBox,0,addr okit,addr correy,0
                invoke DestroyWindow,hWnd
                show:
                invoke SetWindowText,hwndEdit,0
                invoke MessageBox,0,addr errormessage,addr correy,0
               
                
        .ENDIF
  
  
  
   .elseif uMsg==WM_DESTROY                          
      invoke PostQuitMessage,NULL
      ret
   .else
    invoke DefWindowProc,hWnd,uMsg,wParam,lParam
    ret
   .endif
   xor eax,eax
   ret
liuchunli endp
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke LoadMenu, 0, OFFSET menocorrey
mov hMenu,eax
push hInstance
pop stWndClass.hInstance
mov stWndClass.cbSize,sizeof WNDCLASSEX
mov stWndClass.hbrBackground,6
invoke LoadCursor,0,IDC_ARROW
mov stWndClass.hCursor,eax
;mov stWndClass.lpszMenuName,OFFSET menocorrey
mov stWndClass.lpszClassName,offset szClassName
mov stWndClass.lpfnWndProc,offset liuchunli
invoke RegisterClassEx,addr stWndClass
invoke CreateWindowEx,WS_EX_CLIENTEDGE,offset szClassName,offset szClassName,\
DS_SETFONT or WS_POPUP or WS_VISIBLE or WS_SYSMENU or WS_CAPTION,CW_USEDEFAULT,CW_USEDEFAULT,199,126,0,hMenu,hInstance,0
mov hInstance,eax
invoke ShowWindow,hInstance,1
invoke UpdateWindow,hInstance
.while TRUE
invoke GetMessage,addr stMsg,NULL,0,0
.break .if eax == 0
invoke TranslateMessage,addr stMsg
invoke DispatchMessage,addr stMsg
.endw
invoke ExitProcess,NULL
end start

没有评论:

发表评论