Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strNext As String = "0.0.0.0"
Dim intIndex As Integer
For intIndex = 0 To 100000
Debug.WriteLine(strNext)
strNext = funcNextIPAddy(strNext)
Next
End Sub
Private Function funcNextIPAddy(ByVal strIPAddy) As String
Dim intIndex As Integer
Dim intRev As Integer
Dim strSplit() As String = Split(strIPAddy, ".")
Dim bytIP(3) As Byte
'Just to make sure it works
ReDim Preserve strSplit(3)
Dim bAdded As Boolean = False
For intIndex = 3 To 0 Step -1
bytIP(intIndex) = funcFixByte(strSplit(intIndex))
If bAdded = False Then
If bytIP(intIndex) < 255 Then
bytIP(intIndex) += 1
bAdded = True
For intRev = intIndex + 1 To 3
bytIP(intRev) = 0
Next
End If
End If
Next
Return CStr(bytIP(0)) & "." & CStr(bytIP(1)) & "." & CStr(bytIP(2)) & "." & CStr(bytIP(3))
End Function
Private Function funcFixByte(ByVal Data As String) As Byte
Dim intVal As Integer = Val(Data)
If intVal < 0 Then intVal = 0
If intVal > 255 Then intVal = 255
Return CByte(intVal)
End Function
string[] GenerateIps()
{
ArrayList ips = new ArrayList();
string a=null,b=null,c=null,d=null;
for(int intA = 1; intA < 255; intA++)
{
a = intA.ToString();
for(int intB = 0; intB < 255; intB++)
{
b = intB.ToString();
for(int intC = 0; intC < 255; intC++)
{
c = intC.ToString();
for(int intD = 0; intD < 255; intD++)
{
d = intD.ToString();
ips.Add(a + "." + b + "." + c + "." + d);
}
ips.Add(a + "." + b + "." + c + "." + d);
}
ips.Add(a + "." + b + "." + c + "." + d);
}
ips.Add(a + "." + b + "." + c + "." + d);
}
return (string[]) ips.ToArray(typeof(string));
}
Grimfort said:This is soooo going to be used for a hack attack