// akamai-solutions.dev | Akamai Sensor Generator 1.63
var fs = require("fs");
var express = require("express");
var bodyParser = require("body-parser");
var colors = require("colors");

const { config } = require("process");
const { json } = require("body-parser");
const { response } = require("express");
const { path } = require('ghost-cursor')


//const puppeteer = require('puppeteer-extra')
//const StealthPlugin = require('puppeteer-extra-plugin-stealth')
//const AdblockerPlugin = require('puppeteer-extra-plugin-adblocker')


const PORT = process.env.PORT || 3000;
var app = express();
app.use(express.static('../html'));
app.use(
    bodyParser.json({
        type: "application/*+json",
    })
);
var jsonParser = bodyParser.json();

function getRandomInt(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
}


bmak = {
    // static vars
    start_ts: Date.now ? Date.now() : +new Date(),
    xagg: "12147",
    psub: "20030107",
    lang: "en-US",
    prod: "Gecko",
    plen: "3",
    pen: "0",
    wen: "0",
    den: "0",
    device_events: "do_en,dm_en,t_en",
    fas: "30261693",
    sed: "0,0,0,0,1,0,0",
    kact: "",
    mact: "",
    tact: "",
    doact: "",
    dmact: "",
    pact: "",
    vcact: "",
    ke_vel: 0,
    me_vel: 0,
    te_vel: 0,
    doe_vel: 0,
    dme_vel: 0,
    pe_vel: 0,
    init_time: 0,
    ke_cnt: 0,
    me_cnt: 0,
    pe_cnt: 0,
    te_cnt: 0,
    ta: 0,
    n_ck: 0,
    aj_indx: 0,
    mr: "-1",
    nav_perm: "",
    api_public_key: "afSbep8yjnZUjq3aL010jO15Sawj2VZfdYK8uY90uxq",
    cs: "0a46G5m17Vrp4o4c",
    tst: -1,
    webglRender: "",

    get_cf_date: function() {
        return Date.now ? Date.now() : +new Date();
    },

    gd: function() {
        let uar = bmak.user_agent;
        bmak.z1 = parseInt(bmak.start_ts / (2016 * 2016));
        var d = Math.random(),
            k = parseInt((1e3 * d) / 2),
            s = d + "";
        rnd_seed = s.slice(0, 11) + k;
        const list = [
            uar,
            "uaend",
            bmak.xagg,
            bmak.psub,
            bmak.lang,
            bmak.prod,
            bmak.plen,
            bmak.pen,
            bmak.wen,
            bmak.den,
            bmak.z1,
            bmak.d3,
            bmak.screen_info,
            bmak.bd,
            bmak.ab(uar),
            rnd_seed,
            bmak.start_ts / 2,
            "loc:",
        ];
        return list.join(",");
    },

    to: function() {
        var t = bmak.get_cf_date() % 1e7;
        bmak.d3 = t;
        for (var a = t, e = parseInt(String.fromCharCode(51)), n = 0; n < 5; n++) {
            var o = parseInt(t / Math.pow(10, n)) % 10,
                m = o + 1;
            (op = bmak.cc(o)), (a = op(a, m));
        }
        bmak.o9 = a * e;
    },
    cc: function(t) {
        var a = t % 4;
        2 == a && (a = 3);
        var e = 42 + a,
            n = function(t, a) {
                return 0;
            };
        if (42 == e)
            var n = function(t, a) {
                return t * a;
            };
        else if (43 == e)
            var n = function(t, a) {
                return t + a;
            };
        else
            var n = function(t, a) {
                return t - a;
            };
        return n;
    },
    ab: function(t) {
        try {
            for (var a = 0, e = 0; e < t.length; e++) {
                var n = t.charCodeAt(e);
                n < 128 && (a += n);
            }
            return a;
        } catch (t) {
            return -2;
        }
    },
    cal_dis: function(t) {
        var a = t[0] - t[1],
            e = t[2] - t[3],
            n = t[4] - t[5],
            o = Math.sqrt(a * a + e * e + n * n);
        return Math.floor(o);
    },
    jrs: function(t) {
        for (
            var a = Math.floor(1e5 * Math.random() + 1e4),
                e = String(t * a),
                n = 0,
                o = [],
                m = e.length >= 18; o.length < 6;

        )
            o.push(parseInt(e.slice(n, n + 2))), (n = m ? n + 3 : n + 2);
        return [a, bmak.cal_dis(o)];
    },
    od: function(t, a) {
        try {
            (t = String(t)), (a = String(a));
            var e = [],
                n = a.length;
            if (n > 0) {
                for (var o = 0; o < t.length; o++) {
                    var m = t.charCodeAt(o),
                        r = t.charAt(o),
                        i = a.charCodeAt(o % n);
                    (m = bmak.rir(m, 47, 57, i)),
                    m != t.charCodeAt(o) && (r = String.fromCharCode(m)),
                        e.push(r);
                }
                if (e.length > 0) return e.join("");
            }
        } catch (t) {}
        return t;
    },
    rir: function(t, a, e, n) {
        return t > a && t <= e && (t += n % (e - a)) > e && (t = t - e + a), t;
    },
    getmr: function() {
        var Obj, i, x = "";
        Obj = {
            mr_dict: ['48,53,52,53,69,67,144,10,11,6,6,5,9,355,', '37,60,39,38,20,21,14,8,9,5,5,5,9,371,', '54,36,37,35,18,18,11,8,6,5,5,5,9,331,', '7,9,10,13,26,28,17,11,10,8,8,8,12,523,', '9,13,14,13,25,26,16,11,10,8,8,6,10,350,', '7,8,9,9,17,18,11,8,7,5,5,7,13,490,', '9,13,13,12,25,27,16,13,10,7,6,6,9,348,', '7,38,14,13,26,27,17,12,10,8,7,7,12,421,', '8,12,12,161,88,20,13,8,7,5,5,5,9,402,', '6,9,9,9,17,18,11,8,7,5,6,5,9,335,', '7,9,10,9,17,18,11,8,7,5,5,5,9,333,', '6,9,9,9,18,18,12,8,7,5,7,5,9,339,', '6,9,9,9,18,18,11,15,6,5,5,5,9,334,', '6,10,9,9,18,17,11,8,7,5,5,5,9,411,', '6,10,10,9,17,18,11,8,7,6,5,5,9,331,', '6,9,9,9,17,18,11,8,7,5,5,5,9,334,', '7,9,9,13,17,19,11,8,7,5,5,5,9,336,', '6,9,9,12,18,18,11,8,7,5,5,5,9,358,', '6,9,9,9,18,18,11,8,7,5,5,5,8,478,', '6,9,10,9,18,18,11,8,7,5,5,5,9,373,', '6,9,10,9,18,18,11,8,6,5,5,5,9,359,', '6,9,9,9,17,18,11,8,7,5,5,5,9,360,', '6,12,10,9,17,18,11,8,6,5,5,5,8,332,', '7,9,9,9,17,18,11,8,6,5,5,5,9,368,', '8,9,9,11,17,18,11,8,6,5,5,5,10,374,', '6,8,10,8,17,18,67,8,6,5,5,5,9,335,', '7,9,9,10,18,18,11,8,6,5,5,5,9,394,', '8,9,9,9,17,18,12,8,7,5,5,5,9,385,', '8,10,9,9,30,78,11,10,10,6,6,5,9,413,', '10,13,15,14,36,38,18,13,12,8,8,8,15,543,', '10,14,13,9,31,31,12,10,10,6,6,6,12,377,', '8,9,11,9,29,34,13,10,10,6,6,6,13,521,', '9,13,14,13,28,26,15,11,10,8,7,6,10,361,', '7,9,9,9,18,54,11,8,7,5,5,6,9,333,', '7,9,9,9,17,18,11,8,7,5,5,5,9,330,', '7,9,9,9,17,18,11,8,6,5,5,5,9,335,', '6,9,9,9,18,18,11,8,7,5,5,5,9,337,', '7,9,9,9,29,30,13,10,10,6,6,6,12,378,', '8,9,11,9,30,46,11,8,7,5,5,5,8,340,', '7,9,9,9,17,18,11,8,7,5,5,5,9,338,', '7,9,9,9,17,18,11,8,7,5,5,5,9,343,', '6,9,9,9,17,18,11,8,7,5,5,6,12,381,', '8,9,11,10,29,31,13,10,10,6,6,6,13,379,', '8,9,11,10,30,18,11,8,7,5,5,5,9,349,', '7,9,9,10,18,18,11,8,7,5,5,5,9,341,', '7,9,11,10,29,30,12,10,10,6,7,5,9,333,', '7,9,9,10,17,18,11,8,7,5,5,6,12,374,', '8,10,11,10,37,27,17,11,10,8,8,8,14,464,', '10,15,15,11,30,32,17,12,11,8,8,8,13,425,', '8,10,10,10,18,18,11,8,8,6,5,5,8,380,', '6,9,9,10,17,18,11,8,7,5,5,5,8,338,', '7,9,9,9,18,19,11,8,7,5,5,5,9,330,', '7,9,9,9,17,18,11,8,7,5,5,5,9,342,', '6,9,9,10,73,18,11,8,7,5,6,8,13,486,', '10,13,14,12,24,28,16,10,8,6,6,6,9,389,', '7,9,10,9,17,18,11,8,6,5,5,5,9,345,', '6,9,9,9,18,18,11,8,7,7,7,8,13,493,', '12,14,15,13,28,28,58,12,9,6,6,5,9,333,', '7,10,9,9,17,18,11,8,7,5,5,5,8,334,', '6,9,9,9,17,18,11,8,7,5,5,5,9,502,', '10,13,14,13,28,29,18,11,9,8,8,8,11,369,', '7,9,9,9,17,117,11,8,6,5,5,5,9,334,', '6,9,10,14,43,51,18,14,7,5,6,5,9,704,', '6,9,9,9,17,18,11,8,6,5,5,5,9,336,', '6,9,9,9,17,18,16,11,10,8,8,8,13,379,', '6,9,9,9,17,18,11,8,7,5,5,5,10,348,', '6,37,69,13,26,27,17,12,10,7,6,9,9,343,', '7,8,9,9,18,18,11,8,7,5,5,5,14,470,', '6,9,9,9,18,18,11,8,7,5,5,5,9,385,', '7,9,9,8,17,77,11,8,7,5,5,5,9,334,', '7,9,9,8,17,18,11,8,6,5,5,5,9,340,', '7,9,9,9,18,18,11,8,6,5,5,5,9,335,', '7,9,10,9,17,18,11,8,7,5,5,8,14,481,', '10,14,15,13,25,26,17,12,10,7,7,6,10,334,', '7,9,9,9,22,18,11,8,7,5,5,5,9,338,', '7,9,9,8,17,18,11,8,6,5,5,5,9,431,', '10,13,14,13,26,27,17,12,10,7,7,7,13,475,', '8,9,9,9,18,18,11,8,7,5,5,5,9,334,', '6,10,9,9,17,18,12,8,7,5,5,5,9,330,', '6,9,9,9,18,18,11,8,7,5,5,5,9,333,', '6,9,9,9,17,18,11,8,7,5,5,5,9,416,', '6,9,9,9,17,18,11,8,7,5,5,5,9,361,', '6,9,9,9,18,18,11,8,7,5,5,5,9,334,', '7,9,9,9,18,18,11,8,7,5,5,5,9,333,', '7,14,14,9,17,18,11,8,7,5,5,5,9,345,', '6,9,9,8,17,18,11,8,7,6,5,5,9,400,', '6,9,9,9,17,18,11,8,6,5,5,5,9,357,', '6,9,9,9,17,18,11,8,9,8,8,7,13,494,', '10,13,13,11,25,31,14,9,8,5,6,8,11,400,', '7,11,10,11,17,18,11,8,7,5,5,5,9,352,', '6,9,9,9,18,18,11,8,7,5,5,10,10,468,', '10,13,14,13,28,29,16,11,9,6,6,6,9,322,', '7,9,9,10,103,34,17,12,10,8,8,8,15,502,', '8,11,10,10,18,18,11,8,7,5,5,5,9,574,', '9,13,14,13,27,28,17,10,9,6,5,5,9,333,', '6,9,9,9,17,117,16,8,7,5,5,5,8,330,', '7,9,9,9,17,18,11,8,6,5,5,5,9,486,', '7,9,9,9,17,18,11,8,7,5,5,5,9,346,', '6,9,9,9,18,18,11,8,6,8,8,8,13,494,', '10,14,14,13,24,27,16,11,7,6,5,5,9,337,', '7,10,13,11,18,18,11,8,6,5,5,5,9,334,', '6,9,9,9,18,18,11,8,6,5,5,5,9,465,', '10,13,14,13,27,28,17,11,10,8,7,7,10,356,', '7,9,9,9,17,18,11,10,7,9,8,5,9,341,', '6,9,9,9,17,18,11,8,7,5,5,5,8,334,', '7,9,9,9,17,18,11,8,7,5,5,5,9,333,', '6,9,9,9,17,18,11,8,7,5,5,5,9,332,', '6,9,9,9,17,18,11,7,7,5,5,5,9,329,', '6,9,9,9,17,18,11,12,10,12,8,7,13,512,', '10,13,15,13,24,23,14,8,8,5,5,5,9,379,', '7,9,9,9,18,18,11,8,7,5,5,5,9,332,', '7,9,10,9,18,18,11,8,7,5,7,8,13,488,', '10,13,14,13,25,28,17,13,9,7,6,6,9,335,', '7,9,9,13,27,27,19,13,7,5,5,9,15,530,', '8,11,12,10,22,18,11,8,7,5,5,5,9,335,', '7,9,9,9,17,18,11,8,6,5,5,5,9,330,', '6,9,9,9,39,18,11,8,7,5,5,5,9,348,', '6,9,13,11,18,18,11,8,6,6,8,8,13,561,', '10,13,14,13,27,26,15,11,9,7,6,5,9,332,', '6,9,9,9,18,18,11,8,7,5,5,5,9,333,', '7,9,9,9,17,18,11,8,6,5,5,5,9,996,', '10,13,14,13,78,98,14,15,12,8,8,8,15,828,', '10,13,15,14,31,32,18,13,12,8,10,9,12,593,', '14,16,17,13,28,28,17,12,18,13,12,14,28,712,', '10,11,12,11,22,23,14,10,8,6,5,5,9,635,', '15,22,27,13,24,26,12,8,7,5,5,5,9,358,', '7,9,10,9,18,18,12,8,7,5,5,5,9,414,', '7,9,10,9,18,18,12,8,7,5,6,5,9,336,', '7,10,13,10,18,18,11,8,7,5,5,5,9,346,', '7,9,10,9,36,44,12,13,15,10,12,11,24,466,', '7,9,10,9,19,19,12,8,7,5,5,5,10,388,', '7,9,9,9,63,34,20,11,9,7,6,7,8,315,', '7,9,9,9,18,18,11,8,7,5,5,5,9,498,', '10,14,14,13,48,19,11,8,7,5,5,5,9,315,', '6,9,9,9,17,19,12,8,12,5,5,5,9,323,', '6,9,10,9,17,18,11,8,6,5,5,5,8,345,', '6,9,9,13,35,18,11,8,7,5,5,5,9,331,', '6,9,10,9,17,18,11,8,7,5,5,5,9,455,', '8,9,9,9,18,18,11,8,7,5,5,5,9,339,', '6,9,9,9,17,18,11,8,12,7,5,5,9,333,', '7,9,9,9,17,18,11,8,7,5,5,5,9,332,', '6,10,9,9,18,18,11,8,7,5,5,5,9,333,', '6,10,9,9,17,18,11,8,7,5,5,5,9,468,', '10,9,9,9,17,18,11,8,7,5,5,5,9,338,', '7,10,9,9,18,18,11,8,13,5,5,5,9,335,', '7,9,9,10,18,18,11,8,6,5,5,5,9,332,', '6,9,9,9,18,18,11,8,7,5,5,5,9,358,', '6,9,9,9,17,18,11,8,7,5,5,5,9,370,', '6,9,9,9,18,18,11,8,8,5,5,5,9,334,', '6,9,9,9,18,18,11,8,7,5,5,5,9,337,', '7,9,9,9,18,18,11,8,8,5,5,5,9,334,', '7,9,9,9,18,18,11,8,7,5,5,5,9,337,', '7,9,9,13,26,34,17,12,10,8,8,8,12,660,', '10,13,11,11,18,20,18,13,13,8,8,5,8,379,', '6,9,9,9,18,18,30,8,6,5,5,5,9,335,', '7,9,10,9,17,28,17,12,10,8,7,8,13,629,', '12,57,14,11,22,48,12,8,6,5,5,5,9,342,', '6,9,11,9,17,18,11,8,79,5,5,5,9,333,', '6,9,9,9,18,18,11,8,7,5,5,5,9,336,', '7,9,11,12,39,49,14,12,10,8,8,8,13,514,', '10,13,13,15,42,28,17,12,8,6,6,7,11,385,', '6,9,9,9,18,17,12,8,7,5,5,5,8,335,', '7,9,9,9,54,18,12,11,9,8,8,8,13,505,', '9,10,10,13,25,24,13,15,8,7,6,6,12,442,', '7,9,9,9,18,17,11,8,7,5,5,5,9,337,', '6,9,9,9,18,18,11,12,11,8,7,8,13,511,', '10,14,13,12,52,21,12,8,17,9,8,8,13,567,', '9,12,12,10,18,18,11,8,7,5,5,5,9,337,', '7,9,9,9,17,18,11,8,10,7,8,8,13,509,', '10,14,14,14,42,25,13,9,7,5,6,6,9,341,', '7,14,14,18,28,27,17,12,10,8,8,8,13,442,', '9,10,11,17,54,18,11,8,6,5,6,5,13,494,', '9,11,12,11,23,52,11,8,7,5,5,5,9,355,', '7,9,10,23,50,34,17,11,10,8,7,7,11,396,', '7,9,9,8,18,27,26,8,6,5,5,5,9,365,', '6,9,9,9,18,18,11,8,7,5,5,5,9,345,', '7,9,9,9,17,18,12,8,14,8,5,5,9,333,', '6,9,9,8,17,18,11,8,7,5,11,9,13,491,', '10,10,10,9,18,18,11,8,7,5,5,5,9,335,', '6,9,9,9,45,32,16,11,10,8,8,9,13,492,', '10,12,13,11,20,23,11,8,7,6,5,5,9,359,', '7,9,9,9,128,18,12,8,6,5,5,5,9,338,', '7,9,9,9,17,18,11,7,8,5,5,5,9,558,', '10,13,14,13,27,28,17,12,10,7,8,8,15,390,', '7,9,9,9,17,19,11,13,7,5,5,5,9,340,', '7,9,9,9,18,19,11,8,6,5,7,11,13,552,', '11,14,14,13,27,26,15,11,10,8,7,6,9,334,', '6,9,9,9,18,28,17,12,12,11,8,8,13,499,', '11,13,13,10,19,18,11,8,7,5,5,5,9,337,', '6,9,9,15,18,18,11,8,6,5,5,5,9,337,', '7,9,10,9,18,18,11,8,7,5,5,5,9,357,', '6,9,9,8,17,18,11,8,7,5,5,5,9,345,', '7,9,9,9,18,18,11,14,7,5,5,5,9,334,', '6,9,9,9,18,18,11,8,7,5,5,5,9,333,', '7,9,15,9,18,18,11,8,7,5,5,5,8,341,', '7,9,9,10,18,32,11,8,7,5,5,5,71,369,', '6,9,10,9,18,18,11,8,6,5,5,5,9,336,', '7,9,11,9,17,18,11,8,7,5,5,5,8,338,', '7,9,9,9,17,18,11,8,7,5,5,5,9,332,', '7,10,14,13,27,28,17,11,10,7,8,7,11,482,', '10,10,11,10,18,19,11,8,7,5,5,5,9,337,', '7,9,10,8,17,18,12,8,6,5,5,5,9,333,', '6,9,9,8,18,66,17,11,11,7,8,8,13,459,', '10,14,15,15,28,22,14,8,7,5,5,5,9,372,', '6,9,9,9,18,18,11,8,7,5,5,5,9,338,', '6,9,9,9,18,18,11,8,10,10,8,8,13,578,', '9,13,14,13,32,30,14,10,7,6,5,5,14,334,', '6,9,10,9,47,18,11,7,7,5,5,5,9,425,', '11,13,16,120,79,76,11,8,7,5,5,7,13,382,', '7,9,9,9,18,18,11,8,7,5,8,8,14,337,', '7,15,14,13,27,23,11,8,7,5,5,5,9,339,', '10,13,14,13,27,27,17,13,9,6,7,7,12,569,', '8,10,11,9,17,18,11,12,11,9,9,9,14,810,', '11,12,14,13,117,1240,58,47,409,8,8,138,41,1361,', '11,14,15,13,18,22,12,8,7,5,6,6,10,354,', '7,9,10,12,34,38,17,14,13,8,7,6,12,542,', '11,16,17,14,36,36,17,11,7,13,5,5,17,510,', '12,15,23,9,18,18,11,8,7,9,7,7,12,346,', '7,9,10,9,18,35,17,13,13,8,8,8,15,463,', '8,10,12,13,43,39,33,13,12,8,9,9,17,569,', '7,10,10,10,54,131,18,14,8,6,8,11,17,550,', '7,10,10,15,103,114,24,35,8,9,10,10,58,554,', '7,10,11,11,27,21,17,12,7,6,10,11,9,813,', '8,14,30,33,42,89,19,14,15,9,8,8,16,543,', '11,13,15,13,35,36,18,13,40,9,9,8,16,555,', '11,13,15,14,37,37,40,14,14,8,9,9,24,722,', '13,14,27,14,110,75,15,12,18,13,9,9,17,660,', '11,14,98,44,114,101,66,14,14,9,10,9,33,673,', '13,11,17,17,46,65,63,9,10,7,9,9,16,542,', '8,10,11,10,20,21,12,9,7,6,6,6,12,616,', '15,39,79,13,40,39,29,11,12,7,7,7,15,409,', '10,11,12,11,32,33,14,11,15,8,8,8,17,411,', '9,10,12,9,19,20,12,8,7,6,6,6,9,347,', '7,9,15,14,25,25,15,11,9,6,5,5,9,576,', '11,15,12,10,40,42,27,14,13,8,9,9,16,600,', '12,16,12,12,42,44,23,17,14,8,8,7,14,460,', '11,13,15,13,36,34,14,11,11,6,6,7,14,411,', '9,10,14,13,37,50,14,12,12,9,9,8,16,493,', '11,13,15,13,37,35,14,11,11,7,7,6,14,423,', '9,11,12,10,33,33,16,13,17,11,9,6,9,575,', '13,15,17,10,22,20,13,9,11,7,8,8,16,473,', '9,10,12,10,32,33,14,14,11,9,9,7,9,414,', '10,48,15,16,94,22,13,9,8,6,6,6,10,368,', '7,10,10,9,20,24,13,9,7,6,5,6,9,365,', '7,10,10,9,20,21,12,8,7,6,5,5,9,366,', '7,10,10,10,20,21,12,11,7,6,6,6,10,371,', '7,11,11,11,20,21,12,9,7,6,6,6,9,366,', '8,11,12,11,34,34,14,11,11,7,7,6,13,397,', '9,10,11,10,32,31,13,10,10,6,6,6,13,387,', '8,9,11,10,31,31,13,10,10,6,6,6,12,368,', '6,9,9,9,17,18,11,8,7,5,5,5,8,362,', '7,9,9,9,17,18,11,8,7,5,5,5,9,400,', '6,9,9,9,18,18,11,8,6,5,5,5,9,334,', '6,9,9,9,18,18,11,8,6,6,5,5,9,338,', '7,9,9,9,17,18,11,8,6,5,5,5,9,341,', '7,9,9,9,18,23,11,8,7,5,5,5,9,334,', '7,9,9,9,18,17,11,8,7,5,5,5,9,398,', '8,9,9,13,17,49,26,17,17,13,13,11,21,657,', '7,10,9,9,17,18,12,8,7,5,5,5,9,482,', '8,9,9,9,18,18,11,8,7,5,5,5,9,333,', '60,9,9,9,17,18,11,8,7,5,5,5,9,338,', '6,9,9,9,17,18,11,8,7,5,5,5,9,333,', '6,9,9,9,17,18,11,8,7,5,5,5,9,345,', '6,9,9,9,18,18,14,10,10,6,6,6,12,372,', '8,9,11,9,18,18,11,8,7,6,5,5,8,338,', '7,9,9,9,17,18,11,8,7,6,5,5,9,334,', '7,9,9,9,17,18,11,8,7,5,6,10,9,337,', '7,9,9,9,18,18,11,8,7,5,5,5,9,317,', '6,9,10,9,18,18,12,8,7,5,6,9,16,506,', '10,13,14,12,27,28,17,12,9,6,6,6,9,582,', '11,12,16,15,44,39,16,10,10,6,6,6,13,362,', '8,9,11,9,30,30,13,11,10,6,6,6,12,437,', '12,13,16,13,49,49,16,12,11,12,12,10,15,723,', '11,11,11,10,21,24,12,9,8,10,10,8,12,601,', '9,10,10,14,38,234,12,9,10,8,10,9,9,403,', '129,14,10,14,55,46,16,137,13,14,11,10,137,901,', '12,14,11,10,43,35,27,9,9,9,9,7,16,602,', '14,19,22,15,35,36,13,11,10,6,6,9,16,531,', '11,13,15,13,35,38,13,13,12,8,6,6,10,360,', '7,10,10,10,21,21,12,9,8,6,5,6,10,355,', '7,14,15,14,25,20,13,9,8,6,10,8,16,584,', '10,12,13,13,33,35,14,12,13,10,10,10,14,415,', '9,10,12,11,33,34,15,11,11,7,7,7,14,466,', '18,13,13,12,25,25,21,16,17,10,9,8,17,531,', '11,11,13,16,37,40,23,88,129,97,8,11,50,1606,', '12,15,16,16,58,134,57,14,13,8,12,10,38,544,', '11,14,15,13,338,37,19,13,13,11,11,9,16,678,', '15,15,14,13,51,111,18,15,15,112,9,9,16,866,', '109,17,17,15,95,48,35,155,13,95,87,9,106,1179,', '12,14,17,25,39,34,15,16,14,11,10,10,18,812,', '14,17,15,25,165,36,14,11,11,7,6,7,13,400,', '9,10,14,10,31,33,14,11,11,7,6,7,26,481,', '9,10,12,9,31,32,14,11,10,6,6,6,13,367,', '8,10,11,10,30,31,13,10,10,6,6,6,13,387,', '7,10,9,11,18,18,19,15,15,9,8,9,29,656,', '13,14,15,14,134,168,70,877,77,9,12,10,25,585,', '9,11,12,11,42,50,23,17,13,9,9,9,16,526,', '11,13,18,18,31,30,16,12,9,8,7,9,16,610,', '77,154,47,14,42,47,18,11,12,8,8,8,14,500,', '8,130,16,15,46,110,507,53,14,8,7,9,16,892,', '9,12,13,10,33,34,14,12,12,7,7,7,14,432,', '8,10,11,10,32,32,13,10,10,7,6,6,13,391,', '8,22,26,21,115,51,26,17,17,10,9,8,17,518,', '10,10,12,10,30,31,14,10,10,6,6,6,12,382,', '8,10,11,9,30,31,13,10,10,6,6,6,13,347,', '7,10,9,9,18,18,11,8,7,5,5,5,9,342,', '7,9,11,10,30,31,13,10,10,6,6,6,12,383,', '7,9,9,9,18,19,14,13,7,5,6,5,9,339,', '7,9,9,9,18,19,11,8,7,8,12,12,16,553,', '11,13,13,12,26,27,16,10,8,6,5,5,9,340,', '6,9,9,17,36,33,20,16,11,9,9,9,13,465,', '10,13,11,10,18,19,12,8,7,5,5,11,20,595,', '11,16,14,12,24,28,16,12,9,6,6,6,9,357,', '7,9,9,9,41,41,23,14,13,8,9,9,13,457,', '9,11,12,14,28,28,17,12,8,6,6,6,9,337,', '7,9,9,8,18,19,11,8,7,6,5,5,9,344,', '7,9,9,9,18,18,11,8,7,5,5,5,9,340,', '7,9,10,8,18,18,11,8,7,5,5,5,9,361,', '7,9,10,9,18,18,12,8,7,5,5,5,9,340,', '7,9,10,9,18,18,11,8,8,5,5,5,9,343,', '7,9,10,9,18,19,11,8,7,5,5,5,9,331,', '7,9,9,8,17,18,11,8,7,5,5,5,9,339,', '7,9,9,8,18,18,11,8,7,5,5,5,9,335,', '6,9,9,9,17,18,17,11,10,8,8,8,13,468,', '10,13,15,14,29,30,18,13,11,7,7,7,12,432,', '9,12,13,12,23,24,14,10,8,6,6,5,9,336,', '6,9,9,9,17,18,11,8,6,5,5,5,9,335,', '7,9,9,9,18,18,10,19,11,8,8,8,13,458,', '8,17,28,21,50,32,14,9,12,9,7,9,96,1411,', '11,49,14,59,41,40,19,15,14,9,50,9,16,546,', '7,11,17,13,74,18,12,8,7,5,5,5,9,337,', '7,9,9,9,19,63,40,24,23,9,10,9,14,681,', '13,13,14,13,36,39,17,9,7,6,6,6,9,404,', '7,9,10,10,18,69,27,12,55,8,6,7,9,340,', '7,9,10,14,42,80,13,14,24,12,7,7,11,517,', '9,12,12,9,19,19,12,8,7,5,5,5,9,350,', '9,9,9,9,18,19,12,8,7,8,11,11,15,485,', '9,11,12,14,23,33,11,8,7,5,5,5,9,330,', '6,9,10,16,27,27,17,12,10,8,8,8,13,453,', '9,11,11,10,18,19,11,8,7,5,5,5,14,474,', '10,14,14,13,27,28,17,12,9,7,7,7,12,338,', '7,9,9,9,17,18,12,8,6,5,5,5,9,320,', '7,9,9,9,18,18,11,8,7,11,8,8,14,611,', '9,13,14,13,29,30,14,10,8,6,6,5,9,338,', '6,9,9,9,18,18,11,8,6,5,5,5,9,334,', '6,9,9,9,18,18,11,8,6,5,5,11,15,497,', '10,14,15,14,24,24,15,11,9,7,8,7,10,339,', '6,9,9,9,18,18,11,8,7,5,5,8,13,590,', '10,13,14,14,244,23,15,10,8,6,7,5,9,336,', '6,9,10,10,17,18,11,8,7,5,5,5,9,335,', '7,9,9,9,18,18,11,8,6,5,5,5,9,566,', '6,9,9,9,17,18,11,8,6,5,5,5,9,330,', '7,11,9,9,17,18,103,8,7,5,5,5,8,344,', '6,9,9,9,18,18,11,8,6,5,5,5,9,447,', '118,13,15,13,27,27,16,12,7,5,5,5,9,322,', '7,9,10,9,28,32,11,8,6,5,5,8,9,411,', '9,11,12,10,18,18,11,8,6,5,5,5,9,390,', '10,13,11,10,143,53,11,8,6,5,5,5,9,325,', '6,9,9,9,17,18,11,8,7,6,5,5,9,442,', '7,10,9,9,17,18,11,8,6,5,5,5,9,331,', '6,9,9,13,27,27,17,12,10,8,5,5,9,472,', '10,13,15,13,31,25,16,9,8,6,5,8,13,472,', '10,13,10,9,18,18,11,8,7,5,5,5,8,322,', '7,9,9,17,33,28,17,12,10,8,8,6,9,429,', '9,12,10,8,18,18,11,8,7,5,5,5,9,448,', '10,13,10,8,18,18,11,8,6,5,5,5,9,334,', '7,9,9,9,18,18,11,8,16,10,8,8,13,505,', '7,9,9,9,18,18,11,8,7,5,5,5,9,336,', '6,9,9,9,18,18,11,8,14,6,5,5,9,339,', '7,9,9,8,18,18,11,8,7,5,5,5,9,334,', '6,9,10,9,18,18,11,8,7,8,8,8,13,491,', '10,14,14,12,27,28,15,10,8,5,5,8,13,340,', '6,9,9,9,17,17,11,8,7,5,5,5,9,364,', '6,9,9,8,18,18,92,11,10,8,8,8,13,509,', '9,13,14,14,29,22,13,10,7,5,5,5,9,449,', '8,9,9,9,17,18,11,8,7,5,5,5,9,330,', '7,9,13,13,27,27,17,12,11,5,5,5,8,341,', '7,9,9,9,18,18,11,8,7,5,5,5,9,452,', '10,13,14,10,52,18,11,8,8,8,8,8,13,529,', '10,12,13,13,44,25,12,9,7,5,5,94,9,338,', '7,9,9,9,17,27,17,12,10,8,8,10,14,493,', '10,14,15,13,104,25,12,8,7,5,5,5,9,336,', '6,9,9,9,17,18,11,8,8,11,8,8,13,549,', '7,9,9,9,18,18,11,8,7,5,5,6,13,484,', '10,14,14,13,24,27,13,10,10,6,6,6,10,381,', '7,9,9,9,17,18,11,8,6,5,6,5,9,337,', '6,9,10,8,17,46,17,12,10,7,8,8,13,503,', '9,11,11,11,18,37,11,8,6,5,9,5,9,333,', '6,9,9,8,18,18,11,8,6,6,5,5,9,416,', '7,9,9,9,34,18,11,8,7,5,5,5,8,342,', '6,9,9,9,18,18,11,8,8,5,5,5,9,540,', '10,13,14,14,27,29,17,11,9,8,8,7,11,384,', '6,9,10,11,18,18,11,8,7,5,5,5,9,347,', '7,9,10,8,18,18,11,8,7,5,5,5,8,349,', '6,104,9,8,18,18,11,8,7,5,5,5,8,353,', '6,9,9,9,18,18,11,8,7,5,5,5,38,509,', '10,13,14,15,27,28,15,11,10,8,8,6,11,407,', '6,9,9,9,18,18,11,8,7,5,5,5,9,338,', '7,9,13,13,40,27,17,11,7,5,5,5,9,448,', '7,14,14,9,18,18,12,8,7,5,5,5,9,407,', '7,9,9,9,18,19,11,11,13,8,7,8,13,420,', '6,9,9,9,17,18,11,8,6,5,5,5,9,487,', '10,13,9,8,17,18,11,8,7,8,9,5,9,339,', '6,9,9,8,35,37,16,12,12,147,8,6,11,419,', '8,10,9,8,17,18,11,8,9,7,11,6,9,336,', '7,9,9,11,38,23,14,10,8,6,5,5,9,336,', '6,9,12,11,22,18,11,10,8,6,6,6,11,425,', '7,9,9,9,18,19,11,8,7,5,5,5,9,377,', '14,13,17,13,24,23,17,8,7,5,5,5,9,329,', '7,9,10,10,18,19,11,8,18,8,8,8,13,604,', '9,10,10,9,18,18,11,8,7,5,5,5,9,356,', '7,9,9,11,18,18,11,8,11,9,8,8,13,487,', '10,14,14,11,24,19,11,8,6,5,5,6,9,419,', '164,14,14,13,18,18,17,12,9,6,6,6,11,346,', '6,9,9,10,40,38,17,13,10,8,9,6,11,412,', '6,9,9,8,18,18,11,8,7,5,5,5,9,494,', '9,13,14,14,31,50,14,10,8,6,6,5,9,334,', '7,9,9,9,18,18,26,14,10,8,7,8,14,373,', '8,11,11,9,18,18,11,8,7,5,5,5,8,337,', '7,16,14,13,27,27,16,11,6,5,5,5,9,351,', '6,9,9,9,18,18,11,8,7,5,5,8,15,749,', '9,13,14,14,27,29,18,11,9,5,5,5,9,349,', '6,9,10,8,17,18,11,12,10,8,8,8,13,448,', '7,9,14,13,27,28,17,12,9,8,7,7,11,341,', '7,9,9,9,17,18,11,8,7,5,5,5,9,336,', '7,10,10,9,17,18,11,8,7,5,5,5,9,337,', '6,9,9,9,18,18,11,8,7,5,5,5,9,337,', '7,9,9,9,17,18,12,11,7,5,5,5,13,483,', '6,9,9,9,18,19,11,8,7,5,5,5,9,357,', '7,9,9,9,17,18,11,8,6,5,5,5,9,333,', '7,9,9,9,18,46,17,12,11,8,7,5,9,340,', '7,9,10,9,18,19,11,8,7,5,5,5,9,334,', '6,9,9,9,18,55,16,8,7,5,5,5,9,341,', '6,10,9,9,18,18,11,8,7,5,5,5,9,387,', '6,9,9,9,18,18,11,8,7,5,5,5,9,344,', '6,9,9,8,18,18,11,8,7,5,5,5,9,340,', '6,9,9,8,18,18,11,8,7,5,5,5,9,392,', '10,13,14,13,28,62,11,8,6,5,5,5,9,336,', '6,9,9,8,17,18,11,8,7,5,5,5,9,372,', '6,9,10,8,17,18,11,8,6,5,5,5,9,335,', '6,9,9,9,18,18,11,8,6,5,5,5,9,340,', '7,9,9,9,17,18,11,8,7,5,5,5,9,335,', '7,9,9,9,18,17,11,8,59,6,8,8,15,481,', '7,15,22,22,34,33,16,13,13,9,8,6,9,1095,', '8,10,15,15,96,36,23,16,13,9,6,6,14,428,', '123,15,16,16,33,37,18,13,9,7,7,7,12,446,', '7,11,22,14,40,38,13,9,8,7,9,9,12,647,', '117,17,20,18,120,50,25,16,14,9,10,8,15,804,', '8,15,16,137,37,45,18,15,14,8,6,6,17,656,', '13,14,13,15,21,21,12,9,7,6,6,6,10,360,', '7,11,12,10,37,21,13,11,9,9,9,9,16,402,', '7,9,11,10,20,20,12,9,7,5,6,6,10,350,', '7,9,10,9,19,20,12,8,14,9,9,9,10,351,', '7,10,11,10,21,21,12,8,7,6,6,6,10,344,', '7,10,10,9,19,20,12,8,7,5,5,5,9,340,', '7,10,10,9,19,30,14,8,7,6,5,5,9,384,', '7,10,10,9,18,20,12,8,7,6,5,5,9,338,', '7,10,10,9,40,38,14,14,8,5,5,6,9,346,', '7,10,11,10,36,38,18,13,13,9,9,9,17,579,', '12,14,21,13,37,21,13,10,13,9,9,9,11,360,', '7,10,11,10,20,21,13,9,11,6,6,6,10,352,', '8,10,11,11,55,21,13,9,8,8,6,6,10,358,', '8,11,10,24,28,29,15,11,7,6,6,6,9,338,', '11,16,17,15,23,24,14,10,9,7,7,5,9,329,', '6,9,10,9,18,19,11,8,7,5,5,5,9,325,', '7,9,10,9,18,19,11,8,15,12,10,8,14,538,', '9,12,11,10,32,22,14,9,7,6,5,5,9,347,', '7,21,22,17,32,35,18,13,11,8,7,7,13,456,', '9,11,11,9,18,18,11,8,7,6,5,5,9,321,', '7,9,10,9,18,19,11,8,7,5,5,5,9,323,', '7,9,9,9,18,41,26,16,10,9,8,8,15,449,', '9,13,14,11,23,21,13,9,6,5,5,5,9,342,', '7,9,10,9,18,19,11,8,7,6,5,5,9,341,', '7,9,9,9,18,18,12,8,7,8,12,11,16,557,', '11,12,13,13,26,27,17,13,9,6,6,5,9,344,', '7,9,10,9,18,19,11,8,6,5,5,5,9,342,', '7,9,9,9,18,18,11,8,7,5,5,5,9,402,', '6,9,9,9,18,18,11,8,6,5,5,5,9,341,', '6,9,9,9,18,18,11,8,7,5,5,5,9,373,', '6,12,14,13,18,18,11,8,6,5,5,5,9,331,', '7,8,14,13,18,18,11,8,6,5,5,5,9,337,', '6,9,10,9,18,19,11,8,7,5,5,5,12,484,', '10,9,9,9,17,18,11,8,7,5,5,5,9,332,', '7,9,9,9,17,18,11,8,6,5,5,5,9,339,', '7,9,9,9,17,18,11,8,7,5,5,5,9,329,', '7,9,9,9,17,18,11,8,6,5,5,5,9,334,', '7,9,9,9,18,18,11,8,7,5,5,5,13,534,', '10,13,14,14,29,28,16,11,9,8,8,6,10,350,', '7,10,9,9,37,18,11,8,7,5,5,5,9,335,', '7,10,9,9,18,18,11,8,7,5,5,5,9,411,', '12,14,16,14,44,46,52,15,16,10,8,7,13,478,', '9,12,12,11,24,24,15,44,9,7,9,8,13,472,', '10,14,15,11,24,24,15,9,8,6,5,5,9,335,', '7,15,14,13,27,28,17,12,10,8,8,8,13,492,', '8,10,11,9,18,18,11,8,6,5,8,8,13,493,', '11,15,13,12,25,26,17,12,9,6,6,6,9,339,', '7,9,12,13,27,27,17,12,10,8,8,8,12,466,', '10,14,11,11,22,19,11,9,7,9,7,8,52,497,', '10,13,12,12,18,38,18,16,16,11,7,6,11,399,', '6,12,9,9,18,35,18,13,13,9,8,8,15,406,'],
        };
        bmak.mr = Obj.mr_dict[Math.floor(Math.random() * (45 - 2 + 1) + 2)];
    },

    get_h: function() {
        ms_from_start2 = Math.floor(Math.random() * (3 - 1 + 1) + 1) + delay_2;
        bmak.d2 = parseInt(bmak.z1 / 23);
        var d2_2 = parseInt(bmak.d2 / 6);
        u = bmak.jrs(bmak.start_ts);
        var vel_sum =
            bmak.ke_vel +
            bmak.me_vel +
            bmak.doe_vel +
            bmak.dme_vel +
            bmak.te_vel +
            bmak.pe_vel;
        h = [
            bmak.ke_vel + 1,
            bmak.me_vel + 32,
            bmak.te_vel + 32,
            bmak.doe_vel,
            bmak.dme_vel,
            bmak.pe_vel,
            vel_sum,
            ms_from_start1,
            bmak.init_time,
            bmak.start_ts,
            bmak.fpcf.td,
            bmak.d2,
            bmak.ke_cnt,
            bmak.me_cnt,
            d2_2,
            bmak.pe_cnt,
            bmak.te_cnt,
            ms_from_start2,
            bmak.ta,
            bmak.n_ck,
            bmak._abck,
            bmak.ab(bmak._abck),
            bmak.fpcf.rVal,
            bmak.fpcf.rCFP,
            bmak.fas,
            "PiZtE",
            u[0],
            u[1],
        ];
        h = h.join(",");
        return h;
    },

    deviceact: function() {
        do_ = Math.floor(Math.random() * (50 - 15 + 1)) + 15;
        if (do_ < 25) {
            bmak.doact = "";
            bmak.doe_vel = 0;
            bmak.dmact = "";
            bmak.dme_vel = 0;
            bmak.ta = 0;
        } else {
            doacttime = Math.floor(Math.random() * (310 - 50 + 1)) + 50;
            bmak.doact = "0," + doacttime + ",-1,-1,-1;";
            bmak.doe_vel = doacttime;
            bmak.ta = bmak.ta + doacttime;

            dmactime = doacttime - Math.floor(Math.random() * (60 - 5 + 1)) + 5;
            bmak.dmact = "0," + dmactime + ",-1,-1,-1,-1,-1,-1,-1,-1,-1;";
            bmak.dme_vel = dmactime;
            bmak.ta = bmak.ta + dmactime;
        }
    },

    fpcf: {
        fpValstr: "-1",
        rVal: "-1",
        rCFP: "-1",
        td: -999999,
        fpVal: function() {
            var Obj,
                i,
                x = "";
            Obj = {
                rCFP_dict: bmak.fp_array,
            };
            bmak.fpcf.rVal = Math.floor(Math.random() * (1000 - 1 + 1)) + 1;
            bmak.fpcf.rCFP = Obj.rCFP_dict[bmak.fpcf.rVal];
            bmak.fpcf.td = Math.floor(Math.random() * (23 - 17 + 1)) + 17;
        },
    },
};

