|
17 | 17 | */
|
18 | 18 |
|
19 | 19 | pub mod utils;
|
| 20 | +use console::Style; |
20 | 21 | use futures::lock::Mutex;
|
21 | 22 | use log::{debug, error, info, warn};
|
22 | 23 | use mlua::Lua;
|
@@ -118,6 +119,41 @@ impl<'a> LuaLoader<'a> {
|
118 | 119 |
|
119 | 120 | fn get_utilsfunc(&self, lua: &Lua) {
|
120 | 121 | // ProgressBar
|
| 122 | + let bar = self.bar.clone(); |
| 123 | + lua.globals() |
| 124 | + .set( |
| 125 | + "print_report", |
| 126 | + lua.create_function(move |_, the_report: OutReport| { |
| 127 | + let good_msg = format!("[{}]", Style::new().green().apply_to("+").to_string()); |
| 128 | + let info_msg = format!("[{}]", Style::new().blue().apply_to("#")); |
| 129 | + let report_msg = format!( |
| 130 | + " |
| 131 | +{GOOD} {NAME} on: {URL} |
| 132 | +{INFO} Description: {Description} |
| 133 | +{INFO} Vulnerable Parameter: {PARAM} |
| 134 | +{INFO} Risk: {RISK} |
| 135 | +{INFO} Used Payload: {ATTACK} |
| 136 | +{INFO} Matching Pattern: {MATCHING} |
| 137 | +#--------------------------------------------------# |
| 138 | +
|
| 139 | + ", |
| 140 | + GOOD = good_msg, |
| 141 | + INFO = info_msg, |
| 142 | + NAME = the_report.name.unwrap(), |
| 143 | + URL = the_report.url.unwrap(), |
| 144 | + Description = the_report.description.unwrap(), |
| 145 | + PARAM = the_report.param.unwrap(), |
| 146 | + RISK = the_report.risk.unwrap(), |
| 147 | + ATTACK = the_report.attack.unwrap(), |
| 148 | + MATCHING = format!("{}",Style::new().on_red().apply_to(the_report.evidence.unwrap())), |
| 149 | + ); |
| 150 | + bar.println(report_msg); |
| 151 | + Ok(()) |
| 152 | + }) |
| 153 | + .unwrap(), |
| 154 | + ) |
| 155 | + .unwrap(); |
| 156 | + |
121 | 157 | let bar = self.bar.clone();
|
122 | 158 | lua.globals()
|
123 | 159 | .set(
|
|
0 commit comments