Giter Club home page Giter Club logo

flawz's Introduction

GitHub Release Crate Release Continuous Integration Continuous Deployment Documentation


flawz is a Terminal User Interface (TUI) for browsing the security vulnerabilities (also known as CVEs).

As default it uses the vulnerability database (NVD) from NIST and provides search and listing functionalities in the terminal with different theming options.

For example, to view details on the notorious xz vulnerability:

flawz --feeds 2024 --query xz

demo

Table of Contents

Installation

Packaging status

Packaging status

Cargo

flawz can be installed from crates.io using cargo if Rust is installed.

cargo install flawz

The minimum supported Rust version (MSRV) is 1.74.1.

Arch Linux

flawz can be installed from the official repositories using pacman:

pacman -S flawz

Alpine Linux

flawz is available for Alpine Edge. It can be installed via apk after enabling the testing repository.

apk add flawz

Homebrew

flawz is available for macOS via Homebrew. It can be installed using brew

brew install flawz

Nixpkgs

flawz is available for Nix via nixpkgs-unstable channel. To make it available in the environment, simply run:

nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update nixpkgs
nix-env -iA nixpkgs.flawz

On NixOS:

nix-channel --add https://nixos.org/channels/nixos-unstable
nix-channel --update nixos
nix-env -iA nixos.flawz

Alternatively, if you're using the new experimental CLI, you can use the following:

nix run nixpkgs#flawz

NetBSD

flawz is available from the official repositories. To install it, simply run:

pkgin install flawz

Binary releases

See the available binaries for different targets from the releases page.

Build from source

  1. Clone the repository.
git clone https://github.com/orhun/flawz && cd flawz/
  1. Build.
CARGO_TARGET_DIR=target cargo build --release

Binary will be located at target/release/flawz.

Usage

flawz [OPTIONS]