function browser_delay(post) {
    function random_item(items) {
        return items[Math.floor(Math.random() * items.length)];
    }
    var first_delays = [3, 4];
    var second_delays = [5, 6, 7];

    function calc_1() {
        delay_1 = random_item(first_delays);
        delay_2 = random_item(second_delays);
    }

    function calc_2() {
        delay_1 = Math.floor(Math.random() * (750 - 550 + 1) + 550);
        delay_2 = delay_1 + Math.floor(Math.random() * (5 - 1 + 1) + 1);
    }
    if (post == 1) {
        calc_1();
        delay_1 == delay_2 ? calc_1 : null;
    } else if (post == 2) {
        calc_2();
        delay_1 == delay_2 ? calc_2 : null;
    }
};

function create_sensor(post, cookie) {
    post == 1 ? browser_delay(1) : null;
    post == 2 ? browser_delay(2) : null;
    post == 2 ? bmak.fpcf.fpVal() : null;
    post == 2 ? bmak.getmr() : null;
    post == 2 ? bmak.deviceact() : null;
    //post == 2 ? (bmak.nav_perm = "10321144241322243122") : null;

    bmak._abck = cookie;
    t = bmak.get_cf_date();
    ms_from_start1 = Math.floor(Math.random() * (3 - 1 + 1) + 1) + delay_1;
    aj_count = bmak.aj_type + "," + bmak.aj_indx;
    challenge_C = "";
    challenge_j = "";
    challenge_M = "";

    let sensor_data = 1.63;
    sensor_data += "-1,2,-94,-100," + bmak.gd();
    sensor_data += "-1,2,-94,-101," + bmak.device_events;
    sensor_data += "-1,2,-94,-105," + bmak.informinfo;
    sensor_data += "-1,2,-94,-102," + bmak.informinfo2;
    sensor_data += "-1,2,-94,-108," + bmak.kact;
    //generate_mact();
    // console.log(bmak.webglRender);
    sensor_data += "-1,2,-94,-110," + bmak.mact;
    sensor_data += "-1,2,-94,-117," + bmak.tact;
    sensor_data += "-1,2,-94,-111," + bmak.doact;
    sensor_data += "-1,2,-94,-109," + bmak.dmact;
    sensor_data += "-1,2,-94,-114," + bmak.pact;
    sensor_data += "-1,2,-94,-103," + bmak.vcact;
    sensor_data += "-1,2,-94,-112," + bmak.getdurl;
    sensor_data += "-1,2,-94,-115," + bmak.get_h();
    sensor_data += "-1,2,-94,-106," + aj_count;
    sensor_data += "-1,2,-94,-119," + bmak.mr;
    sensor_data += "-1,2,-94,-122," + bmak.sed;
    sensor_data += "-1,2,-94,-123," + challenge_C;
    sensor_data += "-1,2,-94,-124," + challenge_j;
    sensor_data += "-1,2,-94,-126," + challenge_M;
    sensor_data += "-1,2,-94,-127," + bmak.nav_perm;

    sd_hash = 24 ^ bmak.ab(sensor_data);

    sensor_data += "-1,2,-94,-70," + bmak.fpcf.fpValstr;
    sensor_data += "-1,2,-94,-80," + "" + bmak.ab(bmak.fpcf.fpValstr);
    sensor_data += "-1,2,-94,-116," + bmak.o9;
    sensor_data += "-1,2,-94,-118," + sd_hash;
    sensor_data += "-1,2,-94,-129," + bmak.webglRender;
    sensor_data += "-1,2,-94,-121,";

    var L = bmak.od(bmak.cs, bmak.api_public_key).slice(0, 16),
        T = Math.floor(bmak.get_cf_date() / 36e5),
        P = bmak.get_cf_date(),
        F = L + bmak.od(T, L) + sensor_data;

    if (post == 1) {
        ts = bmak.get_cf_date() - t + Math.floor(Math.random() * (11 - 5 + 1) + 5);
    } else {
        ts = ts - Math.floor(Math.random() * (4 - 3 + 1) + 3);
        bmak.tst = ts + Math.floor(Math.random() * (9 - 4 + 1) + 6);
    }
    sensor_data = F + ";" + ts + ";" + bmak.tst + ";" + (bmak.get_cf_date() - P);

    return sensor_data;
};

