This repository has been archived by the owner on Sep 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a7765d4
Showing
5 changed files
with
857 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# ----- License ---------------------------------------------------------------------------------------------------- # | ||
|
||
#IPScan Copyright (C) 2022 Steven Pereira | ||
#This program comes with ABSOLUTELY NO WARRANTY. | ||
#This is free software, and you are welcome to redistribute it under certain conditions. | ||
|
||
# ----- Import Section --------------------------------------------------------------------------------------------- # | ||
|
||
import subprocess | ||
import re | ||
from rich.console import Console | ||
|
||
# ----- Global Declaration ----------------------------------------------------------------------------------------- # | ||
|
||
console = Console() | ||
|
||
# ----- Banner Function -------------------------------------------------------------------------------------------- # | ||
|
||
def ascii(): | ||
console.print(rf"""[bold yellow] | ||
┌────────────────────────────────────────────────────────────────┐ | ||
│ │ | ||
│ 8888888 8888888b. .d8888b. │ | ||
│ 888 888 Y88b d88P Y88b │ | ||
│ 888 888 888 Y88b. │ | ||
│ 888 888 d88P "Y888b. .d8888b 8888b. 88888b. │ | ||
│ 888 8888888P" "Y88b. d88P" "88b 888 "88b │ | ||
│ 888 888 "888 888 .d888888 888 888 │ | ||
│ 888 888 Y88b d88P Y88b. 888 888 888 888 │ | ||
│ 8888888 888 "Y8888P" "Y8888P "Y888888 888 888 │ | ||
│ │ | ||
│ +-+-+ │ | ||
│ [#c61a09]Made by Cursed271[bold yellow] │ | ||
│ +-+-+ │ | ||
│ │ | ||
└────────────────────────────────────────────────────────────────┘ | ||
""") | ||
|
||
# ----- Validation Functions --------------------------------------------------------------------------------------- # | ||
|
||
def subnet_range(ip): | ||
sub = ip.replace("/24", "") | ||
subval = sub.split(".") | ||
for x in subval: | ||
if not x.isdigit(): | ||
console.print("You've entered the wrong Subnet Range") | ||
console.print("Please check your Input") | ||
exit() | ||
else: | ||
i = int(x) | ||
if i >= 0 or i <= 255: | ||
pass | ||
else: | ||
console.print("You've entered the wrong Subnet Range") | ||
console.print("Please check your Input") | ||
exit() | ||
|
||
# ----- Scanning Function ------------------------------------------------------------------------------------------ # | ||
|
||
def scanner(ip): | ||
subnet_range(ip) | ||
network = ip.replace("0/24", "") | ||
ip_values = [] | ||
for host in range(1, 6): | ||
ip_val = network + str(host) | ||
process = subprocess.run('ping -c 1 '+ ip_val,stdout=subprocess.PIPE, shell=True) | ||
if process.returncode == 0: | ||
ip_values.append(ip_val) | ||
console.print(f"{ip_val} IS ALIVE!!") | ||
console.print("Ping completed successfully!") | ||
console.print(f"There are {len(ip_values)} hosts available") | ||
|
||
# ----- Main Function ---------------------------------------------------------------------------------------------- # | ||
|
||
if __name__ == '__main__': | ||
try: | ||
ascii() | ||
ip = input("Please enter a Subnet Range: ") | ||
scanner(ip) | ||
except KeyboardInterrupt: | ||
print("Forcefully terminated IPScan") | ||
|
||
# ----- End -------------------------------------------------------------------------------------------------------- # |
Oops, something went wrong.