home *** CD-ROM | disk | FTP | other *** search
/ For Beginners & Professional Hackers / cd.iso / hackers / tools / addsecur.arj / CODE.ASM < prev    next >
Encoding:
Assembly Source File  |  1992-08-13  |  2.8 KB  |  177 lines

  1. ;**************************************************
  2. ; Procedure for coding password for NetWare
  3. ;**************************************************
  4.  
  5.     assume    cs:code,ds:code
  6.  
  7. code    segment word public 'CODE'
  8.  
  9. tabl1    db    72,147,70,103,152,61,230,141,183,16,122,38,90,185,177,53,107
  10.     db    15,213,112,174,251,173,17,244,71,220,167,236,207,80,192
  11.  
  12. tabl2    db    7,8,0,8,6,4,14,4,5,12,1,7,11,15,10,8,15,8,12,12,9,4,1,14
  13.     db    4,6,2,4,0,10,11,9,2,15,11,1,13,2,1,9,5,14,7,0,0,2,6,6,0
  14.     db    7,3,8,2,9,3,15,7,15,12,15,6,4,10,0,2,3,10,11,13,8,3,10,1
  15.     db    7,12,15,1,8,9,13,9,1,9,4,14,4,12,5,5,12,8,11,2,3,9,14,7
  16.     db    7,6,9,14,15,12,8,13,1,10,6,14,13,0,7,7,10,0,1,15,5,4,11
  17.     db    7,11,14,12,9,5,13,1,11,13,1,3,5,13,14,6,3,0,11,11,15,3
  18.     db    6,4,9,13,10,3,1,4,9,4,8,3,11,14,5,0,5,2,12,11,13,5,13,5
  19.     db    13,2,13,9,10,12,10,0,11,3,5,3,6,9,5,1,14,14,0,14,8,2,13
  20.     db    2,2,0,4,15,8,5,9,6,8,6,11,10,11,15,0,7,2,8,12,7,3,10,1
  21.     db    4,2,5,15,7,10,12,14,5,9,3,14,7,1,2,14,1,15,4,10,6,12,6
  22.     db    15,4,3,0,12,0,3,6,15,8,7,11,2,13,12,6,10,10,8,13
  23.  
  24.    ;
  25.    ;    static void Pack_32to16(char buff[],char *forc)
  26.    ;
  27. Pack_32to16    proc    near
  28.                     ; di -> forc
  29.     xor    al,al
  30.     mov    cx,2
  31. @@99:
  32.     xor    bx,bx
  33. @@100:
  34.     push    cx
  35.     xor    ah,ah
  36.     mov    si,ax
  37.     add    si,bx
  38.     and    si,01Fh
  39.     mov    dl,buff[si]
  40.     sub    dl,tabl1[bx]
  41.     mov    cl,buff[bx]
  42.     add    cx,ax
  43.     xor    cx,dx
  44.     add    ax,cx
  45.     mov    buff[bx],cl
  46.     pop    cx
  47.     inc    bx
  48.     cmp    bx,32
  49.     jl    @@100
  50.     loop    @@99
  51.  
  52.     push    di
  53.     mov    cx,8
  54.     xor    ax,ax
  55.     rep    stosw
  56.     pop    di
  57.  
  58.     xor    si,si
  59. @@101:
  60.     mov    al,buff[si]
  61.     xor    ah,ah
  62.     mov    bx,ax
  63.     mov    al,tabl2[bx]
  64.     mov    bx,si
  65.     shr    bx,1
  66.     jnc    @@102
  67.     mov    cl,4
  68.     shl    ax,cl
  69. @@102:
  70.     or    [di+bx],al
  71.     inc    si
  72.     cmp    si,32
  73.     jl    @@101
  74.     ret
  75. Pack_32to16    endp
  76.  
  77.    ;    void CodePassword(long ID,char *password, int len, char *forcode)
  78.  
  79.     public    CodePassword
  80. CodePassword    proc    near
  81.                 ; si -> password
  82.                 ; cx - len
  83.                 ; di -> forcode
  84.     push    di
  85.     push    si
  86.     mov    si,offset ask
  87.     mov    di,offset reply
  88.     mov    ah,0E3h
  89.     int    21h
  90.     pop    si
  91.  
  92.     mov    di,si
  93.     add    si,cx
  94.     dec    si
  95.     std
  96. @@1:
  97.     lodsb
  98.     or    al,al
  99.     jne    @@2
  100.     loop    @@1
  101. @@2:
  102.     push    di
  103.     mov    di,offset buff
  104.     push    cx
  105.     mov    cx,16
  106.     xor    ax,ax
  107.     cld
  108.     rep    stosw
  109.     pop    cx
  110.     pop    di
  111. @@3:
  112.     cmp    cx,32
  113.     jbe    @@5
  114.     push    cx
  115.     mov    cx,32
  116.     mov    bx,offset buff
  117.     mov    si,di
  118. @@4:
  119.     lodsb
  120.     xor    [bx],al
  121.     inc    bx
  122.     loop    @@4
  123.     pop    cx
  124.     mov    di,si
  125.     sub    cx,32
  126.     jmp    @@3
  127. @@5:
  128.     or    cx,cx
  129.     jle    short @@9
  130.     cld
  131.     xor    bx,bx
  132.     mov    si,di
  133. @@6:
  134.     push    di
  135.     add    di,cx
  136.     cmp    si,di
  137.     pop    di
  138.     jne     @@7
  139.     mov    si,di
  140.     mov    al,tabl1[bx]
  141.     xor    buff[bx],al
  142.     jmp    short @@8
  143. @@7:
  144.     lodsb
  145.     xor    buff[bx],al
  146. @@8:
  147.     inc    bx
  148.     cmp    bx,32
  149.     jl    @@6
  150. @@9:
  151.     xor    bx,bx
  152. @@10:
  153.     push    bx
  154.     and    bx,3
  155.     mov    al,ID[bx]
  156.     pop    bx
  157.     xor    buff[bx],al
  158.     inc    bx
  159.     cmp    bx,32
  160.     jl    @@10
  161.     pop    di
  162.     call    Pack_32to16
  163.     ret
  164. CodePassword    endp
  165. ask    dw      11
  166.     db    35h
  167.     db    0,1
  168.     db    7
  169.     db    'NEWUSER'
  170.  
  171. reply    dw    54
  172. ID    db    0,0,0,0
  173. buff    db    50 dup(0)
  174.  
  175. code    ends
  176.     end     
  177.