Created
November 23, 2020 16:28
-
-
Save remi-dupre/1e717480c39dc2097c169a01d72b8963 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::prelude::*; | |
use std::{env::args, fs::File}; | |
use swf::read_swf; | |
fn main() { | |
let swl_path = args().nth(1).expect("missing path"); | |
let swl = { | |
let mut file = File::open(&swl_path).expect("can't open swl file"); | |
let mut swl = Vec::new(); | |
file.read_to_end(&mut swl).unwrap(); | |
swl | |
}; | |
for i in 0..swl.len() { | |
if let Ok(swf) = read_swf(&swl[i..]) { | |
println!("--- {} is valid from byte {}", &swl_path, i); | |
println!(" - Header: {:?}", swf.header); | |
println!(" - Prefix: {}", String::from_utf8_lossy(&swl[..i])); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment