Skip to content

Commit

Permalink
Fix code style issues with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
lint-action committed Mar 4, 2023
1 parent b0cfc43 commit bade0cf
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 78 deletions.
84 changes: 46 additions & 38 deletions Honeypot.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import socket
import winsound
import datetime
def con(port,msg,need_beep,need_logs,file):
ip = socket.gethostbyname('0.0.0.0')
cur_time=datetime.datetime.now()


def con(port, msg, need_beep, need_logs, file):
ip = socket.gethostbyname("0.0.0.0")
cur_time = datetime.datetime.now()
print(f" ZAP Honeypot Activated On PORT {port} --{cur_time}")
print()
print()
try:
get_socket_con =socket.socket(socket.AF_INET,socket.SOCK_STREAM)
get_socket_con.bind((ip,port))
get_socket_con = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
get_socket_con.bind((ip, port))
get_socket_con.listen(10)
while True:
client_con,client_ip=get_socket_con.accept()
time=datetime.datetime.now()
client_con, client_ip = get_socket_con.accept()
time = datetime.datetime.now()
print(time)
IP_addr=f"Caught !! : {client_ip[0]}"
IP_addr = f"Caught !! : {client_ip[0]}"
print(IP_addr)
client_con.send(msg.encode())
if need_beep:
Expand All @@ -24,77 +26,83 @@ def con(port,msg,need_beep,need_logs,file):
winsound.Beep(freq, dur)
winsound.Beep(freq, dur)
data = client_con.recv(2048)
print(data.decode('utf-8'))
print(data.decode("utf-8"))
if need_logs:
file.write(str(time)+'\n')
file.write(str(IP_addr)+'\n')
file.write(str(data.decode('utf-8')))
file.write(str(time) + "\n")
file.write(str(IP_addr) + "\n")
file.write(str(data.decode("utf-8")))
file.flush()
client_con.close()
except Exception as identifier:
print(f'Unspecified error {identifier}')
print(f"Unspecified error {identifier}")
except KeyboardInterrupt:
print('Keyboard Interupt')
print("Keyboard Interupt")
finally:
get_socket_con.close()
def honey():
need_beep=True
need_logs=False


