Scan::Flagged

This commit is contained in:
Quaternions 2023-09-11 19:18:38 -07:00
parent 7523c4313a
commit 593b6902fd

View File

@ -82,6 +82,7 @@ fn download(map_list: Vec<u64>) -> Result<(), Box<dyn std::error::Error>>{
enum Scan{ enum Scan{
Passed, Passed,
Blocked, Blocked,
Flagged,
} }
fn scan() -> Result<(), Box<dyn std::error::Error>>{ fn scan() -> Result<(), Box<dyn std::error::Error>>{
let mut id = 0u32; let mut id = 0u32;
@ -115,6 +116,12 @@ fn scan() -> Result<(), Box<dyn std::error::Error>>{
let mut fail_type=Scan::Passed; let mut fail_type=Scan::Passed;
for script in scripts.iter() { for script in scripts.iter() {
if let Some(rbx_dom_weak::types::Variant::String(s)) = script.properties.get("Source") { if let Some(rbx_dom_weak::types::Variant::String(s)) = script.properties.get("Source") {
//flag keywords and instantly fail
if s.find("getfenv").is_some()||s.find("require").is_some(){
println!("{:?} - flagged.",file_thing.file_name());
fail_type=Scan::Flagged;
break;
}
if allowed_set.contains(s) { if allowed_set.contains(s) {
continue; continue;
}else{ }else{
@ -136,6 +143,7 @@ fn scan() -> Result<(), Box<dyn std::error::Error>>{
println!("{:?} - {} {} not allowed.",file_thing.file_name(),fail_count,if fail_count==1 {"script"}else{"scripts"}); println!("{:?} - {} {} not allowed.",file_thing.file_name(),fail_count,if fail_count==1 {"script"}else{"scripts"});
std::path::PathBuf::from("maps/purgatory") std::path::PathBuf::from("maps/purgatory")
} }
Scan::Flagged => std::path::PathBuf::from("maps/flagged")
}; };
dest.push(file_thing.file_name()); dest.push(file_thing.file_name());
std::fs::rename(file_thing.path(), dest)?; std::fs::rename(file_thing.path(), dest)?;