解密工具 - 在线解密和提取URL
<div class="container">
<h1>解密</h1>
<div class="input-output">
<p>请输入要解密的内容:</p>
<textarea id="input"></textarea>
<button onclick="decrypt()">解密</button>
</div>
<div class="output">
<p>解密后的文本:</p>
<textarea id="output1" readonly></textarea>
<p>解密后的URL:</p>
<textarea id="output2" readonly></textarea>
<p>完整的URL:</p>
<textarea id="output3" readonly></textarea>
</div>
</div>
<script>
function decrypt(){
var input = document.getElementById("input").value;
var data = JSON.parse(input).data;
var decoded1 = atob(data);
var decoded2 = atob(decoded1);
var decoded3 = atob(decoded2);
document.getElementById("output1").value = decoded3;
var urlStart = decoded3.indexOf("http");
var urlEnd = decoded3.indexOf(".m3u8?") + 5;
var url1 = decoded3.substring(urlStart, urlEnd);
var url2Start = decoded3.indexOf("http", urlEnd);
var url2End = decoded3.indexOf(".m3u8?", url2Start) + 5;
var url2 = decoded3.substring(url2Start, url2End);
var url = url1 + "\n" + url2;
document.getElementById("output2").value = url;
var fullUrl = decoded3.substring(urlStart, url2End);
document.getElementById("output3").value = fullUrl;
saveTextAsFile(decoded3);
}
<pre><code> function saveTextAsFile(textToSave) {
var textFileAsBlob = new Blob([textToSave], {type:'text/plain'});
var fileNameToSaveAs = "decrypted.txt";
var downloadLink = document.createElement("a");
downloadLink.download = fileNameToSaveAs;
downloadLink.innerHTML = "Download File";
if (window.webkitURL != null) {
// Chrome allows the link to be clicked
// without actually adding it to the DOM.
downloadLink.href = window.webkitURL.createObjectURL(textFileAsBlob);
}
else {
// Firefox requires the link to be added to the DOM
// before it can be clicked.
downloadLink.href = window.URL.createObjectURL(textFileAsBlob);
downloadLink.onclick = destroyClickedElement;
downloadLink.style.display = "none";
document.body.appendChild(downloadLink);
}
downloadLink.click();
}
function destroyClickedElement(event) {
// remove the link from the DOM
document.body.removeChild(event.target);
}
</script>
</code></pre>
原文地址: https://www.cveoy.top/t/topic/njqu 著作权归作者所有。请勿转载和采集!