Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ferdousulhaque/d14c9d3bc342b0c1d5c9edaa68365ea6 to your computer and use it in GitHub Desktop.
Save ferdousulhaque/d14c9d3bc342b0c1d5c9edaa68365ea6 to your computer and use it in GitHub Desktop.
For Internal Port Scan from Web. Usually for security purpose db is not exposed to internet, it stays in the internal zones. So this will help in that case.
<?php
ini_set('max_execution_time', 0);
ini_set('memory_limit', -1);
if(!empty($_GET["ip"]) && !empty($_GET["port"])){
$ip = $_GET["ip"];
$port = $_GET["port"];
//nginx Check
$connection = @fsockopen($ip, $port, $errno, $errstr, 2);
if (is_resource($connection)){
fclose($connection);
http_response_code(200);
}else{
http_response_code(404);
}
} else{
http_response_code(404);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment