Package org.parosproxy.paros.extension

Examples of org.parosproxy.paros.extension.CommandLineArgument


        System.out.println("Scanner completed.");

    }

    private CommandLineArgument[] getCommandLineArguments() {
        arguments[ARG_SCAN_IDX] = new CommandLineArgument("-scan", 0, null, "", "-scan : Run vulnerability scan depending on previously saved policy.");
        return arguments;
    }
View Full Code Here


         
    }

  public void parse(Vector commandList) throws Exception {
      this.commandList = commandList;
      CommandLineArgument lastArg = null;
      boolean found = false;
      int remainingValueCount = 0;
     
      for (int i=0; i<args.length; i++) {
          if (args[i] == null) continue;
          found = false;
         
        for (int j=0; j<commandList.size() && !found; j++) {
            CommandLineArgument[] extArg = (CommandLineArgument[]) commandList.get(j);
            for (int k=0; k<extArg.length && !found; k++)
            if (args[i].compareToIgnoreCase(extArg[k].getName()) == 0) {
               
                // check if previous keyword satisfied its required no. of parameters
                if (remainingValueCount > 0) {
                  throw new Exception("Missing parameters for keyword '" + lastArg.getName() + "'.");
                }
               
                // process this keyword
                lastArg = extArg[k];
                lastArg.setEnabled(true);
                found = true;
                args[i] = null;
                remainingValueCount = lastArg.getNumOfArguments();
            }
        }


        // check if current string is a keyword preceded by '-'
        if (args[i] != null && args[i].startsWith("-")) {
            continue;
        }

        // check if there is no more expected param value
        if (lastArg != null && remainingValueCount == 0) {
            continue;
        }
       
        // check if consume remaining for last matched keywords
        if (!found && lastArg != null) {               
            if (lastArg.getPattern() == null || lastArg.getPattern().matcher(args[i]).find()) {
                lastArg.getArguments().add(args[i]);
                if (remainingValueCount > 0) {
                    remainingValueCount--;
                }
                args[i] = null;
            } else {
                throw new Exception(lastArg.getErrorMessage());
            }
        }
       
      }

      // check if the last keyword satified its no. of parameters.
      if (lastArg != null && remainingValueCount > 0) {
            throw new Exception("Missing parameters for keyword '" + lastArg.getName() + "'.");
        }
     
      // check if there is some unknown keywords
      for (int i=0; i<args.length; i++) {
          if (args[i] != null) {
View Full Code Here

        System.out.println("Spider completed.");

    }

    private CommandLineArgument[] getCommandLineArguments() {
        arguments[ARG_SPIDER_IDX] = new CommandLineArgument("-spider", 0, null, "", "-spider : run spider.  See other parameters");
        arguments[ARG_URL_IDX] = new CommandLineArgument("-seed", -1, "https{0,1}://\\S+", "Seed should be a URL", "-seed {URL1} {URL2} ... : Add seeds to the spider for crawling.");
        return arguments;
    }
View Full Code Here

     * @see org.parosproxy.paros.extension.CommandLineListener#execute(org.parosproxy.paros.extension.CommandLineArgument[])
     */
    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();
            String fileName = (String) arg.getArguments().get(0);
            try {
                report.generate(fileName, getModel());
                System.out.println("Last Scan Report generated at " + fileName);
            } catch (Exception e) {
               
View Full Code Here

        }

    }

    private CommandLineArgument[] getCommandLineArguments() {
        arguments[ARG_LAST_SCAN_REPORT_IDX] = new CommandLineArgument("-last_scan_report", 1, null, "", "-last_scan_report [file_path]: Generate 'Last Scan Report' into the file_path provided.");
        return arguments;
    }
View Full Code Here

        report.generate(rpt, getModel());
        return rpt.toString();
    }

    private CommandLineArgument[] getCommandLineArguments() {
        arguments[ARG_QUICK_URL_IDX] = new CommandLineArgument("-quickurl", 1, null, "",
            "-quickurl [target url]: " + Constant.messages.getString("quickstart.cmdline.url.help"));
        arguments[ARG_QUICK_OUT_IDX] = new CommandLineArgument("-quickout", 1, null, "",
            "-quickout [output filename]: " + Constant.messages.getString("quickstart.cmdline.out.help"));
        return arguments;
    }
