[][src]Module rusty_hogs::google_scanning

Collection of tools for scanning Google Suite for secrets. Currently only supports Google Drive.

GoogleScanner acts as a wrapper around a SecretScanner object to provide helper functions for performing scanning against Google Drive files. Relies on the google_drive3 library which provides a wrapper around the Google Drive API.

Examples

Basic usage requires you to create a GDriveScanner object:

use rusty_hogs::google_scanning::GDriveScanner;

let gs = GDriveScanner::new();

Alternatively you can customize the way the secret scanning will work by building a SecretScanner object and supplying it to the GDriveScanner constructor:

use rusty_hogs::SecretScannerBuilder;
use rusty_hogs::google_scanning::GDriveScanner;
let ss = SecretScannerBuilder::new().set_pretty_print(true).build();
let gs = GDriveScanner::new_from_scanner(ss);

The next step is to create an authenticated DriveHub object and use it to create a GDriveFileInfo object.

Lastly, pass all these objects to the perform_scan method of GDriveScanner.

use rusty_hogs::SecretScannerBuilder;
use rusty_hogs::google_scanning::{GDriveScanner, GDriveFileInfo};
use google_drive3::DriveHub;

// Initialize some variables
let gdrive_scanner = GDriveScanner::new();

// Start with GDrive auth - based on example code from drive3 API and yup-oauth2
let hub = DriveHub::new(
    hyper::Client::with_connector(hyper::net::HttpsConnector::new(
        hyper_rustls::TlsClient::new(),
    )),
    auth,
);

// get some initial info about the file
let gdriveinfo = GDriveFileInfo::new("gdrive_file_id", &hub).unwrap();

// Do the scan
let findings = gdrive_scanner.perform_scan(&gdriveinfo, &hub, false);
gdrive_scanner.secret_scanner.output_findings(&findings);

Structs

GDriveFileInfo

A helper object containing a set of strings describing a Google Drive file.

GDriveFinding

serde_json object that represents a single found secret - finding

GDriveScanner

Contains helper functions for performing scans of Google Drive objects