📄 main.bas
字号:
Attribute VB_Name = "Main"
Option Explicit
Public strServer As String
Public nPort As Integer
Public nDisplayMode As Integer 'See frmServer
Public nPwdMode As Integer
Public strSubCharSet As String
Public nTmServer As Integer
Public strSubFeature As String 'Password feature
Public nFeatureLoc As Integer
Public lAttackTimes As Long
Public strStartTick As String
Public strStopTick As String
Public strStartTime As String
Public strStopTime As String
Public bAutoAttack As Boolean
Public Const MODE_CHAR = 0 'nDisplayMode
Public Const MODE_HEX = 1
'For email only.
Public Const UNCONNECT_STATE = 0
Public Const CONNECT_STATE = 1
Public Const USER_STATE = 2
Public Const PASS_STATE = 3
Public nUserDefine As Integer '1 for strSubCharSet, 2 for strSubFeature, 3 for both
Public Const cStrCharSet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
Public Const cStrNumSet = "0123456789"
Public nClass As Integer 'nClass=1 for Char, 2 for Num
Public Const C_ERROR = 0
Public Const C_CHAR = 1
Public Const C_NUM = 2
Public Const MODE_NORMAL = 0 'nPwdMode
Public Const MODE_DATE = 1
Public Const MODE_NODATE = 2
Public Const MODE_NO_LIMIT = 3
'*************************************************************************
Public bPlusCRLF As Boolean 'Plus Chr(13)+Chr(10)
Public ResultString As String 'Display in the MultiTextBox
Public strDataPath As String
Public Function CheckPassSetType(ByVal strSource As String) As Integer
Dim bResult As Boolean
bResult = CheckLegalChars(strSource, cStrCharSet)
If bResult Then
CheckPassSetType = C_CHAR
Exit Function
End If
bResult = CheckLegalChars(strSource, cStrNumSet)
If bResult Then
CheckPassSetType = C_NUM
Exit Function
End If
End Function
Public Function GenNextPwd(ByVal strPW As String) As String
Dim strTmp As String
Dim strTmpSet As String
Dim strTmpChar As String
Dim nLen As Integer
Dim I As Integer
strTmp = Trim(strPW)
nLen = Len(strTmp)
nClass = CheckPassSetType(strTmp)
If nClass = C_ERROR Then
GenNextPwd = String(nLen, "*")
Exit Function
End If
strTmpSet = IIf(nClass = C_NUM, cStrNumSet, cStrCharSet)
For I = nLen To 1 Step -1
strTmpChar = Mid(strTmp, I, 1)
strTmp = Mid(strTmp, 1, I - 1) + NextChar(strTmpSet, strTmpChar) + _
Mid(strTmp, I + 1)
If strTmpChar < NextChar(strTmpSet, strTmpChar) Then Exit For
Next I
GenNextPwd = strTmp
End Function
Public Function NextChar(ByVal strSource, ByVal strD) As String
'0123456789', give 3, get 4; give 9, get 0
Dim nLen As Integer
Dim nLocation As Integer
strSource = Trim(strSource)
strD = Trim(strD)
nLen = Len(strSource)
nLocation = InStr(1, strSource, strD)
If nLocation = 0 Then
NextChar = "*" 'For Error
Exit Function
End If
If nLocation = nLen Then
NextChar = Mid(strSource, 1, 1) 'Return to the head.
Else
NextChar = Mid(strSource, nLocation + 1, 1)
End If
End Function
Public Function PreviousChar(ByVal strSource, ByVal strD) As String
'0123456789', give 4, get 3; give 0, get 9
Dim nLen As Integer
Dim nLocation As Integer
strSource = Trim(strSource)
strD = Trim(strD)
nLen = Len(strSource)
nLocation = InStr(1, strSource, strD)
If nLocation = 0 Then
PreviousChar = "*" 'For Error
Exit Function
End If
If nLocation = 1 Then
PreviousChar = Mid(strSource, Len(strSource), 1) 'Return to the head.
Else
PreviousChar = Mid(strSource, nLocation - 1, 1)
End If
End Function
Public Function GenPrePwd(ByVal strPW As String) As String
Dim strTmp As String
Dim strTmpSet As String
Dim strTmpChar As String
Dim nLen As Integer
Dim I As Integer
strTmp = Trim(strPW)
nLen = Len(strTmp)
nClass = CheckPassSetType(strTmp)
If nClass = C_ERROR Then
GenPrePwd = String(nLen, "*")
Exit Function
End If
strTmpSet = IIf(nClass = C_NUM, cStrNumSet, cStrCharSet)
For I = nLen To 1 Step -1
strTmpChar = Mid(strTmp, I, 1)
strTmp = Mid(strTmp, 1, I - 1) + PreviousChar(strTmpSet, strTmpChar) + Mid(strTmp, I + 1)
If strTmpChar > PreviousChar(strTmpSet, strTmpChar) Then Exit For
Next I
GenPrePwd = strTmp
End Function
Public Function GenNextDate(ByVal strPW As String) As String
Dim strTmp As String
On Error GoTo EndMark
If Len(strPW) <> 6 Or CheckLegalChars(strPW, cStrNumSet) = False Then GoTo EndMark
strTmp = Mid(strPW, 1, 2) + "-" + Mid(strPW, 3, 2) + "-" + Mid(strPW, 5)
GenNextDate = Format(CDate(strTmp) + 1, "yymmdd")
Exit Function
EndMark:
GenNextDate = "*"
End Function
Public Function GenPreviousDate(ByVal strPW As String) As String
Dim strTmp As String
On Error GoTo EndMark
If Len(strPW) <> 6 Or CheckLegalChars(strPW, cStrNumSet) = False Then GoTo EndMark
strTmp = Mid(strPW, 1, 2) + "-" + Mid(strPW, 3, 2) + "-" + Mid(strPW, 5)
GenPreviousDate = Format(CDate(strTmp) - 1, "yymmdd")
Exit Function
EndMark:
GenPreviousDate = "*"
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -