mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-22 01:25:28 +03:00
fix(cve_details) (#4251)
This commit is contained in:
parent
a6bdc322b0
commit
486191b419
1 changed files with 10 additions and 32 deletions
|
@ -42,45 +42,23 @@ class CVEDetailsBridge extends BridgeAbstract
|
||||||
$this->fetchContent();
|
$this->fetchContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->html->find('#searchresults > .row') as $i => $tr) {
|
$var = $this->html->find('#searchresults > div > div.row');
|
||||||
// There are some optional vulnerability types, which will be
|
foreach ($var as $i => $tr) {
|
||||||
// added to the categories as well as the CWE number -- which is
|
$uri = $tr->find('h3 > a', 0)->href ?? null;
|
||||||
// always given.
|
|
||||||
$categories = [$this->vendor];
|
|
||||||
$enclosures = [];
|
|
||||||
|
|
||||||
$detailLink = $tr->find('h3 > a', 0);
|
|
||||||
$detailHtml = getSimpleHTMLDOM($detailLink->href);
|
|
||||||
|
|
||||||
// The CVE number itself
|
|
||||||
$title = $tr->find('h3 > a', 0)->innertext;
|
$title = $tr->find('h3 > a', 0)->innertext;
|
||||||
$content = $tr->find('.cvesummarylong', 0)->innertext;
|
$content = $tr->find('.cvesummarylong', 0)->innertext ?? '';
|
||||||
$cweList = $detailHtml->find('h2', 2)->next_sibling();
|
$timestamp = $tr->find('[data-tsvfield="publishDate"]', 0)->innertext ?? 0;
|
||||||
foreach ($cweList->find('li') as $li) {
|
|
||||||
$cweWithDescription = $li->find('a', 0)->innertext ?? '';
|
|
||||||
|
|
||||||
if (preg_match('/CWE-(\d+)/', $cweWithDescription, $cwe)) {
|
|
||||||
$categories[] = 'CWE-' . $cwe[1];
|
|
||||||
$enclosures[] = 'https://cwe.mitre.org/data/definitions/' . $cwe[1] . '.html';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->product != '') {
|
|
||||||
$categories[] = $this->product;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->items[] = [
|
$this->items[] = [
|
||||||
'uri' => 'https://cvedetails.com/' . $detailHtml->find('h1 > a', 0)->href,
|
'uri' => $uri,
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'timestamp' => $tr->find('[data-tsvfield="publishDate"]', 0)->innertext,
|
'timestamp' => $timestamp,
|
||||||
'content' => $content,
|
'content' => $content,
|
||||||
'categories' => $categories,
|
'categories' => [$this->vendor],
|
||||||
'enclosures' => $enclosures,
|
'enclosures' => [],
|
||||||
'uid' => $title,
|
'uid' => $title,
|
||||||
];
|
];
|
||||||
|
if (count($this->items) >= 30) {
|
||||||
// We only want to fetch the latest 10 CVEs
|
|
||||||
if (count($this->items) >= 10) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue