Skip to content

Commit

Permalink
Use Ipv4 address for port checker (#2396)
Browse files Browse the repository at this point in the history
* Use --ipv4 instead to bind to ipv4 address
* Enable useIpv4 by default

Co-authored-by: dylansama <[email protected]>
Co-authored-by: stickz <[email protected]>
  • Loading branch information
3 people authored Jan 3, 2023
1 parent 83d9ab4 commit 3da85a1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions php/Snoopy.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class Snoopy
// send Accept-encoding: gzip?
var $use_gzip = true;
var $IP = null;
var $useIpv4 = false;

/**** Private variables ****/

Expand Down Expand Up @@ -524,6 +525,9 @@ class Snoopy
if(!is_null($this->IP))
$cmdline_params .= " --interface ".$this->IP;

if($this->useIpv4)
$cmdline_params .= " --ipv4";

if($this->_isproxy)
$cmdline_params .= " --proxy-insecure --proxy ".(empty($this->proxy_proto) ? '' : $this->proxy_proto.'://').$this->proxy_host.":".$this->proxy_port;

Expand Down
5 changes: 5 additions & 0 deletions plugins/check_port/action.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@

function get_ip($url,$ipMatch)
{
global $useIpv4;

$client = new Snoopy();
$client->proxy_host = "";
$client->useIpv4 = $useIpv4;

@$client->fetch($url);

Expand All @@ -48,9 +51,11 @@ function get_ip($url,$ipMatch)
function check_port($ip,$port,$checker,$closed,$open)
{
global $useWebsite;
global $useIpv4;

$client = new Snoopy();
$client->proxy_host = "";
$client->useIpv4 = $useIpv4;

if($useWebsite=="yougetsignal")
$parse = "remoteAddress=".$ip."&portNumber=".$port;
Expand Down
2 changes: 2 additions & 0 deletions plugins/check_port/conf.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
// false - disable check_port plugin
// "yougetsignal" - use https://www.yougetsignal.com/tools/open-ports/
// "portchecker" - use https://portchecker.co/

$useIpv4 = true; // use ipv4 addresses when checking ports, unless website supports ipv6

0 comments on commit 3da85a1

Please sign in to comment.