Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function Generate()
- ' WriteLine(args.length.ToString)
- '
- 'INFO
- ' It will create file if not exist and generates ips.
- ' if the Ip is already on the list it will not re-add it, it will generate a new one and ignore the one already on the list.
- '
- '
- If args.Length = 3 Then
- Dim amount As Integer = 0
- Try
- amount = args(1)
- Dim outputfile As String = args(2)
- Dim current As Integer = 0
- Dim xcurrent As Integer = 0
- If Not System.IO.File.Exists(outputfile) Then
- FileOpen(1, outputfile, OpenMode.Output)
- FileClose(1)
- End If
- Dim tlist As New List(Of String)
- FileOpen(1, outputfile, OpenMode.Input)
- While Not EOF(1)
- Dim x = LineInput(1)
- tlist.Add(x)
- End While
- FileClose(1)
- Dim ip As String = Nothing
- Dim rn As New Random
- Do Until current = amount
- Do Until xcurrent = 4
- Dim n = rn.Next(0, 255)
- ip += n.ToString + "."
- xcurrent += 1
- Loop
- xcurrent = 0
- Dim finalip As String = ip.TrimEnd(".")
- ip = Nothing
- Dim tIP As String = finalip
- If Not tlist.Contains(tIP) Then
- tlist.Add(tIP)
- current += 1
- WriteLine("(" + current.ToString + ") Added: " + tIP)
- Else
- WriteLine("(" + current.ToString + ") Failed: " + tIP + " IP already exist on that list.")
- End If
- Threading.Thread.Sleep(20)
- Loop
- FileOpen(1, outputfile, OpenMode.Output)
- For Each x In tlist
- PrintLine(1, x)
- Next
- FileClose(1)
- Catch ex As Exception
- WriteLine("Argument 1 (Amount), Was not of numeric limits (Numbers only).")
- End Try
- ElseIf args.Length = 2 Then
- WriteLine("Argument 1 (Amount), Was not of numeric limits (Numbers only).")
- WriteLine("Amount of Arguments you put: " + args.length.ToString + ". Amount of Arguments required: 3")
- Else
- WriteLine("Amount of Arguments you put: " + args.length.ToString + ". Amount of Arguments required: 3")
- End If
- FileClose(1)
- Return True
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement