mirror of
https://github.com/bl4d3rvnner7/sourcescodes.git
synced 2025-12-16 16:34:05 +00:00
⚙️ Need : IP List ❔What does it do ? It ranges the IPs from f.e. 13.46.120.2 To : 13.46.120.1 13.46.120.2 13.46.120.3 13.46.120.4 ... From 1 to 256.
32 lines
No EOL
1.1 KiB
Python
32 lines
No EOL
1.1 KiB
Python
# A Function to make everything clean
|
|
|
|
def Ranger(ip: str) -> None:
|
|
# We will use a try-except block to avoid any exceptions
|
|
try:
|
|
IpArray = ip.split('.')
|
|
|
|
for i in range(256): # IP Address Can only exceed upto 256
|
|
|
|
# We will only range the last part of the ip , you can always increase or decrease it
|
|
saveFileName.write(f"{IpArray[0]}.{IpArray[1]}.{IpArray[2]}.{i}\n")
|
|
|
|
|
|
except Exception:
|
|
print(f"Invalid IP : {ip}")
|
|
|
|
|
|
|
|
fileName = input("[+] Your IP List :") # User will input the filename first
|
|
|
|
|
|
with open(fileName, errors="ignore", encoding="utf8") as baseFile: # We use context manager
|
|
|
|
IpList = list(dict.fromkeys(baseFile.readlines())) # For removing duplicates
|
|
|
|
saveFileName = open("IP Range.txt", "a") # We will create a new file Names IP Ranges to save those ranges
|
|
|
|
# We will iterate through the list
|
|
|
|
for ip in IpList:
|
|
Ranger(ip)
|
|
print(f"Completed : {ip}") # Finally we will print the status as its completed |