function getRandomInt(min, max) {
    min = Math.ceil(min);
    max = Math.floor(max);
    return Math.floor(Math.random() * (max - min + 1)) + min;
};

function main(cookie) {
    bmak.aj_type = 0;
    bmak.to();
    sensor_data = create_sensor(1, cookie);

    function inner(cookie) {
        bmak.aj_type = 9;
        bmak.aj_indx = 1;
        sensor_data = create_sensor(2, cookie);
    }
    return {
        inner: inner,
    };
};

async function create_w_cook(abck) {
    var cnt = -1;
    var arr = [];
    var items = fs.readdirSync("/var/www/newdata/");
    for (const dirent of items) {
        arr.push(dirent);
        cnt++;
    }
    arr_cnt = getRandomInt(0, cnt);
    file = arr[arr_cnt];
    var data = fs.readFileSync("/var/www/newdata/" + file, "utf8");
    //console.log(data);
    const obj = JSON.parse(data);
    bmak.user_agent = obj.ua;
    bmak.screen_info = obj.gd1;
    bmak.bd = obj.bd1;
    bmak.fp_array = obj.c3.split(",");
    bmak.webglRender = obj.webglRender;
    var generate = main(abck);
    sd = '{"sensor_data":"' + sensor_data + '"}';
    bmak.fpcf.fpValstr = obj.fcrp;
    generate.inner(abck);
    return sensor_data; //post_data(bm, sd, generate, abck)
};

