Veracode上传API未显示复合操作:uploadandscan

时间:2013-12-26 16:21:24

标签: veracode

我已经阅读了VeraCode API Wrapper文档详细信息。我遵循了与“从Visual Studio引用Veracode API包装器”相关的所有步骤。

根据这些步骤,我能够创建一个UploadAPIWrapper类的实例,如下所述:

var uploadWrapper = new UploadAPIWrapper();

我能够看到包装器可以执行的所有简单操作,如下所述:

enter image description here

我还能够在命令提示符中看到复合动作uploadandscan,如下面的屏幕截图所示: enter image description here

但是无法看到包装器可以执行的复合操作,如uploadandscan。

任何人都可以在这里告诉我,以防我错过任何先决条件。

谢谢&问候, Santosh Kumar Patro

1 个答案:

答案 0 :(得分:0)

从命令行调用UploadAndScan操作时通常会传递的内容看起来或多或少如下:

VeracodeC#API.exe -action uploadandscan -appname appName -version version -createprofile true -filepath filePath -vuser username -vpassword password

因此,要使代码正常工作,您需要按如下方式修改它:

using System;
using System.Reflection;
using com.veracode.apiwrapper;

namespace ConsoleApplication3
{
using System;
{
    static void Main()
    {
        //----------------------------------------------------------
        String appName =        "enter-application-name-here";
        String version =        "enter-version-here";
        bool createProfile =    true;//or false;
        String filePath =       "enter-filepath-here";//ie: "C:\\file.exe"

        String username =       "enter-username-here";
        String password =       "enter-password-here";
        //----------------------------------------------------------

        //String[] args = <the same args that you pass when you call the UploadAndScan composite action>;
        String[] args = new String[]
        {
            "-action", "uploadandscan",
            "-appname", appName,
            "-version", version,
            "-createprofile", createProfile.ToString(),
            "-filepath", filePath,
            "-vuser", username,
            "-vpassword", password
        };

        Type t = System.Reflection.Assembly.GetAssembly(typeof(AbstractAPIWrapper)).GetType("com.veracode.apiwrapper.cli.VeracodeCommand");
        MethodInfo m = t.GetMethod("Main", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
        m.Invoke(null, new Object[] { args });

        Console.Read();
    }
}

}