Skip to content

Instantly share code, notes, and snippets.

@fuwiak
Created December 16, 2021 09:14
Show Gist options
  • Save fuwiak/8486d99418038358cccd715e3b0a3ca2 to your computer and use it in GitHub Desktop.
Save fuwiak/8486d99418038358cccd715e3b0a3ca2 to your computer and use it in GitHub Desktop.
class IP:
def __init__(self, ip_address, filename):
self.ip_address = ip_address
self.filename = filename
def random_ip_nonlocal(self):
lista_ip_non_local = []
for i in range(self.ip_address):
ip = ""
for i in range(0, 4):
losowa_liczba = random.randint(1, 255)
ip += str(losowa_liczba)
if i in range(0, 3):
ip += "."
lista_ip_non_local.append(ip)
return lista_ip_non_local
def random_ip_local(self):
lista_ip_local = []
for i in range(self.ip_address):
ip = "192.168."
for i in range(0, 2):
losowa_liczba = random.randint(1, 255)
ip += str(losowa_liczba)
if i in range(1):
ip += "."
lista_ip_local.append(ip)
return lista_ip_local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment