Add IP and port validation to beef.net

This commit is contained in:
Brendan Coles
2017-08-11 06:12:15 +00:00
parent f545b3631b
commit 173a65be13
10 changed files with 46 additions and 35 deletions

View File

@@ -20,11 +20,11 @@ beef.execute(function() {
}
// validate target details
if (!rport || !rhost || isNaN(rport)) {
if (!rport || !rhost) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=malformed remote host or remote port');
return;
}
if (rport > 65535 || rport < 0) {
if (!beef.net.is_valid_port(rport)) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=invalid remote port');
return;
}