This repository was 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
Steven Pereira
authored
Sep 8, 2024
0 parents
commit cf40eda
Showing
5 changed files
with
888 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,116 @@ | ||
# ----- License ---------------------------------------------------------------------------------------------------- # | ||
|
||
# HolyScan Copyright (C) 2024 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 os | ||
import time | ||
import socket | ||
from rich.console import Console | ||
from threading import Thread | ||
from threading import Lock | ||
from queue import Queue | ||
from datetime import datetime | ||
|
||
# ----- Global Declaration ----------------------------------------------------------------------------------------- # | ||
|
||
console = Console() | ||
N_Thread = 200 | ||
q = Queue() | ||
print_lock = Lock() | ||
|
||
# ----- Menu ------------------------------------------------------------------------------------------------------- # | ||
|
||
class menu(): | ||
|
||
def clear(): | ||
time.sleep(1) | ||
if os.name == "nt": | ||
os.system("cls") | ||
else: | ||
os.system("clear") | ||
|
||
# ----- Banner ----------------------------------------------------------------------------------------------------- # | ||
|
||
class banner(): | ||
|
||
def ascii(): | ||
console.print(rf"""[bold yellow] | ||
┌──────────────────────────────────────────────────────────────────────────────┐ | ||
│ │ | ||
│ 888 888 888 .d8888b. │ | ||
│ 888 888 888 d88P Y88b │ | ||
│ 888 888 888 Y88b. │ | ||
│ 8888888888 .d88b. 888 888 888 "Y888b. .d8888b 8888b. 88888b. │ | ||
│ 888 888 d88""88b 888 888 888 "Y88b. d88P" "88b 888 "88b │ | ||
│ 888 888 888 888 888 888 888 "888 888 .d888888 888 888 │ | ||
│ 888 888 Y88..88P 888 Y88b 888 Y88b d88P Y88b. 888 888 888 888 │ | ||
│ 888 888 "Y88P" 888 "Y88888 "Y8888P" "Y8888P "Y888888 888 888 │ | ||
│ 888 │ | ||
│ Y8b d88P │ | ||
│ "Y88P" │ | ||
│ │ | ||
│ +-+-+ │ | ||
│ [#c61a09]Made by Cursed271[bold yellow] │ | ||
│ +-+-+ │ | ||
│ │ | ||
└──────────────────────────────────────────────────────────────────────────────┘ | ||
""") | ||
|
||
# ----- Port Scanner ----------------------------------------------------------------------------------------------- # | ||
|
||
def portscan(port): | ||
try: | ||
s = socket.socket() | ||
s.connect((host, port)) | ||
except: | ||
with print_lock: | ||
pass | ||
else: | ||
with print_lock: | ||
serviceName = socket.getservbyport(port) | ||
service = serviceName.upper() | ||
console.print(f"\t- {service}: {port}") | ||
finally: | ||
s.close() | ||
|
||
# ----- Threading -------------------------------------------------------------------------------------------------- # | ||
|
||
def scan_thread(): | ||
global q | ||
while True: | ||
worker = q.get() | ||
portscan(worker) | ||
q.task_done() | ||
|
||
def scanner(host, ports): | ||
global q | ||
for t in range(N_Thread): | ||
t = Thread(target=scan_thread) | ||
t.daemon = True | ||
t.start() | ||
for worker in ports: | ||
q.put(worker) | ||
q.join() | ||
|
||
# ----- Main Function ---------------------------------------------------------------------------------------------- # | ||
|
||
if __name__ == '__main__': | ||
menu.clear() | ||
banner.ascii() | ||
console.print("[#5bd2f0]────── [#ffaf68]Performing a Port Scan [#5bd2f0]────────────────────────────────────────────────────────────────────────────────────────\n") | ||
start = datetime.now() | ||
remote_server = console.input("[#f6e683]Enter the Host name: ") | ||
host = socket.gethostbyname(remote_server) | ||
port = console.input("[#f6e683]Enter the port range: ") | ||
port_range = port.split("-") | ||
start = int(port_range[0]) | ||
end = int(port_range[1]) | ||
ports = [p for p in range(start, end)] | ||
console.print("[#79d45e]Open Ports: ") | ||
scanner(host, ports) | ||
|
||
# ----- End -------------------------------------------------------------------------------------------------------- # |
Oops, something went wrong.