All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.denimgroup.threadfix.cli.OptionsHolder Maven / Gradle / Ivy

Go to download

This module contains library classes for accessing the ThreadFix REST API. The ThreadFix IDE plugins use this library to retrieve application and vulnerability marker information, and in the ThreadFix scanner plugins to get endpoint information and upload scans to ThreadFix applications. The easiest way to start using the library is with the PluginClient or ThreadFixRestClient classes. Both have constructors that take a PropertiesManager instance, which holds the ThreadFix API key and url information. The default PropertiesManager implementation stores these properties in threadfix.properties, but the ThreadFix plugins extend the default PropertiesManager class to override this behavior for the target platform.

The newest version!
////////////////////////////////////////////////////////////////////////
//
//     Copyright (c) 2009-2015 Denim Group, Ltd.
//
//     The contents of this file are subject to the Mozilla Public License
//     Version 2.0 (the "License"); you may not use this file except in
//     compliance with the License. You may obtain a copy of the License at
//     http://www.mozilla.org/MPL/
//
//     Software distributed under the License is distributed on an "AS IS"
//     basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
//     License for the specific language governing rights and limitations
//     under the License.
//
//     The Original Code is ThreadFix.
//
//     The Initial Developer of the Original Code is Denim Group, Ltd.
//     Portions created by Denim Group, Ltd. are Copyright (C)
//     Denim Group, Ltd. All Rights Reserved.
//
//     Contributor(s): Denim Group, Ltd.
//
////////////////////////////////////////////////////////////////////////

package com.denimgroup.threadfix.cli;

import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;

public class OptionsHolder {

    @SuppressWarnings("static-access")
    public static Options getOptions() {
        Options options = new Options();

        Option property  = OptionBuilder.withArgName( "unsafe-ssl" )
                .hasArgs(1)
                .withValueSeparator()
                .withDescription( "unsafe-ssl to force ThreadFix to accept unsigned certificates." )
                .create( "D" );
        options.addOption(property);

        Option teams = OptionBuilder.withLongOpt("teams")
                .withDescription("Fetches a list of ThreadFix teams and applications.")
                .create("t");
        options.addOption(teams);

        Option teamsPrettyPrint = OptionBuilder.withLongOpt("teamsPrettyPrint")
                .withDescription("Fetches a human readable list of ThreadFix teams, applications, and application IDs.")
                .create("tpp");
        options.addOption(teamsPrettyPrint);

        options.addOption(new Option("help", "Print this message" ));

        Option set = OptionBuilder.withArgName("property>   <[scan profile Id]")
                .hasArgs(3)
                .withLongOpt("queueScan")
                .withDescription("Queue a scan for the given applicationId with the given scanner type")
                .create("q");
        options.addOption(queueScan);

        Option addAppUrl = OptionBuilder.withArgName("applicationId>               <[tagType]")
//                .hasArgs(2)
//                .withLongOpt("create-tag")
//                .withDescription("Creates a ThreadFix Tag and returns its JSON. tagType is optional, default is Application Tag.")
//                .create("ctg");
//        options.addOption(createTag);

//        Option searchTag = OptionBuilder.withArgName("property>      <[commentTagIds]")
//                .hasArgs(3)
//                .withLongOpt("add-comment")
//                .withDescription("Add comment to a vulnerability. CommentTagIds is optional, separated by comma.")
//                .create("ac");
//        options.addOption(addComment);
//
//        Option submitDefect = OptionBuilder.withArgName("applicationId> <[vulnerabilityIds]> <[*]")
//                .hasArgs(1)
//                .hasOptionalArgs()
//                .withLongOpt("submit-defect")
//                .withDescription("Submit a defect to the defect tracker configured for a specific application.")
//                .create("sd");
//        options.addOption(submitDefect);
//
//        Option getDefectParameters = OptionBuilder.withArgName("applicationId>")
//                .hasArgs(1)
//                .withLongOpt("get-defect-parameters")
//                .withDescription("Get a list of parameters from the defect tracker given an application ID.")
//                .create("gdp");
//        options.addOption(getDefectParameters);

        return options;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy