myph-v2.git


myph-v2

~ rust shellcode loader with evasive capabilities
git clone https://github.com/djnnvx/myph-v2.git
log | files | refs | archive | README

dependencies.rs (2069B)

      1 fn aes_dependencies_template() -> &'static str {
      2     r#"
      3 aes = "0.8"
      4 cbc = "0.1"
      5 cipher = { version = "0.4", features = ["std"] }
      6 "#
      7 }
      8 
      9 fn chacha20_dependencies_template() -> &'static str {
     10     r#"
     11 chacha20 = "0.9"
     12 cipher = { version = "0.4", features = ["std"] }
     13 "#
     14 }
     15 
     16 fn blowfish_dependencies_template() -> &'static str {
     17     r#"
     18 blowfish = "0.9"
     19 cbc = "0.1"
     20 cipher = { version = "0.4", features = ["std"] }
     21 "#
     22 }
     23 
     24 fn aes256_dependencies_template() -> &'static str {
     25     r#"
     26 aes = "0.8"
     27 cbc = "0.1"
     28 cipher = { version = "0.4", features = ["std"] }
     29 "#
     30 }
     31 
     32 fn twofish_dependencies_template() -> &'static str {
     33     r#"
     34 twofish = "0.7"
     35 cbc = "0.1"
     36 cipher = { version = "0.4", features = ["std"] }
     37 "#
     38 }
     39 
     40 fn camellia_dependencies_template() -> &'static str {
     41     r#"
     42 camellia = "0.1"
     43 cbc = "0.1"
     44 cipher = { version = "0.4", features = ["std"] }
     45 "#
     46 }
     47 
     48 fn api_resolver_dependencies() -> &'static str {
     49     r#"
     50 ntapi = "0.4"
     51 winapi = { version = "0.3", features = ["ntdef"] }
     52 "#
     53 }
     54 
     55 fn callstack_spoofing_dependencies() -> &'static str {
     56     r#"
     57 uwd = "0.3.5"
     58 "#
     59 }
     60 
     61 pub fn get_dependencies_for_encryption(encryption_type: &str) -> Result<&'static str, String> {
     62     match encryption_type {
     63         "aes" => Ok(aes_dependencies_template()),
     64         "aes256" => Ok(aes256_dependencies_template()),
     65         "chacha20" => Ok(chacha20_dependencies_template()),
     66         "blowfish" => Ok(blowfish_dependencies_template()),
     67         "twofish" => Ok(twofish_dependencies_template()),
     68         "camellia" => Ok(camellia_dependencies_template()),
     69         "xor" => Ok(""),
     70         _ => Err(format!("Unknown encryption type: {}", encryption_type)),
     71     }
     72 }
     73 
     74 pub fn get_dependencies(
     75     encryption_type: &str,
     76     with_dynamic_resolver: bool,
     77     with_callstack_spoofing: bool,
     78 ) -> Result<String, String> {
     79     let mut deps = get_dependencies_for_encryption(encryption_type)?.to_string();
     80 
     81     if with_dynamic_resolver {
     82         deps.push_str(api_resolver_dependencies());
     83     }
     84 
     85     if with_callstack_spoofing {
     86         deps.push_str(callstack_spoofing_dependencies());
     87     }
     88 
     89     Ok(deps)
     90 }