[][src]Struct rusty_hogs::SecretScanner

pub struct SecretScanner {
    pub regex_map: BTreeMap<String, Regex>,
    pub pretty_print: bool,
    pub output_path: Option<String>,
}

Contains helper functions and the map of regular expressions that are used to find secrets

The main object that provides the "secret scanning" functionality. The regex_map field provides all the regular expressions that the secret scanner will look for. Use get_matches(line: [u8]) to perform a regex.find_iter() for each regular expression in regex_map. get_matches will return another BTreeMap where the key is the name of the regular expression and the value is a Matches object.

Fields

regex_map: BTreeMap<String, Regex>pretty_print: booloutput_path: Option<String>

Methods

impl SecretScanner[src]

pub fn set_logging(verbose_level: u64)[src]

Helper function to set global logging level

pub fn matches<'a, 'b: 'a>(
    &'a self,
    line: &'b [u8]
) -> BTreeMap<&'a String, Matches>
[src]

Scan a byte array for regular expression matches, returns a BTreeMap of Matches for each regular expression.

pub fn entropy_findings(line: &[u8]) -> Vec<String>[src]

Scan a byte array for arbitrary hex sequences and base64 sequences. Will return a list of matches for those sequences with a high amount of entropy, potentially indicating a private key.

pub fn output_findings<T: Serialize + Eq + Hash>(&self, findings: &HashSet<T>)[src]

Helper function that takes a HashSet of serializable structs and outputs them as JSON Side effect: May write to the file-system based on self.output_path

Trait Implementations

impl Clone for SecretScanner[src]

impl Debug for SecretScanner[src]

impl Default for SecretScanner[src]

impl Display for SecretScanner[src]

impl Eq for SecretScanner[src]

impl Hash for SecretScanner[src]

impl PartialEq<SecretScanner> for SecretScanner[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err

impl<T> Typeable for T where
    T: Any