一个暴力破解词典生成器,通过函数的递归完成字符的枚举,但资源占用率太大了,请问更如何修改,我是残疾人,请各位高手不要笑话我

iity2008 2009-12-19 08:03:05
我编写了一个暴力破解词典生成器,通过函数的递归完成字符的枚举,但资源占用率太大了,请问更如何修改,我是残疾人,没有上过学,请各位高手不要笑话我,
Form1.frm代码如下
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "破解词典生成器 V1.0"
ClientHeight = 4980
ClientLeft = 45
ClientTop = 435
ClientWidth = 9525
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4980
ScaleWidth = 9525
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command4
Caption = "清空所有列表"
Height = 495
Left = 6480
TabIndex = 17
Top = 4320
Width = 1335
End
Begin VB.Frame Frame2
Caption = "字段:"
Height = 2295
Left = 6360
TabIndex = 12
Top = 240
Width = 3015
Begin VB.ListBox List1
Height = 1860
ItemData = "Form1.frx":0000
Left = 120
List = "Form1.frx":0002
TabIndex = 13
Top = 240
Width = 2775
End
End
Begin VB.ListBox List2
Height = 1320
ItemData = "Form1.frx":0004
Left = 240
List = "Form1.frx":0006
TabIndex = 11
Top = 2880
Width = 9015
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 4440
Top = 4320
_ExtentX = 847
_ExtentY = 847
_Version = 393216
DialogTitle = "保存文件"
End
Begin VB.CommandButton Command5
Caption = "退出"
Height = 495
Left = 7920
TabIndex = 6
Top = 4320
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "生成"
Height = 495
Left = 5160
TabIndex = 5
Top = 4320
Width = 1215
End
Begin VB.Frame Frame1
Caption = "文字信息"
Height = 2295
Left = 240
TabIndex = 0
Top = 240
Width = 5895
Begin VB.TextBox Text2
Height = 270
Left = 1440
Locked = -1 'True
TabIndex = 15
Text = "1"
Top = 1560
Width = 615
End
Begin MSComCtl2.UpDown UpDown1
Height = 270
Left = 2040
TabIndex = 14
Top = 1560
Width = 255
_ExtentX = 450
_ExtentY = 476
_Version = 393216
Enabled = -1 'True
End
Begin VB.OptionButton Option1
Caption = "其它:"
Height = 375
Index = 3
Left = 360
TabIndex = 10
Top = 840
Width = 975
End
Begin VB.OptionButton Option1
Caption = "0 ~ 9"
Height = 375
Index = 2
Left = 2760
TabIndex = 9
Top = 360
Width = 1215
End
Begin VB.OptionButton Option1
Caption = "A ~ Z"
Height = 375
Index = 1
Left = 1560
TabIndex = 8
Top = 360
Width = 1215
End
Begin VB.OptionButton Option1
Caption = "a ~ z"
Height = 375
Index = 0
Left = 360
TabIndex = 7
Top = 360
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 495
Left = 4320
TabIndex = 4
Top = 1560
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 495
Left = 2880
TabIndex = 3
Top = 1560
Width = 1215
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000012&
Height = 315
Left = 1440
TabIndex = 1
Text = "每个字符用半角逗号隔开"
Top = 840
Width = 3975
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "字段行数:"
Height = 225
Left = 480
TabIndex = 16
Top = 1590
Width = 900
End
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "词典列表:"
Height = 180
Left = 240
TabIndex = 2
Top = 2640
Width = 900
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
...全文
584 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
iity2008 2009-12-31
  • 打赏
  • 举报
回复
谢谢各位了,我很笨,又没有受过正规教育,汇编学不会,c++都学个半瓶子
liguicd 2009-12-22
  • 打赏
  • 举报
回复
想要生得快,又不占CPU,那建议你去整个汇编的。高级语言在执行一项操作时,往往会来来回回反复执行一些与你的目标没有直接关系的过程,使用汇编直接地生成字典会比高级语言快一大截。
fzx4936 2009-12-22
  • 打赏
  • 举报
回复
中文密码不知道能不能爆破出来
嗷嗷叫的老马 2009-12-21
  • 打赏
  • 举报
回复
CPU占用大的问题,那没办法,这个时候就是需要CPU大量运算的时候.

不过话说回来,内容只是数字,字母,则应该可以使用直接填充内存的方式提高效率....

因为它们的ASCII码都在255以内.

比如:

type mystr
byteASC() as byte
end type

dim arrPWD(10000) as mystr

这样的话直接对这结构中的数值进行操作,完成后使用copymemory进行填充,应该会比直接字符串操作要好些吧.....
dingyanwei 2009-12-20
  • 打赏
  • 举报
回复
没研究过,支持一下。
用户 昵称 2009-12-20
  • 打赏
  • 举报
回复
说mm的话俺就不看了。
linc_M 2009-12-20
  • 打赏
  • 举报
回复
呵呵
波导终结者 2009-12-20
  • 打赏
  • 举报
回复
你应该说自己是MM效果才会好
iity2008 2009-12-19
  • 打赏
  • 举报
回复
CStrRecursion过程通过Command3_Click过程调用
iity2008 2009-12-19
  • 打赏
  • 举报
回复
Public f As TextStream

