Skip to content

Instantly share code, notes, and snippets.

@remi-dupre
Created November 23, 2020 16:28
Show Gist options
  • Save remi-dupre/1e717480c39dc2097c169a01d72b8963 to your computer and use it in GitHub Desktop.
Save remi-dupre/1e717480c39dc2097c169a01d72b8963 to your computer and use it in GitHub Desktop.
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