function getcookie(req) {
    var cookie = req.headers.cookie;
    arr = cookie.split("; ");
    return arr;
};

const mariadb = require("mariadb");
const { Console } = require("console");

const pool = mariadb.createPool({
    host: "localhost",
    user: "carter",
    password: "Pointer7*",
    database: "api",
    connectionLimit: 5,
});

async function users() {
    let conn;
    try {
        conn = await pool.getConnection();
        const rows = await conn.query("SELECT * FROM `akamai`");
        let authPeople = [];
        rows.forEach((row) => {
            authPeople.push(row.auth);
        });
        return authPeople;
    } catch (err) {
        throw err;
    } finally {
        if (conn) conn.release();
    }
};

async function getIP(userIP) {
    let conn;
    try {
        conn = await pool.getConnection();
        const rows = await conn.query("SELECT * FROM `akamai` where ip_address = ?", [userIP]);
        let authPeople = [];
        rows.forEach((row) => {
            authPeople.push(row.ip_address);
        });
        return authPeople;
    } catch (err) {
        throw err;
    } finally {
        if (conn) conn.release();
    }
};
async function configsPerUser(user) {
    let conn;
    try {
        conn = await pool.getConnection();
        const rows = await conn.query("SELECT * FROM `akamai` WHERE auth = ? LIMIT 1", [user]);

        let cfgsAllowed = [];
        if (rows.length > 0) {
            let cfgs = rows[0].configs.split('|');
            cfgs.forEach((cfg) => {
                cfgsAllowed.push(cfg);
            });
            return cfgsAllowed;
        } else {
            return 'Error getting user data.';
        }

    } catch (err) {
        throw err;
    } finally {
        if (conn) conn.release();
    }
};

