Relevant quote from http://www.adobe.com/content/dam/Adobe/en/devnet/swf/pdf/swf_file_format_spec_v10.pdf
The header begins with a three-byte signature of either 0x46, 0x57, 0x53 (“FWS”); or 0x43, 0x57, 0x53 (“CWS”).
- An FWS signature indicates an uncompressed SWF file;
- CWS indicates that the entire file after the first 8 bytes (that is, after the FileLength field) was compressed by using the ZLIB open standard.
The data format that the ZLIB library uses is described by Request for Comments (RFCs) documents 1950 to 1952. CWS file compression is permitted in SWF 6 or later only.
Update In response to the comment, here's a little bash script that is a literal translation of what the above seems to describe:
#!/bin/bash
for swf in "$@"
do
signature=$(dd if="$swf" bs=1 count=3 2> /dev/null)
case "$signature" in
FWS)
echo -e "uncompressed\t$swf"
;;
CWS)
targetname="$(dirname "$swf")/uncompressed_$(basename "$swf")"
echo "uncompressing to $targetname"
dd if="$swf" bs=1 skip=8 2>/dev/null |
(echo -n 'FWS';
dd if="$swf" bs=1 skip=3 count=5 2>/dev/null;
zlib-flate -uncompress) > "$targetname"
;;
*)
{
echo -e "unrecognized\t$swf"
file "$swf"
} > /dev/stderr
;;
esac
done
Which you'd then run across a set of *.swf
files (assume you saved it as uncompress_swf.sh
):
uncompress_swf.sh /some/folder/*.swf
It will say stuff like
uncompressed /some/folder/a.swf
uncompressed /some/folder/b.swf
uncompressing to /some/folder/uncompressed_c.swf
If something didn't look like a flash file, at all, it will print an error to stderr.
DISCLAIMER This is just the way I read the quoted spec. I have just checked that using this script resulted in identical output as when I had used 7z x
on the input swf.