def honey():
need_beep = True
need_logs = False
while True:
try:
choice=int(input("1 > Automated the process. \n2 > Configure manually. \n \nEnter your choice :>"))
if choice in range(1,3):
choice = int(
input(
"1 > Automated the process. \n2 > Configure manually. \n \nEnter your choice :>"
)
)
if choice in range(1, 3):
break
except Exception as i:
print('Error: ',i)
print("Error: ", i)
print()
if choice ==1:
port=80 #Please review the code or else dont change
msg='<div style="background-color:green;color:red;padding:2%;"> ACCESS DENIED </div>'
con(port,msg,need_beep,need_logs,file=None)
if choice == 1:
port = 80 # Please review the code or else dont change
msg = '<div style="background-color:green;color:red;padding:2%;"> ACCESS DENIED </div>'
con(port, msg, need_beep, need_logs, file=None)
elif choice == 2:
while True:
try:
port=int(input("Insert PORT to OPEN \n :>"))
if port<0:
port = int(input("Insert PORT to OPEN \n :>"))
if port < 0:
print("Port number can't be negative")
else:
break
except Exception as identifier:
print('Error: ',identifier)
print("Error: ", identifier)
print()
print()
while True:
try:
msg=input("Enter messge to show \n :>")
msg = input("Enter messge to show \n :>")
break
except Exception as identifier:
print(identifier)
print()
print()
while True:
try:
log=input('Want to keep logs \n(y/n) :>')
if log.lower()=='n':
log = input("Want to keep logs \n(y/n) :>")
if log.lower() == "n":
break
elif log.lower()=='y':
file= open('honeypotlist.txt','a')
need_logs=True
elif log.lower() == "y":
file = open("honeypotlist.txt", "a")
need_logs = True
break
except Exception as identifier:
print(identifier)
print()
print()
while True:
try:
beep=input('Want a BEEP!! sound when \n(y/n) :>')
if beep.lower()=='n':
need_beep=False
beep = input("Want a BEEP!! sound when \n(y/n) :>")
if beep.lower() == "n":
need_beep = False
break
elif beep.lower()=="y":
elif beep.lower() == "y":
break
except Exception as identifier:
print(identifier)
print()
print()
con(port,msg,need_beep,need_logs,file=False)
con(port, msg, need_beep, need_logs, file=False)
44 changes: 26 additions & 18 deletions garuda.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
msg=(
msg = (
" __..-' \n"
" ________ ___ _.--'' \n"
" / _____/_____ _______ __ __ __| _/____ _...__..-' \n"
Expand All @@ -8,37 +8,45 @@
" \/ \/ \/ \/ .' \n"
" | \n"
" .------._ ; \n"
'------MENU------- .-"""`-.<'') `-._ . \n'
'------MENU------- .-"""`-.<'
") `-._ . \n"
" (.--. _ `._ `'---.__.-' \n"
" 1) PORT Scannner ` `;'-.-' '- ._ \n"
" .--'`` '._ - ' . \n"
" 2) HoneyPot `""'-. `---' , \n"
" 2) HoneyPot `"
"'-. `---' , \n"
" ''--..__ `\" \n"
" ``''---'`\ .' \n"
" `'. ' \n"
" `'. \n"
)
class bold_color: # Change colours according to your need
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
END = '\033[0m'


class bold_color: # Change colours according to your need
PURPLE = "\033[95m"
CYAN = "\033[96m"
DARKCYAN = "\033[36m"
BLUE = "\033[94m"
GREEN = "\033[92m"
YELLOW = "\033[93m"
RED = "\033[91m"
BOLD = "\033[1m"
UNDERLINE = "\033[4m"
END = "\033[0m"


print(bold_color.GREEN)
print(msg)
if __name__ == "__main__":
while True:
menu=int(input("Choose : "))
if menu in range(1,3):
menu = int(input("Choose : "))
if menu in range(1, 3):
break
if menu==1:
if menu == 1:
import scan

scan.scanner()
elif menu==2:
elif menu == 2:
import Honeypot

Honeypot.honey()
51 changes: 29 additions & 22 deletions scan.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,46 @@
import sys
import socket
import threading
import threading
import time
k=0

k = 0


def scanner():
print('EFFLUX Eagle port scanner')
print('-'*80)
print("EFFLUX Eagle port scanner")
print("-" * 80)
try:
tar=input('IP addr : ')
target= socket.gethostbyname(tar) #host name given will resolve to corresponding ip address from dns
tar = input("IP addr : ")
target = socket.gethostbyname(
tar
) # host name given will resolve to corresponding ip address from dns
except socket.gaierror:
print('Name resolution error')
print("Name resolution error")
sys.exit()
start_port=int(input('START Port : '))
end_port=int(input("END Port : "))
start_port = int(input("START Port : "))
end_port = int(input("END Port : "))
startTime = time.time()
print('Scanning ',target)
print("Scanning ", target)

def scan(port):
global k
p=socket.socket(socket.AF_INET,socket.SOCK_STREAM) #tcp
p = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # tcp
p.settimeout(5)
connection=p.connect_ex((target,port))
if(not(connection)):
serviceName = socket.getservbyport(port, 'tcp')
connection = p.connect_ex((target, port))
if not (connection):
serviceName = socket.getservbyport(port, "tcp")
print(f"{port}|tcp OPEN {serviceName}")
k+=1
k += 1
if port == end_port:
if k!=0:
if k != 0:
print(f"Eagle Scanning was sucessfull, {k} Ports are open")
elif k==0:
elif k == 0:
print(f"Unfortunately no ports were open")
print('Time taken:', str(time.time() - startTime)[:4],'sec')
print("Time taken:", str(time.time() - startTime)[:4], "sec")
p.close()
print('PORT \t STATUS SERVICE')
for port in range(start_port,end_port+1):
thread=threading.Thread(target=scan , args=(port,))

print("PORT \t STATUS SERVICE")
for port in range(start_port, end_port + 1):
thread = threading.Thread(target=scan, args=(port,))
thread.start()
exit()
exit()

0 comments on commit bade0cf

Please sign in to comment.