View Full Code Here

    }
  }

  public void parse(Vector<CommandLineArgument[]> commandList) throws Exception {
    this.commandList = commandList;
    CommandLineArgument lastArg = null;
    boolean found = false;
    int remainingValueCount = 0;

    for (int i = 0; i < args.length; i++) {
      if (args[i] == null)
        continue;
      found = false;

      for (int j = 0; j < commandList.size() && !found; j++) {
        CommandLineArgument[] extArg = (CommandLineArgument[]) commandList.get(j);
        for (int k = 0; k < extArg.length && !found; k++)
          if (args[i].compareToIgnoreCase(extArg[k].getName()) == 0) {

            // check if previous keyword satisfied its required no.
            // of parameters
            if (remainingValueCount > 0) {
              throw new Exception(
                  "Missing parameters for keyword '"
                      + lastArg.getName() + "'.");
            }

            // process this keyword
            lastArg = extArg[k];
            lastArg.setEnabled(true);
            found = true;
            args[i] = null;
            remainingValueCount = lastArg.getNumOfArguments();
          }
      }

      // check if current string is a keyword preceded by '-'
      if (args[i] != null && args[i].startsWith("-")) {
        continue;
      }

      // check if there is no more expected param value
      if (lastArg != null && remainingValueCount == 0) {
        continue;
      }

      // check if consume remaining for last matched keywords
      if (!found && lastArg != null) {
        if (lastArg.getPattern() == null
            || lastArg.getPattern().matcher(args[i]).find()) {
          lastArg.getArguments().add(args[i]);
          if (remainingValueCount > 0) {
            remainingValueCount--;
          }
          args[i] = null;
        } else {
          throw new Exception(lastArg.getErrorMessage());
        }
      }

    }

    // check if the last keyword satified its no. of parameters.
    if (lastArg != null && remainingValueCount > 0) {
      throw new Exception("Missing parameters for keyword '"
          + lastArg.getName() + "'.");
    }

    // check if there is some unknown keywords
    for (int i = 0; i < args.length; i++) {
      if (args[i] != null) {
View Full Code Here

    System.out.println("Spider completed.");

  }

  private CommandLineArgument[] getCommandLineArguments() {
    arguments[ARG_SPIDER_IDX] = new CommandLineArgument("-spider", 0, null,
        "", "-spider : run spider.  See other parameters");
    arguments[ARG_URL_IDX] = new CommandLineArgument("-seed", -1,
        "https{0,1}://\\S+", "Seed should be a URL",
        "-seed {URL1} {URL2} ... : Add seeds to the spider for crawling.");
    return arguments;
  }
View Full Code Here

     * @see org.parosproxy.paros.extension.CommandLineListener#execute(org.parosproxy.paros.extension.CommandLineArgument[])
     */
    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();
            String fileName = (String) arg.getArguments().get(0);
            try {
                report.generate(fileName, getModel());
                System.out.println("Last Scan Report generated at " + fileName);
            } catch (Exception e) {
              // ZAP: Log the exception
View Full Code Here

        }

    }

    private CommandLineArgument[] getCommandLineArguments() {
        arguments[ARG_LAST_SCAN_REPORT_IDX] = new CommandLineArgument("-last_scan_report", 1, null, "", "-last_scan_report [file_path]: Generate 'Last Scan Report' into the file_path provided.");
        return arguments;
    }
View Full Code Here

TOP

Related Classes of org.parosproxy.paros.extension.CommandLineArgument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.