vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Blitzschnelles Erstellen von grafischen Diagrammen!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

Fortgeschrittene Programmierung
portscanner ist zu lam 
Autor: daniel
Datum: 02.05.02 17:03

also ich habe mir vor kurzem einen portscanner gecoded,ganz simpel

nun möchte ich ihn schneller machen nur hab keien ahnug wie,hab ihr eine idee ???

dann wollte ich auch noch gerene eine anzeige einbauen die das vortschreiten des scanns anzeigt

wäre nett wenn mir da wer helfen könnte

ich poste einfach mal den code:

'variable that we'll be using
Dim Action As Integer
Dim StartIP As String, EndIP As String
Dim Seconds

Private Sub CmdAction_Click()
'if command button already clicked then action would
'equal 1
If Action = 1 Then
'change the command button to say start
CmdAction.Caption = "Start"
'close the winsock connection
wnsConnection.Close
'and reset the action variable to 0
Action = 0
Exit Sub
'else you are starting the scan and action equals 0
Else
'set the action variable to 1
Action = 1
'set the command button to say stop
CmdAction.Caption = "Stop"
'call the routine to scan the ports
Call ScanPorts
End If
End Sub

Private Sub Form_Load()
'initialize the action variable to 0
Action = 0
'set the command button to say start
CmdAction.Caption = "Start"
'we will lock the message box so that we dont write
'over the ip addresses accidently
txtMessage.Locked = True
End Sub

Private Sub ScanPorts()
'variables we'll use in this routine
Dim Start As Integer
'if we get an error that we dont like we'll just
'continue since we dont have any error handling
On Error Resume Next
'initialize the variables to 0
Start = 0
'concatenate the ip string to stop the scanner
EndIP = StopIP1 & "." & StopIP2 & "." & StopIP3 & "." & StopIP4
Do While Not StartIP = EndIP
If Action = 0 Then
Exit Do
End If
'concatenate the ip starting string
StartIP = Trim(StartIP1.Text) & "." & Trim(StartIP2.Text) & "." & Trim(StartIP3.Text) & "." & Trim(StartIP4.Text)
If Start = 0 Then
Open App.Path & "\" & "Scan.txt" For Append As #1
Write #1, "Scan started with "; StartIP
Close #1
End If
'close the winsock control
wnsConnection.Close
'connect to the ip and port
wnsConnection.Connect StartIP, txtPort
'a little loop to wait to see if the connection
'can be made
Seconds = 0
Do While Seconds = 0
DoEvents
Loop
'if the computers are connected...
If wnsConnection.State = 7 Then
txtMessage.Text = txtMessage.Text & StartIP & vbNewLine
'///////////////////////////////////////////////////
'this will open a file for output
Open App.Path & "\" & "Scan.txt" For Append As #1
'and will write the IP and the port number
'being scanned
Write #1, StartIP, txtPort.Text
'and close the file
Close #1
'///////////////////////////////////////////////////
End If

StartIP4.Text = StartIP4.Text + 1

If StartIP4.Text = "256" Then
StartIP4.Text = "1"
StartIP3.Text = StartIP3.Text + 1
If StartIP3.Text = "256" Then
StartIP3.Text = "1"
StartIP2.Text = StartIP2.Text + 1
If StartIP2.Text = "256" Then
StartIP2.Text = "1"
StartIP1.Text = StartIP1.Text + 1
If StartIP1.Text = "256" Then
Exit Sub
End If
End If
End If
End If

Start = 1
Loop

Open App.Path & "\" & "Scan.txt" For Append As #1
Write #1, "The last ip scanned was "; StartIP
Close #1
End Sub

Private Sub Form_Unload(Cancel As Integer)
Unload Me
End Sub
'///////////////////////////////////////////////////
'ok so these next subroutines are for when a text
'box has the focus to select everything in the box
Private Sub StartIP1_GotFocus()
StartIP1.SelStart = 0
StartIP1.SelLength = Len(StartIP1.Text)
End Sub

Private Sub StartIP2_GotFocus()
StartIP2.SelStart = 0
StartIP2.SelLength = Len(StartIP1.Text)
End Sub

Private Sub StartIP3_GotFocus()
StartIP3.SelStart = 0
StartIP3.SelLength = Len(StartIP1.Text)
End Sub

Private Sub StartIP4_GotFocus()
StartIP4.SelStart = 0
StartIP4.SelLength = Len(StartIP1.Text)
End Sub

Private Sub StopIP1_gotfocus()
StopIP1.SelStart = 0
StopIP1.SelLength = Len(StopIP1.Text)
End Sub

Private Sub StopIP2_gotfocus()
StopIP2.SelStart = 0
StopIP2.SelLength = Len(StopIP1.Text)
End Sub

Private Sub StopIP3_gotfocus()
StopIP3.SelStart = 0
StopIP3.SelLength = Len(StopIP1.Text)
End Sub

Private Sub StopIP4_gotfocus()
StopIP4.SelStart = 0
StopIP4.SelLength = Len(StopIP1.Text)
End Sub

Private Sub txtMessage_Change()

End Sub

Private Sub txtPort_gotfocus()
txtPort.SelStart = 0
txtPort.SelLength = Len(txtPort.Text)
End Sub
'///////////////////////////////////////////////////

Private Sub Timer_Timer()
Seconds = 1
End Sub



MFG

daniel
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
portscanner ist zu lam78daniel02.05.02 17:03

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel