Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const express = require('express');
- const axios = require('axios');
- const app = express();
- app.get("/", function(req, res) {
- const base = "http://npst.no/api/🙃.js?commands=";
- const commands = ["✨", "⚡", "🔑", "🤷"];
- let go = true;
- for (let i = 1; i <= 6; i++) {
- if (go) {
- const comb = getCombos(commands, i);
- comb.forEach(combination => {
- const url = `${base}${combination}`.replace(/,/g, "");
- axios
- .get(encodeURI(url))
- .then(res => {
- if (res.data && !res.data.error && res.data.message) {
- if (res.data.message.includes("PST")) {
- go = false;
- console.log(res.data.message);
- }
- }
- })
- .catch(error => {
- if (error.data && res.data.message) {
- console.log(error.data.message);
- }
- });
- });
- }
- }
- });
- app.listen(80);
- function getCombos(arr, len) {
- const base = arr.length;
- const counter = Array(len).fill(base === 1 ? arr[0] : 0);
- if (base === 1) return [counter];
- const combos = [];
- const increment = i => {
- if (counter[i] === base - 1) {
- counter[i] = 0;
- increment(i - 1);
- } else {
- counter[i]++;
- }
- };
- for (let i = base ** len; i--; ) {
- const combo = [];
- for (let j = 0; j < counter.length; j++) {
- combo.push(arr[counter[j]]);
- }
- combos.push(combo);
- increment(counter.length - 1);
- }
- return combos;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement