PB小助手 v3.1 PB简单算法逆运算
【破文标题】PB小助手 v3.1 PB简单算法逆运算
【软件名称】PB小助手 v3.1
【软件地址】http://pbfind.51.net
【破文作者】KiLlL[DFCG][FCG]
【破解时间】2005-10-01 11:01
【破解声明】国庆节快乐! 仅限技术交流!
【破解过程】
跟PB第一次接触以后,不小心发现另外一个PB的软件,顺手看看吧。本人是不会用PB的。
软件首先提示注册,有机器码,用户名,注册码三个参数,PBKiller(谢谢作者~)上。
在w_about.srw文件里面发现:
event clicked;
if f_decry(parent.sle_serialno.text,parent.sle_userno.text) = parent.sle_macno.text then
messagebox("恭喜","注册成功!")
gb_register = true
registryset("HKEY_LOCAL_MACHINE\Software\findit!","userno",regstring!,parent.sle_userno.text)
registryset("HKEY_LOCAL_MACHINE\Software\findit!","serial",regstring!,parent.sle_serialno.text)
gs_userno = parent.sle_userno.text
gs_serialno = parent.sle_serialno.text
parent.sle_userno.displayonly = true
parent.sle_userno.backcolor = rgb(192,192,192)
parent.sle_serialno.displayonly = true
parent.sle_serialno.backcolor = rgb(192,192,192)
visible = false
close(parent)
if isvalid(w_pbfind) then
w_pbfind.title = w_pbfind.tag + ver + "(已注册)"
end if
else
messagebox("对不起","您的用户名及注册码不正确!",stopsign!)
end if
这个应该很清楚了,就是如果f_decry(注册码,用户名) = 机器码的话,注册成功,否则注册失败。
去看看f_decry函数吧。
在f_decry.srf文件里面发现:
global function string f_decry (char as_src[],char as_key[]);char result[]
integer i
integer j
integer li_char
integer li_mod
if len(as_key) <= 0 or len(as_src) <= 0 then
return ""
end if
if len(as_key) < len(as_src) then
as_key = fill(as_key,len(as_src))
end if
for i = 1 to len(as_src)
j = (i * i) * i + i * i + i + 1
li_char = asc(as_src[i]) - 33 - mod(j + asc(as_key[i]),94)
if li_char < 0 then
li_char = li_char + 94
end if
if li_char < 33 then
li_char = li_char + 94
end if
result[i] = char(li_char)
next
return result
end function
这个函数应该比较简单,但是用到了另外一个函数就是fill,搜索一下:
Fill()
功能建立一个由指定字符串填充的指定长度的字符串。
语法Fill ( chars, n )
参数chars:string类型,指定用于重复填充的字符串n:long类型,指定由该函数返回的字符串的长度返回值String。函数执行成功时返回n个 字符的字符串,该字符串以参数chars中的字符串重复填充而成。如果参数chars中的字符个数多于n个,那么使用chars字符串的前n个字符填充 函数返回的字符串;如果参数chars中的字符个数少于n个,那么使用chars字符串反复填充,直到返回的字符串长度达到n为止。如果任何参数 的值为NULL,Fill()函数返回NULL。
明白了,就是补足。
下面的任务就是写注册机了。算法很清楚,首先根据机器码,补足用户名,然后把f_decry逆一下,如下:
Function f_encry(as_src As String, as_key As String) As String
Dim i As Integer
Dim j As Integer
Dim li_char As Integer
Dim li_mod As Integer
Dim Result As String
If Len(as_key) <= 0 Or Len(as_src) <= 0 Then
f_encry = ""
End If
If Len(as_key) < Len(as_src) Then
as_key = KiLlL_PB_Fill(as_key, Len(as_src))
End If
For i = 1 To Len(as_src)
li_char = Asc(Mid$(as_src, i, 1))
If li_char >= 33 Then
li_char = li_char - 94
End If
If li_char >= 0 Then
li_char = li_char - 94
End If
j = (i * i) * i + i * i + i + 1
li_char = li_char + 33 + KiLlL_PB_Mod(j + Asc(Mid$(as_key, i, 1)), 94)
If li_char < 0 Then
li_char = li_char + 94
End If
If li_char < 33 Then
li_char = li_char + 94
End If
Result = Result & Chr$(li_char)
Next
f_encry = Result
End Function
注意这个地方跟原来的pb代码相比做了如下改动:
1.写了自己的fill函数:
Public Function KiLlL_PB_Fill(a As String, b As Integer) As String
KiLlL_PB_Fill = a
Do While (Len(KiLlL_PB_Fill) < b)
KiLlL_PB_Fill = KiLlL_PB_Fill & a
Loop
KiLlL_PB_Fill = Left$(KiLlL_PB_Fill, b)
End Function
2.mod函数自己写了,很简单。
3.为了方便,把数组改成了字符串。
4.在运算后再一次对ascii进行判断
If li_char < 0 Then
li_char = li_char + 94
End If
If li_char < 33 Then
li_char = li_char + 94
End If
那就顺便看看机器码是什么吧,还是这个文件:
lnvo_diskinfo = create nvo_diskinfo
lstr_volume = lnvo_diskinfo.of_getvolumeinfo("c:\")
ls_serialnum = string(lstr_volume.serialnum)
sle_macno.text = ls_serialnum
原来是硬盘的序列号,用vb写出自己计算机器码的函数要稍微转一下,因为vb的获得的磁盘序列号容易变成负数,需要先转成hex,在用函数变 成十进制。
机器码=Hex2Dec(hex(GetSerialNumber("c:\")))
'十六进制到十进制,支持超级大数
Public Function Hex2Dec(InputData As String) As Double
Dim i As Integer
Dim DecOut As Double
Dim Lenhex As Integer
Dim HexStep As Double
DecOut = 0
InputData = UCase$(InputData)
Lenhex = Len(InputData)
For i = 1 To Lenhex
If IsNumeric(Mid$(InputData, i, 1)) Then
GoTo NumOk
ElseIf Mid$(InputData, i, 1) = "A" Then
GoTo NumOk
ElseIf Mid$(InputData, i, 1) = "B" Then
GoTo NumOk
ElseIf Mid$(InputData, i, 1) = "C" Then
GoTo NumOk
ElseIf Mid$(InputData, i, 1) = "D" Then
GoTo NumOk
ElseIf Mid$(InputData, i, 1) = "E" Then
GoTo NumOk
ElseIf Mid$(InputData, i, 1) = "F" Then
GoTo NumOk
Else
MsgBox "Number given is not in Hex format", vbCritical
Exit Function
End If
NumOk:
Next i
HexStep = 0
For i = Lenhex To 1 Step -1
HexStep = HexStep * 16
If HexStep = 0 Then
HexStep = 1
End If
If Mid$(InputData, i, 1) = "0" Then
DecOut = DecOut + (0 * HexStep)
ElseIf Mid$(InputData, i, 1) = "1" Then
DecOut = DecOut + (1 * HexStep)
ElseIf Mid$(InputData, i, 1) = "2" Then
DecOut = DecOut + (2 * HexStep)
ElseIf Mid$(InputData, i, 1) = "3" Then
DecOut = DecOut + (3 * HexStep)
ElseIf Mid$(InputData, i, 1) = "4" Then
DecOut = DecOut + (4 * HexStep)
ElseIf Mid$(InputData, i, 1) = "5" Then
DecOut = DecOut + (5 * HexStep)
ElseIf Mid$(InputData, i, 1) = "6" Then
DecOut = DecOut + (6 * HexStep)
ElseIf Mid$(InputData, i, 1) = "7" Then
DecOut = DecOut + (7 * HexStep)
ElseIf Mid$(InputData, i, 1) = "8" Then
DecOut = DecOut + (8 * HexStep)
ElseIf Mid$(InputData, i, 1) = "9" Then
DecOut = DecOut + (9 * HexStep)
ElseIf Mid$(InputData, i, 1) = "A" Then
DecOut = DecOut + (10 * HexStep)
ElseIf Mid$(InputData, i, 1) = "B" Then
DecOut = DecOut + (11 * HexStep)
ElseIf Mid$(InputData, i, 1) = "C" Then
DecOut = DecOut + (12 * HexStep)
ElseIf Mid$(InputData, i, 1) = "D" Then
DecOut = DecOut + (13 * HexStep)
ElseIf Mid$(InputData, i, 1) = "E" Then
DecOut = DecOut + (14 * HexStep)
ElseIf Mid$(InputData, i, 1) = "F" Then
DecOut = DecOut + (15 * HexStep)
Else
MsgBox "Something is Screwed up, Wahhhhhhhhhhh", vbCritical
End If
Next i
Hex2Dec = DecOut
eds:
End Function
【破解心得】
我的算法理解能力比较差,只会用一点点VB,所以,这么小的一段程序还是看了半天,算是逆的第一个PB算法吧。