mirror of https://github.com/MISP/MISP
dns
config if there is a name server available and do not use if not there.pull/63/head
parent
7ccc3a8ba6
commit
2a12a5db3e
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue