Esempio n. 1
0
 def test_get_spread(self):
     from nimbus import Nimbus
     nimbus = Nimbus()
     nimbus.new_project()
     nimbus.project.networks.create()
     network = nimbus.project.networks.get(0)
     network.nodes.create_node()
     node = network.nodes.get(0)
     node.basins.create()
     basin = node.basins.get(0)
     network.links.create_gutter()
     gutter = network.links.get(0)
     basin.shapes.create()
     basin.shapes.create()
     shape1 = basin.shapes.get(0)
     shape1.area = 0.23
     shape1.c = 0.95
     shape2 = basin.shapes.get(1)
     shape2.area = 0.02
     shape2.c = 0.20
     gutter.node1 = node
     gutter.mannings = 0.016
     gutter.long_slope = 0.003
     gutter.section.xs_slope = 0.03
     spread = gutter.get_spread(4.0)
     self.assertAlmostEqual(spread, 6.71, 1)
Esempio n. 2
0
 def test_get_spread(self):
     from nimbus import Nimbus
     nimbus = Nimbus()
     nimbus.new_project()
     nimbus.project.networks.create()
     network = nimbus.project.networks.get(0)
     network.nodes.create_node()
     node = network.nodes.get(0)
     node.basins.create()
     basin = node.basins.get(0)
     network.links.create_gutter()
     gutter = network.links.get(0)
     basin.shapes.create()
     basin.shapes.create()
     shape1 = basin.shapes.get(0)
     shape1.area = 0.23
     shape1.c = 0.95
     shape2 = basin.shapes.get(1)
     shape2.area = 0.02
     shape2.c = 0.20
     gutter.node1 = node
     gutter.mannings = 0.016
     gutter.long_slope = 0.003
     gutter.section.xs_slope = 0.03
     spread = gutter.get_spread(4.0)
     self.assertAlmostEqual(spread, 6.71, 1)
Esempio n. 3
0
    def __init__(self, url=None, ip=None):
        """[ CRAWLER ] Just Crawling Around"""
        import argparse
        super(Arachnida, self).__init__()
        Nimbus.__init__(self)

        self.name = "Crawler Object"
        self.modus = "[ CRAWLER|MODE ]"
        self.colors = {"back": Back.RED, "fore": Fore.GREEN}

        self.session_id = id(self)
        self.session_name = "nimbus " + self.colors['back'] + self.colors['fore'] + "{}".format(self.modus) + Style.RESET_ALL + " \> "
        self.session_crawl = True

        self.queue = self._queue_crawler

        from Core.banners import Banners
        Banners.arachnida()

        self.sprint("ACTIVATED", mode=self.modus)

        self.parser = argparse.ArgumentParser(prog="Nimbus Framework {}".format(self.modus), description="Need it any description?", argument_default=None, epilog="Nimbus // Rain with Rage, Exploit with Love")
        self.parser.add_argument('command', help="Use command to begin")

        while self.session_crawl:
            self.command = input(self.session_name)
            if not self.command:
                self.sprint("No Command Given", mode=self.modus)
                continue
            else:
                import re

                if re.match("-", self.command.split()[0]):
                    self.sprint("Wrong! Dont use OPTIONS but choose a COMMAND", mode=self.modus)
                    print(self.usage())
                    continue
                elif self.command.split()[0] == "?":
                    print(self.usage())
                else:
                    self.args = self.parser.parse_args(self.command.split()[0:1])

                    try:
                        if hasattr(self, self.args.command):
                            """ Maybe the Most Important Code of the Whole Framework """
                            getattr(self, self.args.command)()

                        elif not hasattr(self, self.args.command):

                            self.sprint("Unrecognized command", mode=self.modus)
                            self.sprint("try again pall", mode=self.modus)
                            self.sprint("*" * 40 + "\n")
                            print(self.usage(), "\n")
                            self.sprint("*" * 40 + "\n")
                            continue
                        else:
                            print("%s\n%s\n%s" % ("*"*40, "* If you see this message, something went HORRIBLY wrong! Call for help!", "*"*40))
                    except Exception as e:
                        print(str("[ {}_EXCEPTION ]".format(self.__class__.__name__)).upper(), str(e))
Esempio n. 4
0
 def test_copy_node(self):
     from nimbus import Nimbus
     nimbus = Nimbus()
     nimbus.new_project()
     nimbus.project.networks.create()
     network = nimbus.project.networks.get(0)
     network.nodes.create()
     network.nodes.copy(0)
     self.assertNotEqual(network.nodes.get(0), network.nodes.get(1))
Esempio n. 5
0
 def test_copy_node(self):
     from nimbus import Nimbus
     nimbus = Nimbus()
     nimbus.new_project()
     nimbus.project.networks.create()
     network = nimbus.project.networks.get(0)
     network.nodes.create()
     network.nodes.copy(0)
     self.assertNotEqual(network.nodes.get(0), network.nodes.get(1))