async function getUsername(key) {
    let conn;
    try {
        conn = await pool.getConnection();
        const rows = await conn.query("SELECT * FROM `akamai` WHERE auth = ? LIMIT 1", [key]);

        if (rows.length !== 1) {
            return 'Error getting username.';
        } else {
            return rows[0].disc_or_tele;
        }
    } catch (err) {
        throw err;
    } finally {
        if (conn) conn.release();
    }
};

async function configs() {
    let conn, resultData = [];
    try {
        conn = await pool.getConnection();
        const sites = await conn.query("SELECT * FROM `sites`");

        sites.forEach(site => {
            resultData.push({
                id: site.id,
                url: site.url,
                informinfo: site.informinfo,
                informinfo2: site.informinfo2
            })
        });

        return resultData;

    } catch (err) {
        throw err;
    } finally {
        if (conn) conn.release();
    }
};

async function addErrorSite(url, key, ip) {
    let conn;
    try {
        conn = await pool.getConnection();
        await conn.query("INSERT INTO `sites404` (`id`, `url`) VALUES (NULL, ?);", [url]);
        console.log(`[`.magenta + `${date_ob.getHours()}:${date_ob.getMinutes()}:${date_ob.getSeconds()}` + `]`.magenta + `[`.magenta + `FAIL`.brightRed + `]`.magenta + `[`.magenta + `NOT_IN_DB`.brightRed + `]`.magenta + `[`.magenta + `Key: ${key} | Site: ${url} | IP: ${ip}`.white + `]`.magenta);
    } catch (err) {
        throw err;
    } finally {
        if (conn) conn.release();
    }
};

