use reqwest::header::{HeaderMap, SET_COOKIE};
pub fn try_extract_link_from_normal_html(html: &String) -> Option<String> {
if let Some(s) = html.split("aria-label=\"Download file\"").nth(1) {
if let Some(s) = s.split("id=\"downloadButton\"").nth(0) {
return Some(s.trim().replace("href=", "").replace("\"", ""));
}
}
None
}
pub fn try_extract_security_token_from_malware_html(html: &String) -> Option<(String, String)> {
if let Some(s) = html.split("{pass: '").nth(1) {
if let Some(pass) = s.split("'").nth(0) {
if let Some(s) = html.split("data-security-token=\"").nth(2) {
if let Some(security_token) = s.split("\"").nth(0) {
return Some((security_token.to_string(), pass.to_string()));
}
}
}
}
None
}
pub fn extract_ukey(headers: &HeaderMap) -> Option<String> {
if let Some(cookies) = headers.get(SET_COOKIE) {
if let Some(s) = cookies.to_str().ok()?.split("; ").nth(0) {
return Some(s.replace("ukey=", ""));
}
}
None
}