Beispiel #1
0
    def do_run(self, line):
        """
Running the current application. This method should be redefined for each util.
        """
        print
        # Checking if all the required parameters have been set
        if self._checkIfRequiredAreSet():
            print "Collecting the options set by the user..."
            # Getting the parser...
            parser = mailfy.getParser()

            # Generating the parameters
            params = self._getParams()

            args = parser.parse_args(params)

            print "Launching the util with the following parameters: " + str(
                params)
            print
            try:
                mailfy.main(args)
            except Exception as e:
                print "[!] ERROR. Something happenned when launching the utility. Type 'show options' to check the parameters. "
                print "Traceback: " + str(e)
        else:
            print "[!] ERROR. There are required parameters which have not been set."
            self.do_show("options")
        print
def runQuery(program, args=[]):
    """
    Function that wraps the queries

    It automatically launches the corresponding application function. The
    parameters are built as if they were submitted using the command line.

    Args:
    -----
        program: A String represnting the application to be launched.
        args: A list of the parameters to be launched.

    Returns:
    --------
        A JSON object representing the results.
    """
    print args
    # Selecting the appropriate program
    if program == "domainfy":
        answer = domainfy.main(args)
    elif program == "entify":
        answer = entify.main(args)
    elif program == "mailfy":
        answer = mailfy.main(args)
    elif program == "phonefy":
        answer = phonefy.main(args)
    elif program == "searchfy":
        answer = searchfy.main(args)
    elif program == "usufy":
        answer = usufy.main(args)

    # Returning the output
    return answer
Beispiel #3
0
    def do_run(self, line):
        """
        Command that send the order to the framework to launch this util

        Args:
        -----
            line: The string of the line typed.
        """
        # Checking if all the required parameters have been set
        if self._checkIfRequiredAreSet():
            print(
                general.info("\nCollecting the options set by the user...\n"))
            # Getting the parser...
            parser = mailfy.getParser()

            # Generating the parameters
            params = self._getParams()

            args = parser.parse_args(params)

            print(
                general.info("\nLaunching " + self.UNAME +
                             " with the following parameters:") +
                general.emphasis("\t$ " + self.UNAME + " " +
                                 utils.listToString(params) + "\n"))

            try:
                mailfy.main(args)
            except Exception as e:
                print(
                    general.error(
                        "\n[!!] ERROR. Something happened when launching the utility. Type 'show options' to check the parameters.\n"
                    ))
                print(general.error("Traceback: " + str(e)))
        else:
            print(
                general.error(
                    "\n[!!] ERROR. There are required parameters which have not been set."
                ))
            self.do_show("options")
        print(general.success("Execution ended successfully."))
def runQuery(program, args=[]):
    """Function that wraps the queries.
    """
    # Selecting the appropriate program
    if program == "domainfy":
        answer = domainfy.main(args)
    elif program == "entify":
        answer = entify.main(args)
    elif program == "mailfy":
        answer = mailfy.main(args)
    elif program == "phonefy":
        answer = phonefy.main(args)
    elif program == "searchfy":
        answer = searchfy.main(args)
    elif program == "usufy":
        answer = usufy.main(args)

    # Returning the output
    return answer