Code archives/Networking/Random ip generator

This code has been declared by its author to be Public Domain code.

Download source code

Random ip generator by Nebula
(Posted 20 years ago)
Useful function for making ping lists.
;
; Ip generator ()
; Spider ping list builder
; Made for a server simulation game
; Cromdesign
DebugLog ip_generator(-1,0,0,0)
DebugLog ip_generator(-1,Rand(0,999),7,0)
;
Function ip_generator$(a,b,c,d)
	; -1 = random
	Select a
		Case -1	
		a = Rand(0,999)
	End Select
	Select b	
		Case -1
		b = Rand(0,999)
	End Select
	Select c	
		Case -1
		c = Rand(0,999)
	End Select	
	Select d	
			Case -1
			d = Rand(0,999)
	End Select	
	out$ = a+"."+b+"."+c+"."+d
	Return out$
End Function

Comments

Vertex
(Posted 20 years ago)
Lol? You know, that a IPv4 - Address have 4 bytes and 1 byte have an range of 0 - 255?

Panno
(Posted 20 years ago)
why not use RND(999) ;)

Andres
(Posted 20 years ago)
the function is usefull for cracking the whole world:
; Hack the world

Global Msg$ = Input("Please enter the hack message: ")

While Not KeyHit(1)
	host$ = Rand(0, 255) + "." + Rand(0, 255) + "." + Rand(0, 255) + "." + Rand(0, 255)
	stream% = OpenTCPStream(host$, Rand(0, 255*255) * percent#)
	If stream% Then
		Print "Success -> " + host$
		WriteLine stream%, Msg$
		CloseTCPStream stream%
	Else
		Print "Failed ->  " + host$
	EndIf
Wend


Fixed the IP gen too

Code Archives Forum