Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * This script does a POST request to https://discord.me/login using these paramaters:
- * headers:
- * Content-Type: application/x-www-form-urlencoded
- * body:
- * username=[username]&password=[password]
- *
- * Make sure the username and password are suitable as a query string. (Escape &,=,?,@ etc.)
- *
- * After the post request is made, two cookie paramaters are returned that should be stored in the format of "__cfduid=[id]; session=[session_id]"
- *
- * Once this is done, two simple HEAD requests are made to /server/bump/[SERVER_ID] and /signout with the cookie in the headers.
- *
- */
- 'use strict';
- const https = require('https');
- const querystring = require('querystring');
- let cookie;
- const username = '';
- const password = '';
- // Sign in and store the cookie.
- let signinRequest = https.request({
- "hostname": 'discord.me',
- "path": '/signin',
- "method": 'POST',
- "headers": {
- "Content-Type": 'application/x-www-form-urlencoded'
- }
- }, (res) => {
- let tempCookie = res.headers['set-cookie'].join(';').split(';');
- for (let i = 0; tempCookie[i]; i++) { // After going through this for loop, cookie contains 'session=[session_id]'
- if (tempCookie[i].indexOf('__cfduid') !== -1) {
- cookie += tempCookie[i];
- }
- if (tempCookie[i].indexOf('session') !== -1) {
- cookie += '; ' + tempCookie[i];
- }
- }
- res.on('data', (chunk) => {
- // No data is returned for a HEAD request.
- });
- res.on('end', () => {
- console.log(res.headers);
- bumpServer();
- });
- });
- signinRequest.write('username=' + querystring.escape(username) + '&password=' + querystring.escape(password));
- signinRequest.end();
- // Bump the server using the cookie.
- let bumpServer = () => {
- let bumpRequest = https.request({
- "hostname": 'discord.me',
- "path": '/server/bump/8835',
- "method": 'HEAD',
- "headers": {
- "Cookie": cookie
- }
- }, (res) => {
- res.on('data', (chunk) => {
- // No data is returned for a HEAD request.
- });
- res.on('end', () => {
- console.log(res.headers);
- signOut();
- })
- }).end();
- }
- // Sign out using the cookie.
- let signOut = () => {
- https.request({
- "hostname": 'discord.me',
- "path": '/logout',
- "method": 'HEAD',
- "headers": {
- "Cookie": cookie
- }
- }, (res) => {
- res.on('data', (chunk) => {
- // No data is returned for a HEAD request.
- });
- res.on('end', () => {
- console.log(res.headers);
- });
- }).end();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement