diff --git a/app/Config/bootstrap.default.php b/app/Config/bootstrap.default.php index d4b3cc8dc..00e665c75 100644 --- a/app/Config/bootstrap.default.php +++ b/app/Config/bootstrap.default.php @@ -151,6 +151,7 @@ Configure::write('CyDefSIG.correlation', 'sql'); // correlation between a * paginated 16759 8447 6615 * 17734 8639 8846 */ +Configure::write('CyDefSIG.dns', 'false'); // there is a nameserver available to do resolution. /** * The settings below can be used to set additional paths to models, views and controllers. diff --git a/app/Model/Dns.php b/app/Model/Dns.php old mode 100644 new mode 100755 index 9f78c9ac8..d58135cc7 --- a/app/Model/Dns.php +++ b/app/Model/Dns.php @@ -9,16 +9,15 @@ class Dns extends AppModel { public $useTable = false; - /* - * Checks for a valid internet name - * Returns true if Name is an existing Domain Host Name, false otherwise - * TODO should be renamed - * - * @param unknown_type $nametotest The Domain Host Name to check for existence. - * @return boolean - */ - - public function testipaddress ($nametotest) { +/** + * Checks for a valid internet name + * Returns true if Name is an existing Domain Host Name, false otherwise + * TODO should be renamed + * + * @param unknown_type $nametotest The Domain Host Name to check for existence. + * @return boolean + */ + public function testipaddress($nametotest) { if (intval($nametotest) > 0) { return true; } else { @@ -32,4 +31,20 @@ class Dns extends AppModel { } } +/** + * Name to IP list, + * get all ip numbers given a certain domain or host $name. + * + * @param $name being a hostname + * + * @return array of ip numbers + */ + function nametoipl($name = '') { + if ('true' == Configure::read('CyDefSIG.dns')) { + if (!$ips = gethostbynamel($name)) $ips = array(); + } else { + $ips = array(); + } + return $ips; + } } \ No newline at end of file