Esempio n. 6
0
    def __init__(self):
        Nimbus.__init__(self)

        from Core.banners import BannersMain
        main = BannersMain()
        main.randomize()

        self.session_name = "nimbus \> "
        self.session_state = True
        self.session_id = id(self)
        self.function_name = ""
        self._shared_modus = "nimbus \> "

        self.parser = argparse.ArgumentParser(prog="Nimbus Framework", description="Need it any description?", argument_default=None, epilog="Nimbus // Rain with Rage, Exploit with Love")
        self.parser.add_argument('command', help="Use command to begin")

        while self.session_state:
            self.command = input(self.session_name)
            if not self.command:
                sprint("No Command Given")
                continue
            else:
                import re

                if re.match("-", self.command.split()[0]):
                    sprint("Wrong! Dont use OPTIONS but choose a COMMAND")
                    print(self.usage())
                    continue
                elif self.command.split()[0] == "?":
                    print(self.usage())
                else:
                    self.args = self.parser.parse_args(self.command.split()[0:1])

                    try:
                        if hasattr(self, self.args.command):
                            """ Maybe the Most Important Code of the Whole Framework """
                            # print("[ HAS ATTRIBUTE ]")
                            getattr(self, self.args.command)()
                            # print("[ AFTER ATTRIBUTE ]")

                        elif not hasattr(self, self.args.command):

                            sprint("Unrecognized command")
                            sprint("try again pall")
                            sleep(1)
                            sprint("*" * 40 + "\n")
                            print(self.usage(), "\n")
                            sprint("*" * 40 + "\n")
                            continue
                        else:
                            print("%s\n%s\n%s" % ("*"*40, "* If you see this message, something went HORRIBLY wrong! Call for help!", "*"*40))
                    except Exception as e:
                        print("[ EXCEPTION ]", str(e))
Esempio n. 7
0
 def test_copy(self):
     from nimbus import Nimbus
     nimbus = Nimbus()
     nimbus.new_project()
     nimbus.project.networks.create()
     network = nimbus.project.networks.get(0)
     network.nodes.create()
     network_node = network.nodes.get(0)
     network_node.start_stage = 0.0
     nimbus.project.simulations.create()
     simulation = nimbus.project.simulations.get(0)
     simulation.networks.add_from(0, nimbus.project.networks.list)
     simulation.duration = 1.0
     simulation.interval = 1.0
     simulation.rainfall = 1.0
     from nimbus.storms.defaults import sfwmd72
     simulation.distribution = sfwmd72
     simulation.run_and_set_result()
     result_node = simulation.result.nodes[0]
     self.assertNotEqual(network_node, result_node)
Esempio n. 8
0
 def test_copy(self):
     from nimbus import Nimbus
     nimbus = Nimbus()
     nimbus.new_project()
     nimbus.project.networks.create()
     network = nimbus.project.networks.get(0)
     network.nodes.create()
     network_node = network.nodes.get(0)
     network_node.start_stage = 0.0
     nimbus.project.simulations.create()
     simulation = nimbus.project.simulations.get(0)
     simulation.networks.add_from(0, nimbus.project.networks.list)
     simulation.duration = 1.0
     simulation.interval = 1.0
     simulation.rainfall = 1.0
     from nimbus.storms.defaults import sfwmd72
     simulation.distribution = sfwmd72
     simulation.run_and_set_result()
     result_node = simulation.result.nodes[0]
     self.assertNotEqual(network_node, result_node)
Esempio n. 9
0

from nimbus import Nimbus
nimbus = Nimbus()
nimbus.load_project('examples/test_file.npf')
network = nimbus.project.networks[0]
node = network.nodes[1]
basin = node.basins[0]
basin.report_inputs()
Esempio n. 10
0
                              NimbusDatabaseError, NimbusMySQLAlchemy)
from modules.formatters import WakeWordFormatter
from modules.validators import WakeWordValidator, WakeWordValidatorError

from nimbus import Nimbus

BAD_REQUEST = 400
SUCCESS = 200

CONFIG_FILE_PATH = 'config.json'

app = Flask(__name__)
CORS(app)

# TODO: Initialize this somewhere else.
nimbus = Nimbus()


@app.route('/', methods=['GET', 'POST'])
def hello():
    if (request.method == 'POST'):
        request_body = request.get_json()
        return jsonify({'you sent': request_body})
    else:
        response_code = 42
        response_json = jsonify({'name': 'hello {}'.format(str(app))})
        return response_json, response_code


def generate_session_token() -> str:
    return "SOME_NEW_TOKEN"