Options:

  --url <URL>           A URL where NIST CVE 1.1 feeds can be found [env: URL=] [default:
                        https://nvd.nist.gov/feeds/json/cve/1.1/]
-f, --feeds [<FEEDS>...]  List of feeds that are going to be synced [env: FEEDS=] [default: 2002:2024 recent
                        modified]
-d, --db <DB>             Path to the SQLite database used to store the synced CVE data [env: DB=]
-u, --force-update        Always fetch feeds
-o, --offline             Do not fetch feeds
-q, --query <QUERY>       Start with a search query [env: QUERY=]
-t, --theme <THEME>       Set the theme [default: dracula] [possible values: dracula, nord, one-dark,
                        solarized-dark]
-h, --help                Print help (see more with '--help')
-V, --version             Print version

Key bindings

Key Action Description
k / Up Scroll Up Scroll up the list
j / Down Scroll Down Scroll down the list
Enter Select View the selected CVE details
/ Search Search for a CVE
Space Open Open the first CVE reference in the browser
q Quit Set computer on fire

Examples

To start with a specific search query:

flawz --query "buffer overflow"

You can use the --feeds option to sync specific years of feeds:

flawz --feeds 2010:2015 recent

Additionally, you can use the following flags:

  • --force-update: Always fetch feeds, even if they are already up to date.
  • --offline: Run without fetching feeds (useful if you have already synced the data):

For example, you can use the following command to search for a specific vulnerability from 2014:

flawz -q "CVE-2014-0160" -f 2014 --force-update

Themes

Start flawz with --theme option to set a custom theme, e.g. --theme nord.

Dracula (default)

dracula

Nord

nord

One Dark

one dark

Solarized Dark

solarized dark

Support

Support me on GitHub Sponsors

If you find flawz and/or other projects on my GitHub useful, consider supporting me on GitHub Sponsors! 💖

Contributing

See our Contribution Guide and please follow the Code of Conduct in all your interactions with the project.

License

License: MIT License: Apache 2.0

Licensed under either of Apache License Version 2.0 or The MIT License at your option.

🦀 ノ( º _ º ノ) - respect crables!

Copyright

Copyright © 2024, Orhun Parmaksız

flawz's People

Contributors

0323pin avatar 0x61nas avatar dependabot[bot] avatar krehel avatar mertssmnoglu avatar orhun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flawz's Issues

make completions and manpage as subcommands?

👋 right now, the cargo build generates flawz-completions and flawz-mapage, I wonder if it would be better to create subcommands as flawz completions and flawz manpage. Let me know if that makes sense.

Press `space` to open the first http(s) reference in browser

Is your feature request related to a problem? Please describe.

I wanted to open the reference links of a random CVE and tried to clicking the urls with ctrl + click but it doesn't open anything. I need to write the whoole url to my web browser manually.

Describe the solution you'd like

Pressing space button can trigger xdg-open HTTP_URL, open HTTP_URL or something like that.

Describe alternatives you've considered

Surfing around the references with j,k or up,down keys and opening them in Web Browser via space

Additional context

The details page that I talking about.
20240518_23h31m07s_grim

There is also ftp:// urls too, thats why I highlighted http(s) in the feature request.

Insufficient space for long CVEs name

Describe the bug

Some CVE numbers are using CVE-{4}-{5} format and flawz's current Name column constraint percentage(%13) is not enough to see last char.

To reproduce

  1. Use flawz -q "CVE-2024-21512"
  2. Unable to see last char of the CVE number

Expected behavior

Clearly see entire CVE number

Screenshots / Logs

20240602_00h18m34s_grim

Software information

  • Operating system: Arch GNU/Linux x86_64 6.8.9-zen1-2-zen
  • Project version: 0.2.0

Hardware information

  • Screen Resolution: 1920x1080
  • Aspect Ratio: 16:9

Additional context

I want to know if I'm the only one encountering this problem.
💬 Feedback from the community could be good. I started a discussion #25

Highlight search results

Is your feature request related to a problem? Please describe.

While searching, it would be visually nice to see the found results being highlighted in the list.

For example:

image

Describe the solution you'd like

This needs some reading on displaying text docs but I'm thinking we can simply change the colors of Spans somehow.

Describe alternatives you've considered

None.

Additional context

See https://ratatui.rs/how-to/render/display-text and

flawz/src/main.rs

Lines 73 to 85 in 32fb9ac

let items = items
.into_iter()
.filter(|cve| {
query.is_empty()
|| cve.id.to_lowercase().contains(&query)
|| cve
.description
.clone()
.unwrap_or_default()
.to_lowercase()
.contains(&query)
})
.collect();

Program panicked while scrolling CVE list with mouse

Describe the bug

thread 'main' panicked at /Users/brew/Library/Caches/Homebrew/cargo_cache/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.2/src/text/line.rs:477:59:
byte index 82 is not a char boundary; it is inside '\u{a0}' (bytes 81..83) of The vCenter Server contains an authenticated remote code execution vulnerability. A
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

To reproduce

I believe this is happening due to a specific CVE (hard to tell which one because it crashes before you can see it). If you search for The vCenter Server and then keep scrolling down, it should eventually panic.

Expected behavior

No crash

Software information

  • Operating system: macOS Sonoma 14.5 (23F79)
  • Rust version: I don't have Rust installed, this was installed from Homebrew
  • Project version: flawz 0.1.1

Add logging

Is your feature request related to a problem? Please describe.

nvd_cve crate shows some logs regarding the fetched feeds but flawz do not use any logging.

Describe the solution you'd like

We can initialize logging via crates env_logger or tracing crates and log the following information at startup:

  • Database location (debug)
  • Fetched feeds (info)
  • Database URL
  • And so on.

Describe alternatives you've considered

None.

Additional context

Just for context, nvd_cve logs the feed info as follows:

image

Add options menu

Is your feature request related to a problem? Please describe.

It would be nice to have an options menu for tweaking the options (e.g. feed) inside the TUI.

We should also display the current feed etc. somewhere on the TUI. I haven't thought out the design yet.

Describe the solution you'd like

Add an options menu similar to kmon (popup in the center of the screen):

https://user-images.githubusercontent.com/24392180/76685907-4aed1d80-6628-11ea-96b7-a5bc0597455b.gif

Describe alternatives you've considered

None.

Additional context

Brainstorming is appreciated!

BUG | failed to send tick event: SendError { .. }

Describe the bug

I just want to try flawz without any arguments/flags to see how it results. It worked, but when I want to quit I expecting it to end without any logs but it gave me a panic warning.

thread '<unnamed>' panicked at src/event.rs:65:50
failed to send tick event: SendError { .. }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To reproduce

Steps to reproduce the behavior:

  1. Installed with sudo pacman -S flawz // Successful
  2. Run with 0 arguments and 0 flags, only flawz
  3. Waited to sync all CVEs
  4. All CVEs listed, pressed q to quit.

Expected behavior

Exiting with code 0 without any logs

Screenshots / Logs

20240518_23h12m29s_grim

Software information

  • Operating system: Arch GNU/Linux x86_64 6.8.9-zen1-2-zen
  • Rust version: rustc 1.73.0 (cc66ad468 2023-10-03)
  • Project version: 0.1.0-1

Additional context

I also tried to follow the guide on the logs,

First:

20240518_23h12m48s_grim
It gives null stack backtrace, I followed up with RUST_BACKTRACE=full

Second:

20240518_23h12m58s_grim

Show system vulnerabilities

Is your feature request related to a problem? Please describe.

flawz is initially designed to only browse the security vulnerabilities. However, we can expand the scope of this project by also showing the vulnerabilities found in the system.

Describe the solution you'd like

Add a new tab to the TUI called "system". Upon switching to this tab show the security vulnerabilities on the current system and related/affected packages.

However, this will be a highly distro-dependent solution. For example, we can use arch-audit on Arch Linux for querying the vulnerabilities and pkg-audit for other distros.

Describe alternatives you've considered

We can also support this via SSH somehow which will be useful to check the vulnerabilities on remote servers.

Additional context

Thanks @kpcyrd for the idea!

Failed to install flawz with cargo

bug when trying to install flawz (with cargo)

error: linking with cc failed: exit status: 1
= note: /usr/bin/ld: cannot find -lsqlite3: No such file or directory
collect2: error: ld returned 1 exit status

To reproduce

  1. cargo install flawz

Expected behavior

Screenshots / Logs

Software information

  • Operating system: Ubuntu 23.10
  • Rust version: rustc 1.77.1 (7cf61ebde 2024-03-27)
  • Project version: flawz 0.1.0

Additional context

Add more themes

Is your feature request related to a problem? Please describe.

The currently supported themes are listed in README.md and we need more themes!

Describe the solution you'd like

Adding a theme is easy:

  1. Add the new variant to BuiltinTheme enum:

flawz/src/theme.rs

Lines 5 to 17 in 32fb9ac

/// Built-in theme.
#[derive(Debug, Clone, PartialEq, ValueEnum, Default)]
pub enum BuiltinTheme {
/// Dracula.
#[default]
Dracula,
/// Nord.
Nord,
/// One Dark.
OneDark,
/// Solarized Dark.
SolarizedDark,
}

  1. Add a new function for the theme colors:

flawz/src/theme.rs

Lines 62 to 89 in 32fb9ac

/// <https://draculatheme.com/contribute>
fn dracula_theme() -> Option<Theme> {
Some(Theme {
background: Style::default()
.bg(Color::from_str("#282A36").ok()?)
.fg(Color::from_str("#F8F8F2").ok()?),
dim: Style::default()
.bg(Color::from_str("#282A36").ok()?)
.fg(Color::from_str("#44475A").ok()?),
foreground: Style::default().fg(Color::from_str("#F8F8F2").ok()?),
header: Style::default()
.bg(Color::from_str("#BD93F9").ok()?)
.fg(Color::from_str("#282A36").ok()?),
footer: Style::default()
.bg(Color::from_str("#282A36").ok()?)
.fg(Color::from_str("#8BE9FD").ok()?),
selected: Style::default()
.bg(Color::from_str("#44475A").ok()?)
.fg(Color::from_str("#FFB86C").ok()?),
borders: Style::default().fg(Color::from_str("#44475A").ok()?),
separator: Style::default().fg(Color::from_str("#6272A4").ok()?),
highlight: Style::default().fg(Color::from_str("#F1FA8C").ok()?),
index: Style::default().fg(Color::from_str("#BD93F9").ok()?),
input: Style::default().fg(Color::from_str("#50FA7B").ok()?),
input_empty: Style::default().fg(Color::from_str("#FF79C6").ok()?),
scrollbar: Style::default().fg(Color::from_str("#6272A4").ok()?),
})
}

  1. Add screenshot in assets/ and update README.md

Describe alternatives you've considered

None.

Additional context

I would love to have a light theme.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.