Exemple #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(general.info("Collecting the options set by the user..."))
            # Getting the parser...
            parser = usufy.getParser()

            # Generating the parameters
            params = self._getParams()

            args = parser.parse_args(params)

            print(general.info("Launching " + self.UNAME + " with the following parameters: ") + general.emphashis(str(params)))

            try:
                usufy.main(args)
            except Exception as e:
                print(gemeral.error("[!] ERROR. Something happenned when launching the utility. Type 'show options' to check the parameters. "))
                print(general.error("Traceback: " + str(e)))
        else:
            print(general.error("[!] ERROR. There are required parameters which have not been set."))
            self.do_show("options")
        print(general.success("Execution ended successfully."))
Exemple #2
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 = usufy.getParser()

            # Generating the parameters
            params = self._getParams()

            args = parser.parse_args(params)

            print "Launching the util with the following parameters: " + str(
                params)
            print
            try:
                usufy.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
    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.
        """
        print
        # Checking if all the required parameters have been set
        if self._checkIfRequiredAreSet():
            print(general.info("Collecting the options set by the user..."))
            # Getting the parser...
            parser = phonefy.getParser()

            # Generating the parameters
            params = self._getParams()

            args = parser.parse_args(params)

            print(
                general.info("Launching " + self.UNAME +
                             " with the following parameters: ") +
                general.emphashis(str(params)))

            try:
                usufy.main(args)
            except Exception as e:
                print(
                    gemeral.error(
                        "[!] ERROR. Something happenned when launching the utility. Type 'show options' to check the parameters. "
                    ))
                print(general.error("Traceback: " + str(e)))
        else:
            print(
                general.error(
                    "[!] 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