c# - 在 swf 文件上自动运行多个终端程序命令,然后使用 python 打印结果

标签 c# python linux flash ubuntu

我想制作一个接受 swf 文件名的 python 文件,并在终端中针对 3 个程序 trid(检查是否压缩)、flasm(解压缩)、swfdump(转储)运行它,并将日志打印成文本文件。

例如。终端命令: trid -v 文件名.swf

是否可以自动执行终端命令?如果是这样,如何在 python 中编写像上面那样的终端命令?

谢谢!

最佳答案

from subprocess import call, check_output

swf_file  = "filename.swf"
dump_file = "dump_swf.txt"

# run TrID on file and get results
result_string = check_output(["trid", "-v", filename])

# parse result_string - is it compressed?
??? YOUR CODE GOES HERE ???

if is_compressed:
    # decompress it
    call(["flasm", "-x", filename])

# decompile it
dump = check_output(["swfdump", "-D", filename])

# save the decompiled result
with open(dump_file, "w") as outf:
    outf.write(dump)

关于c# - 在 swf 文件上自动运行多个终端程序命令,然后使用 python 打印结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34302748/

相关文章:

c# - 使用 TFS SDK 更新工作项的超链接

c# - 将 StorageFile 上传到 PHP 文件

python - 使用 Python 2 运行的 Pylint 检查 Python 3 源代码

linux - 无法打开与身份验证代理的连接(REVIEW)

Linux批量重命名文件

c# - 第三方dll使程序崩溃,没有抛出异常

C# 和 C++ 套接字数据加密

python - 我怎样才能随机放置几个非碰撞矩形?

python - 假设等效于 QuickCheck 频率发生器?

linux - 如何在c++中不按Enter键读取字符