Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VulDB Spider #23

Merged
merged 3 commits into from
Jul 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from spiders.CISASpider import CisaSpider
from spiders.CertFrSpider import CertFrSpider
from spiders.DgssiSpider import DgssiSpider
from spiders.VulDBSpider import VulDBSpider
from spiders.ZDISpider import ZDISpider
from scrapy.crawler import CrawlerProcess
from datetime import datetime, timezone
Expand All @@ -12,7 +13,7 @@

def main():
now = datetime.now(timezone.utc).strftime("%d/%m/%Y %H:%M:%S")
item = f"""<div id="top"></div>\n\n## CyberOwl \n ![cyberowl](docs/images/logo.png)\n> Last Updated {now} UTC \n\nA daily updated summary of the most frequent types of security incidents currently being reported from different sources.\n\n--- \n\n### :kangaroo: Jump to \n | CyberOwl Sources | Description |\n|---|---|\n| [US-CERT](#us-cert-arrow_heading_up) | United States Computer Emergency and Readiness Team. |\n| [MA-CERT](#ma-cert-arrow_heading_up) | Moroccan Computer Emergency Response Team. |\n| [CERT-FR](#cert-fr-arrow_heading_up) | The French national government Computer Security Incident Response Team. |\n| [IBM X-Force Exchange](#ibmcloud-arrow_heading_up) | A cloud-based threat intelligence platform that allows to consume, share and act on threat intelligence. |\n| [ZeroDayInitiative](#zerodayinitiative-arrow_heading_up) | An international software vulnerability initiative that was started in 2005 by TippingPoint. |\n| [OBS Vigilance](#obs-vigilance-arrow_heading_up) |Vigilance is an initiative created by OBS (Orange Business Services) since 1999 to watch public vulnerabilities and then offer security fixes, a database and tools to remediate them. |\n\n> Suggest a source by opening an [issue](https://github.com/karimhabush/cyberowl/issues)! :raised_hands:\n\n"""
item = f"""<div id="top"></div>\n\n## CyberOwl \n ![cyberowl](docs/images/logo.png)\n> Last Updated {now} UTC \n\nA daily updated summary of the most frequent types of security incidents currently being reported from different sources.\n\n--- \n\n### :kangaroo: Jump to \n | CyberOwl Sources | Description |\n|---|---|\n| [US-CERT](#us-cert-arrow_heading_up) | United States Computer Emergency and Readiness Team. |\n| [MA-CERT](#ma-cert-arrow_heading_up) | Moroccan Computer Emergency Response Team. |\n| [CERT-FR](#cert-fr-arrow_heading_up) | The French national government Computer Security Incident Response Team. |\n| [IBM X-Force Exchange](#ibmcloud-arrow_heading_up) | A cloud-based threat intelligence platform that allows to consume, share and act on threat intelligence. |\n| [ZeroDayInitiative](#zerodayinitiative-arrow_heading_up) | An international software vulnerability initiative that was started in 2005 by TippingPoint. |\n| [OBS Vigilance](#obs-vigilance-arrow_heading_up) |Vigilance is an initiative created by OBS (Orange Business Services) since 1999 to watch public vulnerabilities and then offer security fixes, a database and tools to remediate them. |\n| [VulDB](#vuldb-arrow_heading_up) | Number one vulnerability database documenting and explaining security vulnerabilities, threats, and exploits since 1970. |\n\n> Suggest a source by opening an [issue](https://github.com/karimhabush/cyberowl/issues)! :raised_hands:\n\n"""

with open("README.md", "w", encoding="utf-8") as f:
f.write(item)
Expand All @@ -26,6 +27,7 @@ def main():
process.crawl(IBMCloudSpider)
process.crawl(ZDISpider)
process.crawl(VigilanceSpider)
process.crawl(VulDBSpider)
process.start()

except Exception:
Expand Down
43 changes: 43 additions & 0 deletions spiders/VulDBSpider.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from urllib import response
import scrapy
from mdtemplate import Template
from datetime import date


class VulDBSpider(scrapy.Spider):
name = 'VulDB'
start_urls = [
'https://vuldb.com/?live.recent'
]
def parse(self, response):
if('cached' in response.flags):
return
num_bulletins=0
_data = []
print(response.css("table>tr").extract())
for bulletin in response.css("table>tr"):
if num_bulletins==0:
num_bulletins+=1
continue
LINK = "https://vuldb.com/"+bulletin.xpath("descendant-or-self::td[4]//@href").get()
DATE = str(date.today())+" at "+bulletin.xpath("descendant-or-self::td[1]//text()").get()
TITLE = bulletin.xpath("descendant-or-self::td[4]//text()").get().replace(
"\n", "").replace("\t", "").replace("\r", "").replace(" ", "").replace("|","-")
DESC = "Visit link for details"
ITEM = {
"_title": TITLE,
"_link": LINK,
"_date": DATE,
"_desc": DESC
}

_data.append(ITEM)
num_bulletins += 1
if num_bulletins >= 11:
break

_to_write = Template("VulDB", _data)

with open("README.md", "a", encoding="utf-8") as f:
f.write(_to_write._fill_table())
f.close()