[][src]Struct bruteforce::BruteForce

pub struct BruteForce<'a> {
    pub chars: &'a [char],
    pub current: String,
    // some fields omitted
}

Represents a brute-forcing instance

Fields

chars: &'a [char]

Represents the charset of the brute-forcer

current: String

This is the current string

Methods

impl<'a> BruteForce<'a>[src]

Important traits for BruteForce<'a>
pub fn new(charset: &[char]) -> BruteForce[src]

Returns a brute forcer with default settings

Arguments

  • charset - A char array that contains all chars to be tried

Example

use bruteforce::BruteForce;
let mut brute_forcer = BruteForce::new(bruteforce::UPPERCASE_CHARS);

const password: &'static str = "PASS";
for s in brute_forcer {
if s == password.to_string() {
       println!("Password cracked");
       break;
   }
}

Important traits for BruteForce<'a>
pub fn new_at(charset: &[char], start: usize) -> BruteForce[src]

Returns a brute forcer skipping some letters ///

Arguments

  • charset - A char array that contains all chars to be tried
  • start - E.g. the known password length

Example

// This example will take less time, because we know the password length
use bruteforce::BruteForce;
let mut brute_forcer = BruteForce::new_at(bruteforce::UPPERCASE_CHARS, 4);

const password: &'static str = "PASS";
for s in brute_forcer {
if s == password.to_string() {
       println!("Password cracked");
       break;
   }
}

Important traits for BruteForce<'a>
pub fn new_by_start_string(charset: &[char], start_string: String) -> BruteForce[src]

Returns a brute forcer skipping some text ///

Arguments

  • charset - A char array that contains all chars to be tried
  • start_string - A string

Example

// This could be useful if we want to save our brute force progress and resume it later
use bruteforce::BruteForce;
let mut brute_forcer = BruteForce::new_by_start_string(bruteforce::UPPERCASE_CHARS, "CCCC".to_string());

const password: &'static str = "PASS";
for s in brute_forcer {
if s == password.to_string() {
       println!("Password cracked");
       break;
   }
}

pub fn raw_next(&mut self) -> &str[src]

This returns the next element without unnecessary boxing in a Option

Trait Implementations

impl<'a> Iterator for BruteForce<'a>[src]

type Item = String

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a> RefUnwindSafe for BruteForce<'a>

impl<'a> Send for BruteForce<'a>

impl<'a> Sync for BruteForce<'a>

impl<'a> Unpin for BruteForce<'a>

impl<'a> UnwindSafe for BruteForce<'a>

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<T> From<T> for T[src]

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

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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.