Private Sub Command1_Click()
For i = 1 To CInt(Text2.Text)
If Option1(0).Value = True Then
List1.AddItem Option1(0).Caption
ElseIf Option1(1).Value = True Then
List1.AddItem Option1(1).Caption
ElseIf Option1(2).Value = True Then
List1.AddItem Option1(2).Caption
Else
If Text1.Text = "" Then Exit Sub
List1.AddItem Text1.Text
End If
Next
If CInt(Text2.Text) <> 1 Then Text2.Text = 1
If Command3.Enabled = False Then Command3.Enabled = True
If Command2.Enabled = False Then Command2.Enabled = True
End Sub

Private Sub Command2_Click()
For i = List1.ListCount - 1 To 0 Step -1
'ListCount返回列表框中的项目总数
'ListCount-1是列表框中最后一个项目的索引号

'判断该项目是否被选中,Selected()返回布尔值
If List1.Selected(i) Then
'删除索引号为i的项目
List1.RemoveItem i

End If
Next
If List1.ListCount = 0 Then
Command3.Enabled = False
Command2.Enabled = False
End If

End Sub

Private Sub Command3_Click()
CommonDialog1.Filter = "Dictionary(*.DIC)|*.DIC|Text(*.TXT)|*.TXT|所有文件|*.*"
CommonDialog1.ShowSave
If CommonDialog1.FileName = "" Then Exit Sub
List2.Clear
Command1.Enabled = False
Command2.Enabled = False
Dim fso As New FileSystemObject
Set f = fso.OpenTextFile(CommonDialog1.FileName, 2, True)
Set fso = Nothing
Dim CStrArray() As String
ReDim CStrArray(List1.ListCount - 1)
Call CStrRecursion(CStrArray(), 0)
f.Close
Set f = Nothing
CommonDialog1.FileName = ""
Command1.Enabled = True
Command2.Enabled = True
End Sub



Private Sub Command5_Click()
End
End Sub

Private Sub Command4_Click()
List1.Clear
List2.Clear
Command3.Enabled = False
End Sub

Private Sub Form_Load()
Command3.Enabled = False
Command2.Enabled = False
Text1.Enabled = False
Text1.BackColor = &H8000000B
Option1(0).Value = True
GOStop = False
End Sub


Private Sub Option1_Click(Index As Integer)
If Option1(3).Value = True Then
Text1.Text = ""
Text1.Enabled = True
Text1.BackColor = &H80000005
Else
Text1.Enabled = False
Text1.BackColor = &H8000000B
End If
End Sub

Sub CStrRecursion(ByRef CSA() As String, ByVal Coordinate)
Select Case List1.List(Coordinate)
Case "a ~ z"
strChar = 97
Case "A ~ Z"
strChar = 65
Case "0 ~ 9"
strChar = 48
Case Else
Dim a() As String, tempStr As String, CCStr As String, n As String
ReDim a(0)
n = 0
For i = 1 To Len(Text1.Text)
tempStr = Mid(List1.List(Coordinate), i, 1)

If tempStr <> "," Then
CCStr = CCStr + tempStr
Else
ReDim Preserve a(UBound(a) + 1)
a(n) = CCStr
CCStr = ""
n = n + 1
End If

Next i
strChar = 0
a(n) = CCStr

tempStr = ""
CCStr = ""
n = ""

End Select

While List1.List(Coordinate + 1) <> ""

Select Case List1.List(Coordinate)
Case "a ~ z"
If strChar > 122 Then Exit Sub
Case "A ~ Z"
If strChar > 90 Then Exit Sub
Case "0 ~ 9"
If strChar > 57 Then Exit Sub
Case Else
If strChar > UBound(a) Then Exit Sub
End Select

If List1.List(Coordinate) = "a ~ z" Or List1.List(Coordinate) = "A ~ Z" Or List1.List(Coordinate) = "0 ~ 9" Then
CSA(Coordinate) = Chr(strChar)
Else
CSA(Coordinate) = a(strChar)
End If

Call CStrRecursion(CSA(), Coordinate + 1)

strChar = strChar + 1
Wend

Select Case List1.List(Coordinate)
Case "a ~ z"
strMAX = 122
Case "A ~ Z"
strMAX = 90
Case "0 ~ 9"
strMAX = 57
Case Else
strMAX = UBound(a)
End Select

Dim strLists As String
strLists = ""
For i = strChar To strMAX

If List1.List(Coordinate) = "a ~ z" Or List1.List(Coordinate) = "A ~ Z" Or List1.List(Coordinate) = "0 ~ 9" Then
CSA(Coordinate) = Chr(i)
Else
CSA(Coordinate) = a(i)
End If
For j = 0 To UBound(CSA)

f.Write CSA(j)
strLists = strLists + CSA(j)
Next j
f.Write Chr(13) + Chr(10)
List2.AddItem strLists
strLists = ""
Next i

End Sub



Private Sub UpDown1_DownClick()
If CInt(Text2.Text) > 1 Then Text2.Text = CInt(Text2.Text) - 1
End Sub

Private Sub UpDown1_UpClick()
If CInt(Text2.Text) < 255 Then Text2.Text = CInt(Text2.Text) + 1
End Sub

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