Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const express = require('express');
  2. const axios = require('axios');
  3.  
  4. const app = express();
  5.  
  6. app.get("/", function(req, res) {
  7.   const base = "http://npst.no/api/🙃.js?commands=";
  8.   const commands = ["✨", "⚡", "🔑", "🤷"];
  9.   let go = true;
  10.   for (let i = 1; i <= 6; i++) {
  11.     if (go) {
  12.       const comb = getCombos(commands, i);
  13.       comb.forEach(combination => {
  14.         const url = `${base}${combination}`.replace(/,/g, "");
  15.         axios
  16.           .get(encodeURI(url))
  17.           .then(res => {
  18.             if (res.data && !res.data.error && res.data.message) {
  19.               if (res.data.message.includes("PST")) {
  20.                 go = false;
  21.                 console.log(res.data.message);
  22.               }
  23.             }
  24.           })
  25.           .catch(error => {
  26.             if (error.data && res.data.message) {
  27.               console.log(error.data.message);
  28.             }
  29.           });
  30.       });
  31.     }
  32.   }
  33. });
  34.  
  35. app.listen(80);
  36.  
  37. function getCombos(arr, len) {
  38.   const base = arr.length;
  39.   const counter = Array(len).fill(base === 1 ? arr[0] : 0);
  40.   if (base === 1) return [counter];
  41.   const combos = [];
  42.   const increment = i => {
  43.     if (counter[i] === base - 1) {
  44.       counter[i] = 0;
  45.       increment(i - 1);
  46.     } else {
  47.       counter[i]++;
  48.     }
  49.   };
  50.  
  51.   for (let i = base ** len; i--; ) {
  52.     const combo = [];
  53.     for (let j = 0; j < counter.length; j++) {
  54.       combo.push(arr[counter[j]]);
  55.     }
  56.     combos.push(combo);
  57.     increment(counter.length - 1);
  58.   }
  59.  
  60.   return combos;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement