看起来大多数 SWF 文件(如果不是全部的话)实际上都是包含自身压缩版本的 swf“文件”。我已经看到您可以使用一些工具来提取文件
$ flasm -x player.swf
Flasm configuration file flasm.ini not found, using default values
player.swf successfully decompressed, 206239 bytes
$ 7z x player.swf
7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Processing archive: player.swf
Extracting player~.swf
Everything is Ok
Size: 206239
Compressed: 106427
但是我希望使用更“传统”的东西从这些中提取,例如
tar
或 gzip
最佳答案
来自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.
更新 作为对评论的回应,这里有一个小 bash 脚本,它是上述内容的直译:
#!/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
然后你会遇到一组
*.swf
文件(假设您将其保存为 uncompress_swf.sh
):uncompress_swf.sh /some/folder/*.swf
它会说类似的东西
uncompressed /some/folder/a.swf
uncompressed /some/folder/b.swf
uncompressing to /some/folder/uncompressed_c.swf
如果某些东西看起来根本不像 Flash 文件,它会向 stderr 打印一个错误。
免责声明 这就是我阅读引用规范的方式。我刚刚检查过使用此脚本会产生与使用
7z x
时相同的输出。在输入瑞士法郎。
关于command-line - 从 SWF 中提取命令行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11679113/