command-line - 从 SWF 中提取命令行?

标签 command-line flash

看起来大多数 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

但是我希望使用更“传统”的东西从这些中提取,例如targzip

最佳答案

来自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/

相关文章:

android - 防止 WebView 中的 Flash Player 故障,就像 Android 浏览器所做的那样

video - 从 SWF 视频中获取原始视频和音频转储

flash - AS3 如何检查 BitmapData 是否为空

c++ - 使用闪存驱动器将已编译的二进制文件复制到另一台机器

java - 在 Java 中获取特定进程的 CPU 使用率的正确命令行是什么

bash - Mac 终端上的 PyFERRET 命令不起作用

mysql - 通过 SSH 从 BASH 编写 MySQL 脚本

android - 从命令行安装 android 旧系统镜像 (ABI)

flash - AS3中的寻的导弹

command-line - 将文件从一个目录剪切复制粘贴到另一个目录的命令是什么