Browse Source

6-dns-records-finder (#10)

Closes #6

Co-authored-by: Richard Dern <richard@athaliasoft.com>
Reviewed-on: #10
Co-authored-by: Richard Dern <richard@noreply.git.athaliasoft.com>
Co-committed-by: Richard Dern <richard@noreply.git.athaliasoft.com>
master
Richard Dern 2 months ago
parent
commit
9f5e93bb8f
  1. 3
      composer.json
  2. 67
      composer.lock
  3. 3
      config/analyzer.php
  4. 35
      package/Analyzers/DnsRecordsFinder.php
  5. 1
      package/Analyzers/FeedDiscoverer.php

3
composer.json

@ -14,7 +14,8 @@
"cyca/helpers": "^1.1",
"cyca/fetcher": "^1.1",
"neitanod/forceutf8": "^2.0",
"spatie/ssl-certificate": "^2.1"
"spatie/ssl-certificate": "^2.1",
"spatie/dns": "^2.1"
},
"require-dev": {
"mockery/mockery": "^1.0",

67
composer.lock

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "a145c3b7709d7f261f180312772366f8",
"content-hash": "77440488847a9647b68d009a90b64230",
"packages": [
{
"name": "brick/math",
@ -2629,6 +2629,71 @@
],
"time": "2021-08-06T22:30:43+00:00"
},
{
"name": "spatie/dns",
"version": "2.1.1",
"source": {
"type": "git",
"url": "https://github.com/spatie/dns.git",
"reference": "6eb4556dfdc51e3af6224be06c9d0501e4f2f360"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/dns/zipball/6eb4556dfdc51e3af6224be06c9d0501e4f2f360",
"reference": "6eb4556dfdc51e3af6224be06c9d0501e4f2f360",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^8.0",
"symfony/process": "^5.2"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"spatie/ray": "^1.22"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\Dns\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Harish Toshniwal",
"email": "harish@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
},
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
},
{
"name": "Tom Witkowski",
"email": "dev.gummibeer@gmail.com",
"homepage": "https://gummibeer.de",
"role": "Developer"
}
],
"description": "Retrieve DNS records",
"homepage": "https://github.com/spatie/dns",
"keywords": [
"dns",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/dns/issues",
"source": "https://github.com/spatie/dns/tree/2.1.1"
},
"time": "2021-08-04T17:28:35+00:00"
},
{
"name": "spatie/macroable",
"version": "2.0.0",

3
config/analyzer.php

@ -44,7 +44,8 @@ return [
'analyzers' => [
\Cyca\Analyzer\Analyzers\HtmlAnalyzer::class,
\Cyca\Analyzer\Analyzers\FeedDiscoverer::class,
\Cyca\Analyzer\Analyzers\CertificateAnalyzer::class
\Cyca\Analyzer\Analyzers\CertificateAnalyzer::class,
\Cyca\Analyzer\Analyzers\DnsRecordsFinder::class
]
]

35
package/Analyzers/DnsRecordsFinder.php

@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace Cyca\Analyzer\Analyzers;
use Cyca\Analyzer\Contracts\Analyzer;
use Spatie\Dns\Dns;
/**
* Finds DNS records associated with document's domain name
*/
class DnsRecordsFinder extends BaseAnalyzer implements Analyzer
{
/**
* Launch document's analyzis.
*
* @param bool $fastMode
* @return void
*/
public function analyze(bool $fastMode = false): void
{
if ($fastMode) {
return;
}
$domain = data_get($this->baseAttributes, 'fetcher.idn');
$dns = new Dns();
$records = $dns->getRecords($domain);
$this->forceFill([
'records' => $records
]);
}
}

1
package/Analyzers/FeedDiscoverer.php

@ -125,7 +125,6 @@ class FeedDiscoverer extends BaseAnalyzer implements Analyzer
}
if (!preg_match($regex, $domain)) {
dump($domain);
continue;
}

Loading…
Cancel
Save