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

@@ -81,11 +81,10 @@ beef.execute(function() {
}
// validate target
if (!target_port || !target_ip || isNaN(target_port)) {
if (!target_port || !target_ip) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=malformed target host or target port');
} else if (target_port > 65535 || target_port < 0) {
} else if (!beef.net.is_valid_port(target_port)) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=invalid target port');
// send request and wait for reply
} else {
send_cmds(target_ip, target_port, cmd,result_size);