Skip to content

Instantly share code, notes, and snippets.

@cchudant
Created March 11, 2018 15:28
Show Gist options
  • Select an option

  • Save cchudant/8a52bcb79098ecfb33404bb7caf86592 to your computer and use it in GitHub Desktop.

Select an option

Save cchudant/8a52bcb79098ecfb33404bb7caf86592 to your computer and use it in GitHub Desktop.
const { exec } = require('child_process')
const curl = `curl 'https://discordapp.com/api/v6/channels/$channel/messages' -H 'origin: https://discordapp.com' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: fr' -H 'authorization: $authorization' -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36' -H 'content-type: application/json' -H 'accept: */*' -H 'referer: https://discordapp.com/channels/414430510287159298/414468161753186324' -H 'authority: discordapp.com' -H 'dnt: 1' --data-binary '{"content":"$message","nonce":"422183212660293632","tts":false}' --compressed`
const accounts = {
'drafter2002': 'XXXXXXXXXXXX', // Authorization tokens;
'Licorne salée': 'XXXXXXXXXXXX', // Get them by inspecting the HTTP headers of Discord queries
'Life is Potato': 'XXXXXXXXXXXX',
'SkyBeast': 'XXXXXXXXXXXX',
}
const commands = {
'/work': { interval: 5 * 60 * 1000 + 2 * 1000, channel: '414468161753186324' }, //Channel #actions-1
'/slut': { interval: 10 * 60 * 1000 + 4 * 1000, channel: '414468161753186324' }, //Channel #actions-1
'/deposit all': { interval: 30 * 60 * 1000, channel: '414467974569656330' } //Channel #tresorerie-1
}
Object.entries(accounts).forEach(([user, authorization], i) =>
setTimeout(() =>
Object.entries(commands).forEach(([command, { interval, channel }], j) => {
setTimeout(() =>
setInterval(() => {
const cmd = curl.replace('$message', command)
.replace('$authorization', authorization)
.replace('$channel', channel)
exec(cmd, (err, stdout, stderr) => {
console.log('==== ' + command.toUpperCase() + ' == ' + new Date() + ' ====')
console.log('USER = "' + user + '"')
console.log('CURL = "' + cmd + '"')
err && console.error(err)
console.log('')
console.log('stdout:\n' + stdout)
console.log('stderr:\n' + stderr)
console.log('==========================================================')
})
}, interval),
j * 2 * 1000 //offset delay between 2 commands
)
}),
i * 65 * 1000 //offset delay between 2 user
)
)
@cchudant

cchudant commented Mar 11, 2018

Copy link
Copy Markdown
Author

how to break a server in 40 lines and 10 minutes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment