diff --git a/src/main.rs b/src/main.rs
index b100163..20da11f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -15,10 +15,16 @@ enum Commands {
     Download(MapList),
     Upload,
     Scan,
+    Extract(Map),
     Replace,
     Interactive,
 }
 
+#[derive(Args)]
+struct Map {
+    id:u64,
+}
+
 #[derive(Args)]
 struct MapList {
     maps: Vec<u64>,
@@ -203,6 +209,42 @@ fn scan() -> Result<(), Box<dyn std::error::Error>>{
     std::fs::write("id",id.to_string())?;
     Ok(())
 }
+fn extract(file_id:u64) -> Result<(), Box<dyn std::error::Error>>{
+    let mut id = 0;
+    //Construct allowed scripts
+    let mut script_set = std::collections::HashSet::<String>::new();
+
+    let file_id_string=file_id.to_string();
+
+    for entry in std::fs::read_dir("maps/unprocessed")? {
+        let file_thing=entry?;
+        if file_thing.file_name().to_str().unwrap().find(&file_id_string).is_none(){
+            continue;
+        }
+        let input = std::io::BufReader::new(std::fs::File::open(file_thing.path())?);
+
+        let dom = rbx_binary::from_reader(input)?;
+
+        let scripts = get_scripts(dom);
+
+        //extract scribb
+        for script in scripts.iter() {
+            if let Some(rbx_dom_weak::types::Variant::String(s)) = script.properties.get("Source") {
+                if script_set.contains(s) {
+                    continue;
+                }else{
+                    script_set.insert(s.clone());
+                    std::fs::write(format!("scripts/extracted/{:?}_{}_{}.lua",file_thing.file_name(),id,script.name),s)?;
+                    id+=1;
+                }
+            }else{
+                panic!("FATAL: failed to get source for {:?}",file_thing.file_name());
+            }
+        }
+    }
+    println!("extracted {} {}",id,if id==1 {"script"}else{"scripts"});
+    Ok(())
+}
 fn replace() -> Result<(), Box<dyn std::error::Error>>{
     let allowed_map=get_allowed_map()?;
     let replace_map=get_replace_map()?;
@@ -457,5 +499,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
         Commands::Scan=>scan(),
         Commands::Replace=>replace(),
         Commands::Interactive=>interactive(),
+        Commands::Extract(map)=>extract(map.id),
     }
 }