0

嗨,我的一个朋友让我恢复 1994 年用 Clipper 编写的程序的密码。我给自己弄了一个反编译器(Valkyrie 5)并反编译了 EXE 文件。我找到了一个名为 USERLOGIN 的过程。问题是我不知道如何在 Clipper 中编程。如果有人可以编辑该程序,我将非常感激,这样它就不会再要求身份验证了。

#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
4

1 回答 1

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
于 2012-08-23T22:34:57.290 回答