added filename prompt for payload download

This commit is contained in:
rohitkumarankam 2022-05-20 00:04:43 +05:30
parent 49070b52f5
commit 69bbfffb34
3 changed files with 20 additions and 6 deletions

3
assets/axios.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -10,6 +10,7 @@
<script src="assets/jquery-3.5.1.slim.min.js"></script>
<script src="assets/popper-1.16.1.min.js"></script>
<script src="assets/bootstrap-4.5.2.min.js"></script>
<script src="assets/axios.min.js"></script>
<link rel="stylesheet" href="css/dark-mode.css">
<link rel="stylesheet" href="css/light-mode.css">
<link rel="stylesheet" href="css/meme-mode.css">

View File

@ -459,13 +459,23 @@ document.querySelector('#copy-msfvenom-command').addEventListener('click', () =>
var downloadButton = document.querySelectorAll(".download-svg");
for (const Dbutton of downloadButton) {
Dbutton.addEventListener("click", () => {
var element = document.createElement('a');
const filename = prompt('Enter a filename', 'payload.sh')
if(filename===null)return;
const rawLink = RawLink.generate(rsg);
element.setAttribute('href', rawLink);
element.setAttribute('download', rsg.getSelectedCommandName());
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
axios({
url: rawLink,
method: 'GET',
responseType: 'arraybuffer',
})
.then((response)=>{
const url = window.URL.createObjectURL(new File([response.data], filename ));
const downloadElement = document.createElement("a");
downloadElement.href = url;
downloadElement.setAttribute('download', filename);
document.body.appendChild(downloadElement);
downloadElement.click();
document.body.removeChild(downloadElement);
});
});
}