Ejemplo n.º 1
0
 public function __construct($keytag, $algorithm, $digest, $key, $rest)
 {
     parent::__construct();
     $this->setKeytag($keytag);
     $this->setAlgorithm($algorithm);
     $this->setDigest($digest);
     $this->setKey($key);
     $this->setRest($rest);
 }
Ejemplo n.º 2
0
 public function __construct($flags, $protocol, $algorithm, $pubkey)
 {
     parent::__construct();
     //$this->setKeytag($flags, $protocol, $algorithm, $pubkey);
     $this->setKeylength(strlen($pubkey));
     $this->setFlags($flags);
     $this->setProtocol($protocol);
     $this->setAlgorithm($algorithm);
     $this->setPublicKey($pubkey);
     $this->setPublicKeyBase64(base64_encode($pubkey));
     $this->sep = false;
     $this->zonekey = false;
 }
Ejemplo n.º 3
0
 public function __construct($type, $algorithm, $labels, $originalttl, $expiration, $inception, $keytag)
 {
     parent::__construct();
     date_default_timezone_set('UTC');
     $types = new DNSTypes();
     $this->setTypecovered($types->GetById($type));
     $this->setAlgorithm($algorithm);
     $this->setLabels($labels);
     $this->setOriginalTTL($originalttl);
     $this->setExpirationTimestamp($expiration);
     $this->setInceptionTimestamp($inception);
     $this->setExpirationDate(date('YmdHis', $expiration));
     $this->setInceptionDate(date('YmdHis', $inception));
     $this->setKeytag($keytag);
 }
Ejemplo n.º 4
0
 public function __construct($record)
 {
     parent::__construct();
     $this->setRecord($record);
 }
Ejemplo n.º 5
0
 public function __construct($ns)
 {
     parent::__construct();
     $this->setNameserver($ns);
 }
Ejemplo n.º 6
0
 public function __construct($redirect)
 {
     parent::__construct();
     $this->setRedirect($redirect);
 }
Ejemplo n.º 7
0
 function __construct($data)
 {
     parent::__construct();
     $this->setData($data);
 }
Ejemplo n.º 8
0
 public function ReadRecord($buffer, $resulttype = '')
 {
     $domain = $this->ReadDomainLabel($buffer);
     $ans_header_bin = $this->ReadResponse($buffer, 10);
     // 10 byte header
     $ans_header = unpack("ntype/nclass/Nttl/nlength", $ans_header_bin);
     #echo "Record Type ".$ans_header['type']." Class ".$ans_header['class']." TTL ".$ans_header['ttl']." Length ".$ans_header['length']."\n";
     #$this->DebugBinary($buffer);
     $types = new DNSTypes();
     $typeid = $types->GetById($ans_header['type']);
     //$extras = array();
     switch ($typeid) {
         case 'A':
             $result = new dnsAresult(implode(".", unpack("Ca/Cb/Cc/Cd", $this->ReadResponse($buffer, 4))));
             break;
         case 'NS':
             $result = new dnsNSresult($this->ReadDomainLabel($buffer));
             break;
         case 'PTR':
             $result = new dnsPTRresult($this->ReadDomainLabel($buffer));
             break;
         case 'CNAME':
             $result = new dnsCNAMEresult($this->ReadDomainLabel($buffer));
             break;
         case 'MX':
             $result = new dnsMXresult();
             $prefs = $this->ReadResponse($buffer, 2);
             $prefs = unpack("nprio", $prefs);
             $result->setPrio($prefs['prio']);
             $result->setServer($this->ReadDomainLabel($buffer));
             break;
         case 'SOA':
             $result = new dnsSOAresult();
             $result->setNameserver($this->ReadDomainLabel($buffer));
             $result->setResponsible($this->ReadDomainLabel($buffer));
             $buffer = $this->ReadResponse($buffer, 20);
             $extras = unpack("Nserial/Nrefresh/Nretry/Nexpiry/Nminttl", $buffer);
             $result->setSerial($extras['serial']);
             $result->setRefresh($extras['refresh']);
             $result->setRetry($extras['retry']);
             $result->setExpiry($extras['expiry']);
             $result->setMinttl($extras['minttl']);
             break;
         case 'TXT':
             $result = new dnsTXTResult($this->ReadResponse($buffer, $ans_header['length']));
             break;
         case 'DS':
             $stuff = $this->ReadResponse($buffer, $ans_header['length']);
             $length = ($ans_header['length'] - 4) * 2 - 8;
             $stuff = unpack("nkeytag/Calgo/Cdigest/H" . $length . "string/H*rest", $stuff);
             $stuff['string'] = strtoupper($stuff['string']);
             $stuff['rest'] = strtoupper($stuff['rest']);
             $result = new dnsDSresult($stuff['keytag'], $stuff['algo'], $stuff['digest'], $stuff['string'], $stuff['rest']);
             break;
         case 'DNSKEY':
             $stuff = $this->ReadResponse($buffer, $ans_header['length']);
             $this->keytag($stuff, $ans_header['length']);
             $this->keytag2($stuff, $ans_header['length']);
             $extras = unpack("nflags/Cprotocol/Calgorithm/a*pubkey", $stuff);
             $flags = sprintf("%016b\n", $extras['flags']);
             $result = new dnsDNSKEYresult($extras['flags'], $extras['protocol'], $extras['algorithm'], $extras['pubkey']);
             $result->setKeytag($this->keytag($stuff, $ans_header['length']));
             if ($flags[7] == '1') {
                 $result->setZoneKey(true);
             }
             if ($flags[15] == '1') {
                 $result->setSep(true);
             }
             break;
         case 'RRSIG':
             $stuff = $this->ReadResponse($buffer, 18);
             //$length = $ans_header['length'] - 18;
             $test = unpack("ntype/calgorithm/clabels/Noriginalttl/Nexpiration/Ninception/nkeytag", $stuff);
             $result = new dnsRRSIGresult($test['type'], $test['algorithm'], $test['labels'], $test['originalttl'], $test['expiration'], $test['inception'], $test['keytag']);
             $name = $this->ReadDomainLabel($buffer);
             $result->setSignername($name);
             $sig = $this->ReadResponse($buffer, $ans_header['length'] - (strlen($name) + 2) - 18);
             $result->setSignature($sig);
             $result->setSignatureBase64(base64_encode($sig));
             break;
         default:
             // something we can't deal with
             $result = new dnsResult();
             #echo "Length: ".$ans_header['length']."\n";
             $stuff = $this->ReadResponse($buffer, $ans_header['length']);
             $result->setData($stuff);
             break;
     }
     $result->setDomain($domain);
     $result->setType($ans_header['type']);
     $result->setTypeid($typeid);
     $result->setClass($ans_header['class']);
     $result->setTtl($ans_header['ttl']);
     $this->AddResult($result, $resulttype);
     return;
 }
Ejemplo n.º 9
0
 function __construct($ip)
 {
     parent::__construct();
     $this->setIpv4($ip);
 }