Search in sources :

Example 1 with CommandLineArgument

use of org.parosproxy.paros.extension.CommandLineArgument in project zaproxy by zaproxy.

the class ExtensionReport method execute.

@Override
public void execute(CommandLineArgument[] args) {
    if (arguments[ARG_LAST_SCAN_REPORT_IDX].isEnabled()) {
        CommandLineArgument arg = arguments[ARG_LAST_SCAN_REPORT_IDX];
        ReportLastScan report = new ReportLastScan();
        // ZAP: Removed unnecessary cast.
        String fileName = arg.getArguments().get(0);
        try {
            report.generate(fileName, getModel(), "xml/report.html.xsl");
            CommandLine.info("Last Scan Report generated at " + fileName);
        } catch (Exception e) {
            CommandLine.error(e.getMessage(), e);
        }
    } else {
        return;
    }
}
Also used : CommandLineArgument(org.parosproxy.paros.extension.CommandLineArgument)

Example 2 with CommandLineArgument

use of org.parosproxy.paros.extension.CommandLineArgument in project zaproxy by zaproxy.

the class ExtensionDynSSL method getCommandLineArguments.

private CommandLineArgument[] getCommandLineArguments() {
    arguments[ARG_CERT_LOAD] = new CommandLineArgument("-certload", 1, null, "", "-certload <path>         " + Constant.messages.getString("dynssl.cmdline.certload"));
    arguments[ARG_CERT_PUB_DUMP] = new CommandLineArgument("-certpubdump", 1, null, "", "-certpubdump <path>      " + Constant.messages.getString("dynssl.cmdline.certpubdump"));
    arguments[ARG_CERT_FULL_DUMP] = new CommandLineArgument("-certfulldump", 1, null, "", "-certfulldump <path>     " + Constant.messages.getString("dynssl.cmdline.certfulldump"));
    return arguments;
}
Also used : CommandLineArgument(org.parosproxy.paros.extension.CommandLineArgument)

Example 3 with CommandLineArgument

use of org.parosproxy.paros.extension.CommandLineArgument in project zaproxy by zaproxy.

the class ExtensionAutoUpdate method getCommandLineArguments.

private CommandLineArgument[] getCommandLineArguments() {
    arguments[ARG_CFU_INSTALL_IDX] = new CommandLineArgument("-addoninstall", 1, null, "", "-addoninstall <addOnId>   " + Constant.messages.getString("cfu.cmdline.install.help"));
    arguments[ARG_CFU_INSTALL_ALL_IDX] = new CommandLineArgument("-addoninstallall", 0, null, "", "-addoninstallall          " + Constant.messages.getString("cfu.cmdline.installall.help"));
    arguments[ARG_CFU_UNINSTALL_IDX] = new CommandLineArgument("-addonuninstall", 1, null, "", "-addonuninstall <addOnId> " + Constant.messages.getString("cfu.cmdline.uninstall.help"));
    arguments[ARG_CFU_UPDATE_IDX] = new CommandLineArgument("-addonupdate", 0, null, "", "-addonupdate              " + Constant.messages.getString("cfu.cmdline.update.help"));
    arguments[ARG_CFU_LIST_IDX] = new CommandLineArgument("-addonlist", 0, null, "", "-addonlist                " + Constant.messages.getString("cfu.cmdline.list.help"));
    return arguments;
}
Also used : CommandLineArgument(org.parosproxy.paros.extension.CommandLineArgument)

Example 4 with CommandLineArgument

use of org.parosproxy.paros.extension.CommandLineArgument in project zaproxy by zaproxy.

the class CommandLineUnitTest method claWithMissingArgs.

@Test
void claWithMissingArgs() throws Exception {
    cmdLine = new CommandLine(new String[] { "-a", "aaa", "-b", "bbb" });
    Vector<CommandLineArgument[]> customArguments = new Vector<>();
    customArguments.add(new CommandLineArgument[] { new CommandLineArgument("-a", 1, null, null, null) });
    customArguments.add(new CommandLineArgument[] { new CommandLineArgument("-b", 2, null, null, null) });
    customArguments.add(new CommandLineArgument[] { new CommandLineArgument("-c", 3, null, null, null) });
    assertThrows(Exception.class, () -> cmdLine.parse(customArguments, NO_SUPPORTED_FILE_EXTENSIONS));
}
Also used : CommandLineArgument(org.parosproxy.paros.extension.CommandLineArgument) Matchers.containsString(org.hamcrest.Matchers.containsString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Vector(java.util.Vector) Test(org.junit.jupiter.api.Test)

Example 5 with CommandLineArgument

use of org.parosproxy.paros.extension.CommandLineArgument in project zaproxy by zaproxy.

the class CommandLineUnitTest method claWithoutArgs.

@Test
void claWithoutArgs() throws Exception {
    cmdLine = new CommandLine(new String[] { "-a", "-b" });
    Vector<CommandLineArgument[]> customArguments = new Vector<>();
    customArguments.add(new CommandLineArgument[] { new CommandLineArgument("-a", 0, null, null, null) });
    customArguments.add(new CommandLineArgument[] { new CommandLineArgument("-b", 0, null, null, null) });
    customArguments.add(new CommandLineArgument[] { new CommandLineArgument("-c", 0, null, null, null) });
    cmdLine.parse(customArguments, NO_SUPPORTED_FILE_EXTENSIONS);
    assertTrue(customArguments.get(0)[0].isEnabled());
    assertTrue(customArguments.get(1)[0].isEnabled());
    assertFalse(customArguments.get(2)[0].isEnabled());
}
Also used : CommandLineArgument(org.parosproxy.paros.extension.CommandLineArgument) Matchers.containsString(org.hamcrest.Matchers.containsString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Vector(java.util.Vector) Test(org.junit.jupiter.api.Test)

Aggregations

CommandLineArgument (org.parosproxy.paros.extension.CommandLineArgument)10 Vector (java.util.Vector)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5 Test (org.junit.jupiter.api.Test)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 File (java.io.File)1 CommandLineListener (org.parosproxy.paros.extension.CommandLineListener)1