操作脚本、NativeProcess、resolvePath和swf不起作用



我将公开我的问题,但首先我必须向您展示我的配置,以便向您提供所有细节。

我有2台虚拟机,2个窗口7。第一个,它是我开发所有动作脚本的地方,那里有我的开发环境(IDE),第二个没有安装任何特殊的东西。两者都有Adobe AIR和Adobe Flash Player。

好的,这是我的问题。我(在第一个脚本上)开发了一个使用NativeProcess运行CMD.exe的脚本,该脚本在命令行中加载dll。当我构建&运行项目一切正常,我检查并加载dll。但问题是,当第二个Windows连接到我的localhost网站(连接到作为服务器播放的第一个窗口)并运行不加载我的dll的文件"myProgram.swf"(ActionScript程序)时。

现在我把我所有的代码都打印给你:

这是加载dll"myProgram.swf"的脚本:

 public class NativeProcessExample extends Sprite
{
    public var process:NativeProcess;
    public function NativeProcessExample()
    {
        if(NativeProcess.isSupported)
        {
            setupAndLaunch();
        }
        else
        {
            trace("NativeProcess not supported.");
        }
    }
    public function setupAndLaunch():void
    {     
        var fmt:TextFormat = new TextFormat();
        var txt:TextField = new TextField();
        fmt.size = 32;
        txt.text = 'Hello, world!' + 'n' +
            'Width = ' + stage.fullScreenWidth + 'n' +
            'Height = ' + stage.fullScreenHeight;
        txt.setTextFormat(fmt);
        txt.autoSize = TextFieldAutoSize.LEFT;
        addChild(txt);

        var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
        var file:File = File.applicationDirectory.resolvePath("C:\Windows\System32\regsvr32.exe");
        nativeProcessStartupInfo.executable = file;

        var args:Vector.<String> = new Vector.<String>();
        args.push("C:\Users\myUser\Downloads\myDLL.dll");
        nativeProcessStartupInfo.arguments = args;
        var process:NativeProcess = new NativeProcess();
        process.start(nativeProcessStartupInfo);
        process.addEventListener(NativeProcessExitEvent.EXIT, exitHandler);

我剪了(我删除了所有的包括和结束部分)脚本,因为它太长了,但这里是最有趣的部分。

现在,我将向您展示我的"index.php"第二个Windows连接到哪里以恢复和注入dll。:

<!DOCTYPE html>
<html>
<head>
    <title>Test</title>
            <style type="text/css">
                    body, html
                    {
                            width:100%;
                            height:100%;
                            overflow:hidden;
                    }
                    #SWFSquare
                    {
                            height: 200px;
                            width: 200px;
                            background-color: blue;
                    }
            </style>
            <script type="text/javascript" src="swfobject.js"></script>
            <script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
            <script src="https://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
</head>
<body bgcolor="#ffdfaf">

    <div id="SWFSquare">
    </div>
    <input type="button" value="Download" id="buttonDownload" style="margin-left: auto; margin-right: auto; display: block;">
    <script type="text/javascript">
            $(function() {
            $("#buttonDownload").click(function() {
                    window.open("myDLL.dll");
                    myFunction();
            });
            function myFunction() {

                    setTimeout(function(){
                            var element = document.getElementById("SWFSquare");
                            swfobject.embedSWF("myProgram.swf", element, 300, 120, 10);
                    },10000);
            }
    });
    </script>
</body>
</html>

所以我希望你们掌握了所有需要的信息。请随时向我询问更多信息。

提醒一下。当我在我的开发环境(IDE)下的第一个Windows上启动我的脚本时,一切都正常,我的DLL被加载,但当我尝试通过连接到index.php(=第一个Windows作为服务器)在第二个Windows上加载它时,SWF工作,因为我在页面上收到消息"HelloWorld",但DLL没有加载。。。

你能帮我吗?我为此工作了两周:-(.

首先,感谢大家的快速响应:-)

因此,我将回答"Akmozo的问题:

正如你在我的ActionScript的描述中看到的,它将使用"NativeProcess"来运行cmd,该cmd将执行加载myDLL.dll 的命令

所以,我只需要执行swf就可以开始这一切。这就是AIR-app和swf之间的关系。我在FlashDevelop环境中工作,每个脚本"myProgram.as"都会创建一个"myProgram.swf"文件。一旦我得到这个文件(自动创建),我只需要通过我的"index.php"在网上运行它,更确切地说,通过以下代码:

var element = document.getElementById("SWFSquare");
swfobject.embedSWF("myProgram.swf", element, 300, 120, 10);

所以,当第二个窗口连接到运行myProgram.swf的index.php时,我还没有加载dll。。。

这是我的问题。我回答你"阿克兹莫佐"了吗?

现在,对于您的答案"VC.one",我认为应该可以在我特别准备的环境中进行。也就是说:

  • 带有上次更新和修补程序的第一个Windows
  • 第二个没有更新的Windows,也没有最后一个Flash Player(目前是2006年9月19日)

我是一名IT安全研究员(学生),这就是为什么我现在正在研究Adobe Flash Player 19的漏洞。通常情况下,可以这样做,因为这项工作已经有了CVE,我会(重新)创建这个场景。但我总是被这个问题卡住,我想我错过了一些东西,但我不知道它是什么…

但我总是纠结于这个问题,我想我错过了一些东西但我不知道它是什么…

@阿克莫佐是对的。Flash Player(浏览器)&AIR(操作系统应用程序)是将AS3代码作为应用程序运行的两种不同方式它们的工作方式并不总是一样(由于安全原因,浏览器Flash Player插件提供的AS3应用程序受到了更大的限制,它不能在计算机上运行程序,否则黑客和病毒创建者会用这种力量找到天堂,通过互联网传播混乱)。

还想一想,如果SWF是从Mac或Linux浏览器运行的,会发生什么?这些操作系统如何加载dll(因为它是一个仅限Windows的文件)?这打破了浏览器中的代码在任何地方都能工作的规则,无论平台如何。

只是为了证明一点。。。更新您的文本字段代码如下所示。在IDE测试中,它应该说(NP) Support = true,但在浏览器中,你会得到= false。当然,如果为false,则无法从浏览器加载dll。

var fmt:TextFormat = new TextFormat();
var txt:TextField = new TextField();
fmt.size = 32;
txt.text = 'Hello, world!' + 'n' +
'Width = ' + stage.fullScreenWidth + 'n' +
'Height = ' + stage.fullScreenHeight + 'n' +
'(NP) Support = ' + String(NativeProcess.isSupported); //# check if available
txt.setTextFormat(fmt);
txt.autoSize = TextFieldAutoSize.LEFT;
addChild(txt);

最新更新