function occurrences(string, subString, allowOverlapping) {

    string += "";
    subString += "";
    if (subString.length <= 0) return (string.length + 1);

    var n = 0,
        pos = 0,
        step = allowOverlapping ? 1 : subString.length;

    while (true) {
        pos = string.indexOf(subString, pos);
        if (pos >= 0) {
            ++n;
            pos += step;
        } else break;
    }
    return n;
}
app.use(requestIp.mw())
app.post("/bypass", jsonParser, async function(req, res, next) {
        var value = req.headers['x-forwarded-for'];
        date_ob = new Date();
        abck = req.body.abck;
        var url = req.body.url;
        console.log(url);
        key = req.body.key;
        if (!key || !url) {
            return console.log(`[`.magenta + `${date_ob.getHours()}:${date_ob.getMinutes()}:${date_ob.getSeconds()}` + `]`.magenta + `[`.magenta + `FAIL`.brightRed + `]`.magenta + `[`.magenta + `UNAUTHORIZED`.brightRed + `]`.magenta + `[`.magenta + `Key: ${key} | Site: ${url} | IP: ${value}`.white + `]`.magenta);
        }
        var x = occurrences(req.headers['x-forwarded-for'], ",");
        if (x >= 2) {
            console.log(`[`.magenta + `${date_ob.getHours()}:${date_ob.getMinutes()}:${date_ob.getSeconds()}` + `]`.magenta + `[`.magenta + `SECURITY`.brightRed + `]`.magenta + `[`.magenta + `ATTEMPT_XFF`.brightRed + `]`.magenta + `[`.magenta + `Key: ${key} | Site: ${url} | IP: ${value}`.white + `]`.magenta);
            return res.json({ error: "Invalid IP Bind!" });
        }

        let arr2 = await getIP(value);
        if (!arr2.includes(value)) {
            console.log(`[`.magenta + `${date_ob.getHours()}:${date_ob.getMinutes()}:${date_ob.getSeconds()}` + `]`.magenta + `[`.magenta + `SECURITY`.brightRed + `]`.magenta + `[`.magenta + `INVALID_IP`.brightRed + `]`.magenta + `[`.magenta + `Key: ${key} | Site: ${url} | IP: ${value}`.white + `]`.magenta);
            return res.json({ error: "Invalid IP Authentication" });
        }

        let arr = await users();
        if (!arr.includes(key)) {
            console.log(`[`.magenta + `${date_ob.getHours()}:${date_ob.getMinutes()}:${date_ob.getSeconds()}` + `]`.magenta + `[`.magenta + `FAIL`.brightRed + `]`.magenta + `[`.magenta + `UNAUTHORIZED`.brightRed + `]`.magenta + `[`.magenta + `Key: ${key} | Site: ${url} | IP: ${value}`.white + `]`.magenta);
            sensor = "Unauthorized";
            sensor_data = {
                error: sensor,
            };
            next();
        } else {
            let configsByUser = await configsPerUser(key);
            let authorized = false;
            configsByUser.forEach(config => {
                if (config.includes(url) || config.includes('all')) {
                    authorized = true;
                }
            });
            if (!authorized) {
                sensor = "Not Authorized.";
                sensor_data = {
                    error: sensor,
                };
                next();
            } else {
                if (typeof abck == "undefined") {
                    console.log(`[`.magenta + `${date_ob.getHours()}:${date_ob.getMinutes()}:${date_ob.getSeconds()}` + `]`.magenta + `[`.magenta + `FAIL`.brightRed + `]`.magenta + `[`.magenta + `UNAUTHORIZED`.brightRed + `]`.magenta + `[`.magenta + `${key}`.white + `]`.magenta);
                    sensor = "Try running GetURL API First.";
                    sensor_data = {
                        error: sensor,
                    };
                    next();
                } else {
                    var myObj = { sites: [] },
                        i, j, x = "";
                    myObj.sites = await configs();
                    var ok;
                    for (i in myObj.sites) {
                        if (url == myObj.sites[i].url) {
                            ok = 1;
                            bmak.informinfo = myObj.sites[i].informinfo;
                            bmak.informinfo2 = myObj.sites[i].informinfo2;
                        } else {
                            null;
                        }
                    }
                    if (ok == 1) {
                        console.log(`[`.magenta + `${date_ob.getHours()}:${date_ob.getMinutes()}:${date_ob.getSeconds()}` + `]`.magenta + `[`.magenta + `OK`.brightGreen + `]`.magenta + `[`.magenta + `${url}`.white + `]`.magenta + `[`.magenta + `${await getUsername(key)}`.white + `]`.magenta);
                        bmak.getdurl = url;

                        create_w_cook(abck).then((bar) => {
                            sensor = bar;
                            sensor_data = {
                                sensor_data: sensor,
                            };
                            next();
                        });
                    } else {
                        console.log(`[`.magenta + `${date_ob.getHours()}:${date_ob.getMinutes()}:${date_ob.getSeconds()}` + `]`.magenta + `[`.magenta + `FAIL`.brightRed + `]`.magenta + `[`.magenta + `${url}`.brightRed + `]`.magenta + `[`.magenta + `${key}`.white + `]`.magenta);

                        addErrorSite(url, key, value);

                        sensor = "This URL isn't in our database.";
                        sensor_data = {
                            error: sensor,
                        };

                        next();
                    }
                }
            }
        }
    },
    function(req, res, next) {
        res.json(sensor_data);
    }
);

