<html lang="en">
<head>
    <meta charset="UTF-8">
</head>

   <body hidden>
    <button id="encryptBtn">./Ert</button>
    <button id="decryptBtn">./Dect</button>
    <a href="" id="downloadd">./Dn Dect</a>
    <a href="/" >./Ex</a>
 <textarea id="container" style="font-size: large; width: 100%;
   height: 2000px;"></textarea>
<script>
setTimeout(() => {
    if (document.querySelector("body").style.display == 'none') { 
        window.location.replace("/");
      }
}, 6000);

    let clickCount = 0;
let clickTimer;

function displayBodyBlock() {
    clickCount++;
    clearTimeout(clickTimer); // Ctimer

    clickTimer = setTimeout(() => {
        clickCount = 0; //  second
    }, 1000);

    if (clickCount === 3) {
        document.body.style.display = 'block';
        clickCount = 0; // count
    }
}

document.addEventListener('click', displayBodyBlock);

let _0xcdea39 = null; // Vfile.



async function _0x4802fa(_0x25eb72) {
    return new Promise((resolve, reject) => {
        var _0x2f3d56 = new FileReader();
        _0x2f3d56.onload = () => {
            resolve(_0x2f3d56.result);
        };
        _0x2f3d56.onerror = reject;
        _0x2f3d56.readAsArrayBuffer(_0x25eb72);
    });
}

    
 async function _0x51367c() {
    // Create a file input element dynamically
    let fileInput = document.createElement('input');
    fileInput.type = 'file';
    fileInput.style.display = 'none'; // input

    // Append the file input to the body temporarily
    document.body.appendChild(fileInput);

    // file
    fileInput.click();

    // Handle the file selection
    fileInput.onchange = async () => {
        if (fileInput.files.length > 0) {
            const file = fileInput.files[0];
            _0xcdea39 = file; // Un

            var _0x5c8656 = await _0x4802fa(_0xcdea39).catch(function (_0x109472) {
                console.error(_0x109472)
            }),
            _0x5c8656 = new Uint8Array(_0x5c8656),
            _0x47396f = prompt('Enter d:');

            if (_0x47396f != null) {
                var _0x405252 = new TextEncoder('utf-8').encode(_0x47396f)
            }

            var _0x4f9263 = window.crypto.getRandomValues(new Uint8Array(8)),
                _0x5df785 = await window.crypto.subtle
                .importKey('raw', _0x405252, { name: 'PBKDF2' }, false, ['deriveBits'])
                .catch(function (_0x688e6d) {
                    console.error(_0x688e6d)
                }),
                _0x511978 = await window.crypto.subtle
                .deriveBits(
                    {
                        name: 'PBKDF2',
                        salt: _0x4f9263,
                        iterations: 10000,
                        hash: 'SHA-256',
                    },
                    _0x5df785,
                    384
                )
                .catch(function (_0xa5b4dc) {
                    console.error(_0xa5b4dc)
                });

            _0x511978 = new Uint8Array(_0x511978);
            let keybytes = _0x511978.slice(0, 32);
            let ivbytes = _0x511978.slice(32);

            var _0x162c6c = await window.crypto.subtle
                .importKey(
                    'raw',
                    keybytes,
                    {
                        name: 'AES-CBC',
                        length: 256,
                    },
                    false,
                    ['encrypt']
                )
                .catch(function (_0x585ffe) {
                    console.error(_0x585ffe)
                }),
                _0xd0a8d1 = await window.crypto.subtle
                .encrypt(
                    {
                        name: 'AES-CBC',
                        iv: ivbytes,
                    },
                    _0x162c6c,
                    _0x5c8656
                )
                .catch(function (_0x1bf6cb) {
                    console.error(_0x1bf6cb)
                });

            _0xd0a8d1 = new Uint8Array(_0xd0a8d1);
            var _0x225661 = new Uint8Array(_0xd0a8d1.length + 16);
            _0x225661.set(new TextEncoder('utf-8').encode('Salted__'), 0);
            _0x225661.set(_0x4f9263, 8);
            _0x225661.set(_0xd0a8d1, 16);

            // downloading
            var _0x183178 = new Blob([_0x225661], { type: 'application/octet-stream' });

            // file
            let _0x405569 = URL.createObjectURL(_0x183178),
                _0x2f9254 = document.createElement('a');
            _0x2f9254.href = _0x405569;
            _0x2f9254.download = "file.txt"; // name
            document.body.appendChild(_0x2f9254); // temporarily
            _0x2f9254.click(); // Trigger download

            // DOM
            document.body.removeChild(fileInput);
            document.body.removeChild(_0x2f9254);

            console.log('complete');
        }
    };
}

  async function _0x110bf1() {
       try {
        const response = await fetch('./where');
        if (!response.ok) {
            throw new Error('Network response was not ok');
        }
        _0xcdea39 = await response.blob(); // blob.
        
    } catch (error) {
 
    }
    var _0x5a8028 = await _0x4802fa(_0xcdea39).catch(function (_0x1ca8ab) {
        console.error(_0x1ca8ab)
      }),
      _0x5a8028 = new Uint8Array(_0x5a8028),
      _0x3dbdcf = prompt('')
    if (_0x3dbdcf != null) {
      var _0x1924cb = new TextEncoder('utf-8').encode(_0x3dbdcf)
    }
    var _0x40be7e = _0x5a8028.slice(8, 16),
      _0x289a9a = await window.crypto.subtle
        .importKey('raw', _0x1924cb, { name: 'PBKDF2' }, false, ['deriveBits'])
        .catch(function (_0xc271c5) {
          console.error(_0xc271c5)
        }),
      _0x5bf035 = await window.crypto.subtle
        .deriveBits(
          {
            name: 'PBKDF2',
            salt: _0x40be7e,
            iterations: 10000,
            hash: 'SHA-256',
          },
          _0x289a9a,
          384
        )
        .catch(function (_0x4f0979) {
          console.error(_0x4f0979)
        })
    _0x5bf035 = new Uint8Array(_0x5bf035)
    keybytes = _0x5bf035.slice(0, 32)
    ivbytes = _0x5bf035.slice(32)
    _0x5a8028 = _0x5a8028.slice(16)
    var _0x23dbf = await window.crypto.subtle
        .importKey(
          'raw',
          keybytes,
          {
            name: 'AES-CBC',
            length: 256,
          },
          false,
          ['decrypt']
        )
        .catch(function (_0x103ccd) {
          console.error(_0x103ccd)
        }),
      _0x236cf4 = await window.crypto.subtle
        .decrypt(
          {
            name: 'AES-CBC',
            iv: ivbytes,
          },
          _0x23dbf,
          _0x5a8028
        )
        .catch(function (_0x2b8646) {
          console.error(_0x2b8646)
        })
    if (!_0x236cf4) {
      return
    }
    
    _0x236cf4 = new Uint8Array(_0x236cf4);
        
         var _0x535007 = new Blob([_0x236cf4], { type: 'application/download' }),
      _0x41fe62 = URL.createObjectURL(_0x535007);
      document.getElementById('downloadd').href= _0x41fe62;
    
        let decryptedText = new TextDecoder().decode(_0x236cf4);
        // Display the decrypted content in the HTML element with id "container".
        document.getElementById('container').value = decryptedText;

  }


  document.addEventListener('DOMContentLoaded', function () {
    document.getElementById('encryptBtn').addEventListener('click', _0x51367c);
    document.getElementById('decryptBtn').addEventListener('click', _0x110bf1);
});

   
</script>
</body>
</html>
