2020-10-31 19:57:29 +03:00
|
|
|
<?php
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2020-10-31 19:57:29 +03:00
|
|
|
class OpenwrtSecurityBridge extends BridgeAbstract
|
|
|
|
{
|
|
|
|
const NAME = 'OpenWrt Security Advisories';
|
|
|
|
const URI = 'https://openwrt.org/advisory/start';
|
|
|
|
const DESCRIPTION = 'Security Advisories published by openwrt.org';
|
|
|
|
const MAINTAINER = 'mschwld';
|
|
|
|
const CACHE_TIMEOUT = 3600;
|
|
|
|
const WEBROOT = 'https://openwrt.org';
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2020-10-31 19:57:29 +03:00
|
|
|
public function collectData()
|
|
|
|
{
|
|
|
|
$item = [];
|
2022-01-02 12:36:09 +03:00
|
|
|
$html = getSimpleHTMLDOM(self::URI);
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2020-10-31 19:57:29 +03:00
|
|
|
$advisories = $html->find('div[class=plugin_nspages]', 0);
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2020-10-31 19:57:29 +03:00
|
|
|
foreach ($advisories->find('a[class=wikilink1]') as $element) {
|
|
|
|
$item = [];
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2020-10-31 19:57:29 +03:00
|
|
|
$row = $element->innertext;
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2020-10-31 19:57:29 +03:00
|
|
|
$item['title'] = substr($row, 0, strpos($row, ' - '));
|
|
|
|
$item['timestamp'] = $this->getDate($element->href);
|
|
|
|
$item['uri'] = self::WEBROOT . $element->href;
|
|
|
|
$item['uid'] = self::WEBROOT . $element->href;
|
|
|
|
$item['content'] = substr($row, strpos($row, ' - ') + 3);
|
|
|
|
$item['author'] = 'OpenWrt Project';
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2020-10-31 19:57:29 +03:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2020-10-31 19:57:29 +03:00
|
|
|
private function getDate($href)
|
|
|
|
{
|
|
|
|
$date = substr($href, -12);
|
|
|
|
return $date;
|
|
|
|
}
|
|
|
|
}
|