更改限幅器代码以绕过旧程序的身份验证

时间:2012-08-16 22:39:49

标签: authentication dos clipper

我的一位朋友要求我恢复1994年用剪辑器编写的程序的密码。我给自己一个反编译器(Valkyrie 5)并反编译了EXE文件。我找到了一个名为USERLOGIN的程序。问题是我不知道如何在限幅器中编程。如果有人可以编辑程序以便不再要求身份验证,我将非常感谢。

#include "common.ch"
#include "inkey.ch"

********************************
Function USERLOGON

   Local Local1:= -1, Local2:= .F., Local3, Local4, Local5:= 3, ;
      Local6:= 3, Local7:= 7, Local8:= 41, Local9, Local10, Local11, ;
      Local12, Local13, Local14, Local15
   Local3:= 1
   Local9:= {}
   Local13:= setcursor()
   If (!netuse(diskname() + ":" + dirname() + "\" + "sinusr.dbf", ;
         "users"))
      Return Local1
   EndIf
   dbSetFilter({ || users->valid })
   Local14:= box(Local5, Local6, Local7, Local8, Nil, ;
      coltonum("GR+/B"))
   Do While (!Local2)
      Local10:= Space(12)
      Local11:= Space(10)
      setcursor(1)
      If (!Empty(n_shellver()))
         Local10:= padr(nnetwhoami(), 12)
      EndIf
      wininfo(Local14, @Local5, @Local6, @Local7, @Local8)
      @ Local5 + 1, Local6 + 5 Say "User............." Color "GR+/B"
      SetPos(Row(), Col() + 1)
      AAdd(Local9, __Get({ |_1| IIf(ISNIL(_1), Local10, Local10:= ;
         _1) }, "cUName", "@K!", Nil, Nil):display())
      @ Local5 + 2, Local6 + 5 Say "Password........." Color "GR+/B"
      SetPos(Row(), Col() + 1)
      AAdd(Local9, __Get({ |_1| IIf(ISNIL(_1), Local11, Local11:= ;
         _1) }, "cUPass", "@K!", Nil, Nil):display())
      Local9[2]:reader({ |_1| gt_grpassw(_1) })
      wreadmodal(Local9, 0)
      Local11:= Local9[2]:cargo()
      Local9:= {}
      If (LastKey() == K_ESC .OR. !winisinuse(Local14))
         If (winisinuse(Local14))
            winclose(Local14)
         EndIf
         Return Local1
      EndIf
      Local10:= alltrim(Local10)
      Local12:= {}
      Locate For Local10 == alltrim(users->emri)
      Do While (Found())
         AAdd(Local12, users->id)
         Continue
      EndDo
      For Local4:= 1 To Len(Local12)
         If ((Local15:= upass(Local12[Local4])) != Nil)
            If (alltrim(Local11) == Local15)
               Local2:= .T.
               Exit
            EndIf
         EndIf
      Next
   EndDo
   If (users->id != Local12[Local4])
      users->(dbGoTop())
      Locate For Local12[Local4] == users->id
      If (!Found())
         msg("Fatal error in user's file !", 3)
         Return -1
      EndIf
   EndIf
   For Local4:= 1 To MaxCol()
      winchgpos(0, 3)
   Next
   boxc(Local14)
   setcursor(Local13)
   If (users->in)
      tone(500, 10)
      Local4:= al_box("User " + Trim(users->emri) + ;
         " is already IN;" + "Do You Want to Jump In ?", 2, ;
         {" Yes ", " No  "}, 2, "WARNING")
      If (Local4 == 1)
         msg("More than One User with the same Name might cause Trouble !", ;
            3)
      Else
         Close
         Return -1
      EndIf
   ElseIf (netrlock())
      Replace users->in With .T.
      Unlock
      dbcommit()
   Else
      Close
      Return -1
   EndIf
   Static148[1]:= users->id
   Static148[2]:= alltrim(users->emri)
   Static148[3]:= alltrim(users->dirpriv)
   Static148[4]:= users->gjuha1
   Static148[5]:= users->gjuha2
   Static148[6]:= alltrim(users->emriiplote)
   Local1:= Static148[1]
   Close
   Return Local1

* EOF

1 个答案:

答案 0 :(得分:0)

这是部分猜测,但这是我的解释:

从控制台将用户密码读入Local9[2]

@ Local5 + 2, Local6 + 5 Say "Password........." Color "GR+/B"
...
Local9[2]:reader({ |_1| gt_grpassw(_1) })
wreadmodal(Local9, 0)

将密码放入Local11

Local11:= Local9[2]:cargo()

通过Local12

将所有用户ID抓取到Local10
Locate For Local10 == alltrim(users->emri)
Do While (Found())
    AAdd(Local12, users->id)
    Continue
EndDo

将每个用户的密码设为Local15,如果密码的当前Local11中的密码匹配,请验证用户:

For Local4:= 1 To Len(Local12)
    If ((Local15:= upass(Local12[Local4])) != Nil)
        If (alltrim(Local11) == Local15)
            Local2:= .T.
            Exit
        EndIf
    EndIf
Next

修复

只需删除密码检查代码即可。不确定所有其余代码的目的,我建议不要管它。我保留了用户密码的检索,因为有可能没有登录没有密码的用户(也许这就是帐户被禁用的方式。上面的最后一个块可以改为:

For Local4:= 1 To Len(Local12)
    If ((Local15:= upass(Local12[Local4])) != Nil)
        Local2:= .T.
    EndIf
Next