app.post('/bootstrap/1', jsonParser, (req, res) => {
    let value = req.clientIp;

    var bodyTest = JSON.stringify(req.body);
    const data = {
        fcrp: req.body.fcrp,
        ua: req.body.ua,
        psub: req.body.psub,
        np: req.body.np,
        bd1: req.body.bd1,
        fas1: req.body.fas1,
        gd1: req.body.gd1,
        prod: req.body.prod,
        automation: req.body.automation,
        mouseRes: req.body.mouseRes,
        xagg: req.body.xagg,
        dm: req.body.dm,
        c3: req.body.c3,
        mr: req.body.mr,
        fpvalstr: req.body.fpvalstr,
        webglRender: req.body.webglRender
    }

    try {
        if (!data.fcrp.startsWith('6713341784;;') || data.fcrp == null || data.ua == null || data.psub == null || data.np == null || data.bd1 == null || data.fas1 == null || data.gd1 == null || data.prod == null || data.automation == null || data.mouseRes == null || data.xagg == null || data.dm == null || data.c3 == null || data.mr == null || data.fpvalstr == null || data.webglRender == null || data.xagg != 12147) {
            return res.status(200).json({ status: true })
        } else {
            console.log(`${value} | Success`.green)
        }
    } catch {
        let value = req.clientIp;
        console.log(`${value} | Denied`.red);
        return res.status(200).json({ status: true })
    }

    const encodedData = Buffer.from(value).toString('base64');
    fs.writeFile(`/var/www/newdata/${encodedData}.txt`, bodyTest.replace('6713341784;;', ''), function(err) {
        if (err) { return res.status(200).json({ status: true }) }
    })

    return res.status(200).json({ status: true });
});

