Skip to content

Commit

Permalink
Added MSFvenom command generator
Browse files Browse the repository at this point in the history
  • Loading branch information
drakylar committed Jan 4, 2022
1 parent 0e7a1bd commit 8cdee54
Showing 1 changed file with 39 additions and 11 deletions.
50 changes: 39 additions & 11 deletions templates/project/tools/helpers/msfvenom-helper.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</div>
<script>
var cmd_msf_multiline = ''

function cmd_builder() {
var cmd_console = 'msfvenom';
var cmd_msf = 'msfconsole -x "use exploit/multi/handler; ';
Expand Down Expand Up @@ -163,7 +164,7 @@
if (s.includes(search_field.toLowerCase()) || search_field === '') {

inner = `<div class="ui item checkbox" data-value="item1" id="encoders_row">
<input type="checkbox" value="${encoders_list[i]['encoder']}" ${check_str} onchange="switch_encoders('${encoders_list[i]["encoder"]}');">
<input type="checkbox" value="${encoders_list[i]['encoder']}" ${check_str} onchange="switch_encoders(this,'${encoders_list[i]["encoder"]}');">
<label>${s}</label>
</div>`;
if (encoders_list[i]['checked']) {
Expand All @@ -174,7 +175,7 @@
}
} else if (encoders_list[i]['checked']) {
inner = `<div class="ui item checkbox" data-value="item1" id="encoders_row" style="display: none;">
<input type="checkbox" value="${encoders_list[i]['encoder']}" checked onchange="switch_encoders('${encoders_list[i]["encoder"]}');">
<input type="checkbox" value="${encoders_list[i]['encoder']}" checked onchange="switch_encoders(this,'${encoders_list[i]["encoder"]}');">
<label>${s}</label>
</div>`;
shown_html += inner;
Expand All @@ -195,9 +196,9 @@

function copyToClipboard(field_num) {
const el = document.createElement('textarea');
if (field_num===1) el.value = $('#cmd_console')[0].value;
if (field_num===2) el.value = $('#msf_console')[0].value;
if (field_num===3) el.value = cmd_msf_multiline;
if (field_num === 1) el.value = $('#cmd_console')[0].value;
if (field_num === 2) el.value = $('#msf_console')[0].value;
if (field_num === 3) el.value = cmd_msf_multiline;
el.setAttribute('readonly', '');
el.style.position = 'absolute';
el.style.left = '-9999px';
Expand Down Expand Up @@ -264,15 +265,42 @@
cmd_builder();
}

function switch_encoders(encoder) {
for (var i = 0; i < msf_encoders.length; i++) {
msf_encoders[i]['checked'] = (msf_encoders[i]['encoder'] === encoder);
}
function switch_encoders(obj, encoder) {
var elements = $('[id=encoders_row]')

for (var i = 0; i < elements.length; i++) {
elements[i].children[0].checked = (elements[i].children[0].value === encoder);
if (obj.checked) {
for (var i = 0; i < msf_encoders.length; i++) {
msf_encoders[i]['checked'] = (msf_encoders[i]['encoder'] === encoder);
}

for (var i = 0; i < elements.length; i++) {
if (elements[i].children[0].value === encoder) {
elements[i].children[0].checked = true;
elements[i].classList.remove("selected");
elements[i].classList.remove("checked");
elements[i].classList.remove("active");
elements[i].classList.add("selected");
elements[i].classList.add("checked");
elements[i].classList.add("active");
} else {
elements[i].children[0].checked = false;
elements[i].classList.remove("selected");
elements[i].classList.remove("checked");
elements[i].classList.remove("active");
}
}
} else {
for (var i = 0; i < msf_encoders.length; i++) {
msf_encoders[i]['checked'] = false;
}
for (var i = 0; i < elements.length; i++) {
elements[i].children[0].checked = false;
elements[i].classList.remove("selected");
elements[i].classList.remove("checked");
elements[i].classList.remove("active");
}
}

cmd_builder();
}
</script>
Expand Down

0 comments on commit 8cdee54

Please sign in to comment.