Skip to content

Commit

Permalink
Merge pull request #76 from blst-security/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
GuyL99 authored Sep 4, 2022
2 parents d117028 + 3726389 commit 344a71c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ serde_json = "1.0"
tokio = { version = "^1.0", features = ["full"] }
futures = "0.3"
futures-util = { version = "^0.3", default-features = false, features = ["alloc"] }
cherrybomb-swagger = "^0.1"
#cherrybomb-swagger = "^0.1"
cherrybomb-swagger = {path="../swagger"}
reqwest = { version = "^0.11",default_features = false, features = ["json","rustls-tls"] }
colored = "2.0.0"
url = { version = "2" }
Expand Down
2 changes: 1 addition & 1 deletion swagger/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use swagger::*;

#[tokio::main]
async fn main() {
let f_name = "";
let f_name = "../../../Downloads/openapi (1).json";
let swagger_value: serde_json::Value =
serde_json::from_str(&std::fs::read_to_string(f_name).unwrap()).unwrap();

Expand Down
13 changes: 7 additions & 6 deletions swagger/src/scan/active/http_client/req.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ impl AttackRequestBuilder {
}
pub fn auth(&mut self, auth: Authorization) -> &mut Self {
self.auth = auth;
self.add_auth_to_params();
self
}
pub fn method(&mut self, method: Method) -> &mut Self {
Expand All @@ -36,11 +37,10 @@ impl AttackRequestBuilder {
self.payload = payload.to_string();
self
}
pub fn add_auth_to_params(&mut self)-> &mut Self{
pub fn add_auth_to_params(&mut self){
if let Some(a) = self.auth.get_auth(){
self.parameters.push(a);
}
self
}
pub fn build(&self)->AttackRequest{
AttackRequest {
Expand Down Expand Up @@ -82,11 +82,12 @@ impl AttackRequest {
let mut query = String::from('?');
let mut path_ext = self.path.to_string();
let mut headers = vec![];
let mut payload = self.payload.clone();
for param in self.parameters.iter() {
match param.dm {
// QuePay::Payload => {
// payload.push_str(&format!("\"{}\":{},", param.name, param.value))
// }
QuePay::Payload => {
payload.push_str(&format!("\"{}\":{},", param.name, param.value))
}
QuePay::Query => query.push_str(&format!("{}={}&", param.name, param.value)),
QuePay::Path => {
path_ext =
Expand All @@ -102,7 +103,7 @@ impl AttackRequest {
}
}
query.pop();
(self.payload.clone(), query, path_ext, headers)
(payload, query, path_ext, headers)
}
pub fn get_headers(&self,payload_headers: &[MHeader]) -> HashMap<String, String> {
self.headers
Expand Down

0 comments on commit 344a71c

Please sign in to comment.