app.post('/bootstrap_theme', jsonParser, (req, res) => {
    console.log(true)
    return res.status(200).json({ status: true })
});

app.get("/api/cjakshd738y", jsonParser, async function(req, res) {
    const { exec } = require("child_process");
    exec("tree /var/www/newdata/ | tail -1", (error, stdout, stderr) => {
        if (error) {
            console.log(`error: ${error.message}`);
            return;
        }
        if (stderr) {
            console.log(`stderr: ${stderr}`);
            return;
        }
        let b = stdout.replace("0 directories, ", "")
        res.status(200).json({ data: b.replace(" files\n", "") })
    });
});

let date_ob = new Date();
app.listen(PORT, () =>
    console.log(`[`.green + `${date_ob.getHours()}:${date_ob.getMinutes()}:${date_ob.getSeconds()}`.bold + `]`.green + ` [1.63] Server connected to http://localhost:${PORT}`.brightGreen)
);
 

Javascript Online Compiler

Write, Run & Share Javascript code online using OneCompiler's JS online compiler for free. It's one of the robust, feature-rich online compilers for Javascript language. Getting started with the OneCompiler's Javascript editor is easy and fast. The editor shows sample boilerplate code when you choose language as Javascript and start coding.

About Javascript

Javascript(JS) is a object-oriented programming language which adhere to ECMA Script Standards. Javascript is required to design the behaviour of the web pages.

Key Features

  • Open-source
  • Just-in-time compiled language
  • Embedded along with HTML and makes web pages alive
  • Originally named as LiveScript.
  • Executable in both browser and server which has Javascript engines like V8(chrome), SpiderMonkey(Firefox) etc.

Syntax help

STDIN Example

var readline = require('readline');
var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

rl.on('line', function(line){
    console.log("Hello, " + line);
});

variable declaration

KeywordDescriptionScope
varVar is used to declare variables(old way of declaring variables)Function or global scope
letlet is also used to declare variables(new way)Global or block Scope
constconst is used to declare const values. Once the value is assigned, it can not be modifiedGlobal or block Scope

Backtick Strings

Interpolation

let greetings = `Hello ${name}`

Multi line Strings

const msg = `
hello
world!
`

Arrays

An array is a collection of items or values.

Syntax:

let arrayName = [value1, value2,..etc];
// or
let arrayName = new Array("value1","value2",..etc);

Example:

let mobiles = ["iPhone", "Samsung", "Pixel"];

// accessing an array
console.log(mobiles[0]);

// changing an array element
mobiles[3] = "Nokia";

Arrow functions

Arrow Functions helps developers to write code in concise way, it’s introduced in ES6.
Arrow functions can be written in multiple ways. Below are couple of ways to use arrow function but it can be written in many other ways as well.

Syntax:

() => expression

Example:

const numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
const squaresOfEvenNumbers = numbers.filter(ele => ele % 2 == 0)
                                    .map(ele => ele ** 2);
console.log(squaresOfEvenNumbers);

De-structuring

Arrays

let [firstName, lastName] = ['Foo', 'Bar']

Objects

let {firstName, lastName} = {
  firstName: 'Foo',
  lastName: 'Bar'
}

rest(...) operator

 const {
    title,
    firstName,
    lastName,
    ...rest
  } = record;

Spread(...) operator

//Object spread
const post = {
  ...options,
  type: "new"
}
//array spread
const users = [
  ...adminUsers,
  ...normalUsers
]

Functions

function greetings({ name = 'Foo' } = {}) { //Defaulting name to Foo
  console.log(`Hello ${name}!`);
}
 
greet() // Hello Foo
greet({ name: 'Bar' }) // Hi Bar

Loops

1. If:

IF is used to execute a block of code based on a condition.

Syntax

if(condition){
    // code
}

2. If-Else:

Else part is used to execute the block of code when the condition fails.

Syntax

if(condition){
    // code
} else {
    // code
}

3. Switch:

Switch is used to replace nested If-Else statements.

Syntax

switch(condition){
    case 'value1' :
        //code
        [break;]
    case 'value2' :
        //code
        [break;]
    .......
    default :
        //code
        [break;]
}

4. For

For loop is used to iterate a set of statements based on a condition.

for(Initialization; Condition; Increment/decrement){  
//code  
} 

5. While

While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.

while (condition) {  
  // code 
}  

6. Do-While

Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.

do {  
  // code 
} while (condition); 

Classes

ES6 introduced classes along with OOPS concepts in JS. Class is similar to a function which you can think like kind of template which will get called when ever you initialize class.

Syntax:

class className {
  constructor() { ... } //Mandatory Class method
  method1() { ... }
  method2() { ... }
  ...
}

Example:

class Mobile {
  constructor(model) {
    this.name = model;
  }
}

mbl = new Mobile("iPhone");