-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08ed93e
commit 2709993
Showing
4 changed files
with
60 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
pub mod scan; | ||
pub mod new; | ||
use structopt::StructOpt; | ||
use scan::UrlsOpts; | ||
use new::NewOpts; | ||
|
||
#[derive(Debug, StructOpt)] | ||
#[structopt( | ||
name = "Lotus", | ||
about = "Fast Web Security Scanner written in Rust based on Lua Scripts" | ||
)] | ||
pub enum Opts { | ||
#[structopt(about = "Create a lua example code based on the type of scan")] | ||
NEW(NewOpts), | ||
#[structopt(about = "Use CVE, VULN scripts to scan the given URLs")] | ||
URLS(UrlsOpts), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use crate::cli::errors::CliErrors; | ||
use std::path::PathBuf; | ||
use structopt::StructOpt; | ||
|
||
|
||
fn get_script_type(script_type: &str) -> Result<ScriptType, CliErrors> { | ||
let script_type = match script_type { | ||
"fuzz" => ScriptType::Fuzz, | ||
"cve" => ScriptType::CVE, | ||
"passive" => ScriptType::PASSIVE, | ||
"service" => ScriptType::SERVICE, | ||
_ => ScriptType::NotSupported, | ||
}; | ||
if script_type == ScriptType::NotSupported { | ||
Err(CliErrors::UnsupportedScript) | ||
} else { | ||
Ok(script_type) | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
#[derive(Debug, PartialEq)] | ||
pub enum ScriptType { | ||
Fuzz, | ||
CVE, | ||
PASSIVE, | ||
SERVICE, | ||
NotSupported, | ||
} | ||
|
||
|
||
|
||
#[derive(Debug, StructOpt)] | ||
pub struct NewOpts { | ||
#[structopt(short = "-s", long, parse(try_from_str = get_script_type))] | ||
pub scan_type: ScriptType, | ||
#[structopt(short = "f", long)] | ||
pub file_name: PathBuf, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters