Skip to content

Instantly share code, notes, and snippets.

View sbs2001's full-sized avatar
🎯
git gud

sbs sbs2001

🎯
git gud
View GitHub Profile
@sbs2001
sbs2001 / z.md
Last active August 19, 2020 17:46

VulnerableCode

Build Status License Python 3.8 stability-wip Gitter chat PRs Welcome

VulnerableCode

Build Status License Python 3.8 stability-wip PRs Welcome

VulnerableCode

Build Status License Python 3.8 stability-wip PRs Welcome

@sbs2001
sbs2001 / mp.py
Last active July 28, 2020 05:29
Trace
Traceback (most recent call last):
File "mp.py", line 16, in <module>
with Pool(processes=1000) as p :
File "/usr/lib/python3.8/multiprocessing/context.py", line 119, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild,
File "/usr/lib/python3.8/multiprocessing/pool.py", line 212, in __init__
self._repopulate_pool()
File "/usr/lib/python3.8/multiprocessing/pool.py", line 303, in _repopulate_pool
return self._repopulate_pool_static(self._ctx, self.Process,
File "/usr/lib/python3.8/multiprocessing/pool.py", line 326, in _repopulate_pool_static
import requests
import xml.etree.ElementTree as ET
from bs4 import BeautifulSoup
class CVRFParser:
def __init__(self, xml_doc: ET.ElementTree):
self.cvrf_doc = xml_doc.getroot()
@sbs2001
sbs2001 / profiler.py
Created June 20, 2020 13:29
This is the script used to get the SQL queries upon writing an Advisory to db
from collections import OrderedDict
from packageurl import PackageURL
from vulnerabilities import models
from vulnerabilities.data_source import Advisory
from vulnerabilities.import_runner import _get_or_create_package
from vulnerabilities.import_runner import _get_or_create_vulnerability
def update_advisory(advisory: Advisory) :

Adding a new Importer to VulnerableCode

Adding a new Importer to VulnerableCode

@sbs2001
sbs2001 / models_diff.md
Last active June 20, 2020 10:43
This is comparision of new models vs old models

Vulnerability model diff

Old Vulnerability model

class Vulnerability(models.Model):
   cve_id = models.CharField(max_length=50, help_text='CVE ID', unique=True, null=True)
   summary = models.TextField(help_text='Summary of the vulnerability', blank=True)
   cvss = models.FloatField(max_length=100, help_text='CVSS Score', null=True)
@sbs2001
sbs2001 / importer.md
Last active June 18, 2020 13:02
This is documentation to add new importer to vulnerablecode

Adding a new Importer to VulnerableCode

This tutorial contains all the things one should know to quickly implement an Importer.

The Building Blocks A.K.A Prerequisites

(1) PackageURL : VulnerableCode decodes PackageURL objects and writes them into DB. PackageURL's constructor requires 3 arguments to be instantiated these are :

    name