Module#
scf.models#
Contain models used by this package
- class scf.models.CVE(*, name: str, description: str, url: str, overall_state: scf.models.OverallState = None, cvss: scf.models.CVSS = None, simplified_rating: scf.models.SimplifiedRating = None, affected_products: List[scf.models.Product] = None)#
Bases:
pydantic.main.BaseModel
Holds all the information about the cve
- asdict()#
Returns the data as dict
- json()#
Returns the data as json
- tree()#
Creates a pretty rich tree object
- class scf.models.CVSS(*, score: float, vector: scf.models.CVSSVector, version: str)#
Bases:
pydantic.main.BaseModel
Contains the fetched cvss information
- tree()#
Creates a pretty rich tree object
- class scf.models.CVSSVector(*, raw: str, access_vector: str, access_complexity: str, privileges_required: str, user_interaction: str, scope: str, confidentiality_impact: str, integrity_impact: str, availability_impact: str, version: str)#
Bases:
pydantic.main.BaseModel
Contains the parsed vector information
- static from_string(cvss_str)#
Parses a raw cvss vector string
- tree()#
Creates a pretty rich tree object
- class scf.models.OverallState(value)#
Bases:
str
,enum.Enum
Overall state by Suse: https://www.suse.com/c/cve-pages-self-help-security-issues-suse-linux-enterprise/
- pretty()#
Returns the colorized enum value
- class scf.models.Product(*, name: str, package: str, state: scf.models.State)#
Bases:
pydantic.main.BaseModel
Contains information about a package that may or maybe not is affected by a given cve
- tree()#
Creates a pretty rich tree object
- class scf.models.SimplifiedRating(value)#
Bases:
str
,enum.Enum
Simplified Rating by Suse: https://www.suse.com/support/security/rating/
- pretty()#
Returns the colorized enum value
scf.suse#
Contains the code to fetch the informations from suse.com
- class scf.suse.Cache#
Bases:
object
Holds the session instance
- scf.suse.get_all_cve(timeout: int = 30, use_cache: bool = False) list #
Fetches all cves
- scf.suse.get_cve_details(cve: str, timeout: int = 30, use_cache: bool = True) scf.models.CVE #
Fetches the details of a cve
Returns a CVE object
- scf.suse.list_cve_by_year(timeout: int = 30, use_cache: bool = False) Dict[str, list] #
Fetches all cves grouped by year
Returns a dict with the years as keys and the cves as values in a list
- scf.suse.prefetch_cve(cve: str, timeout: int = 30) str #
Prefetches the cve and save the html into cache
- scf.suse.url_to_soup(url: str, timeout: int = 30, use_cache: bool = True)#
Fetches the html and returns a beautifulsoup instance
scf.cli#
- scf.cli.cache_cmd_clean() None #
Remove expired cache entries
- scf.cli.cache_cmd_clear() None #
Clear the whole cache
- scf.cli.cache_cmd_populate(cve_filter: str = <typer.models.OptionInfo object>, workers: int = <typer.models.OptionInfo object>) None #
Prefetch all the cve data
- scf.cli.cache_cmd_stats() None #
Get some stats about the cache
- scf.cli.config_cmd_dump()#
Dumps the current config
- scf.cli.config_cmd_edit()#
Edit the current config
- scf.cli.config_cmd_init(overwrite: bool = <typer.models.OptionInfo object>) None #
Creates the default config in the home directory
- scf.cli.cve_cmd_details(name: str = <typer.models.ArgumentInfo object>, disable_cache: bool = <typer.models.OptionInfo object>, field: str = <typer.models.OptionInfo object>, use_json: bool = <typer.models.OptionInfo object>) None #
Fetch the details of a given cve
- scf.cli.cve_cmd_list(year: bool = <typer.models.OptionInfo object>, use_cache: bool = <typer.models.OptionInfo object>, use_json: bool = <typer.models.OptionInfo object>) None #
Fetch the known cve for a given year or all.
- scf.cli.cve_cmd_watch(command: str = <typer.models.OptionInfo object>, test: bool = <typer.models.OptionInfo object>, interval: int = <typer.models.OptionInfo object>) None #
Show the latest CVE as they get published
- scf.cli.main(_: typing.Optional[bool] = <typer.models.OptionInfo object>) None #
scf fetches informations about CVEs from suse.com.
- scf.cli.random() x in the interval [0, 1). #
- scf.cli.server_cmd_run(host: str = <typer.models.OptionInfo object>, port: int = <typer.models.OptionInfo object>, workers: int = <typer.models.OptionInfo object>) None #
Starts the uvicorn server
scf.server#
Small api server
- async scf.server.cache_clean()#
Clean the cache
- async scf.server.cache_clear()#
Clear the cache
- async scf.server.cve(use_cache: bool = False)#
Returns a list with all cves
- async scf.server.cve_by_id(cve_id: str, use_cache: bool = True)#
Returns the details for a given cve
- async scf.server.cve_by_year(year: str, use_cache: bool = False)#
Returns a list with all cves in the given year
- async scf.server.cve_by_years(use_cache: bool = False)#
Returns a list with all cves grouped by year
- scf.server.run(host: str = '0.0.0.0', port: int = 8000, workers: int = 1) None #
Starts the uvicorn server
scf.config#
Contains config specific stuff
scf.utils#
Contains helper functions
- scf.utils.file_size(path: pathlib.Path, human_readable: bool = True) str #
Gets the filesize and optionally formats it
- scf.utils.find_by_path(element: str, json: dict)#
Finds a value by a gived key-path src: https://stackoverflow.com/a/31033676
- scf.utils.numeric(cve: str) Tuple[int, int] #
Returns a numeric cve number for sorting