Esempio n. 1
0
 def establish_requirements(self):
     x = 0
     query, headers, results = QueryDB(self.arguments).main()
     print("Query: " + str(query))
     for requirement in results:
         x += 1
         if x not in self.requirements:
             self.requirements[x] = dict()
         for index, req in enumerate(requirement):
             req_header = headers[index]
             if not req_header in self.requirements[x]:
                 self.requirements[x][req_header] = req
Esempio n. 2
0
 def main(self):
     self.available_tables = QueryDB(
         self.arguments).show_tables()  # Save list of available tables
     if self.arguments.execute:
         if self.arguments.system or self.arguments.tenant or (
                 self.arguments.tenant and self.arguments.app):
             self.run()
         else:
             print(
                 "\nNecessary Fields not filled out to execute.... Sending to Prompt"
             )
             self.prompt()
     else:
         self.prompt()
Esempio n. 3
0
 def establish_requirements(
     self
 ):  # Figure out which environments to loop through and create groups for
     x = 0
     query, headers, results = QueryDB(self.arguments).main()
     for requirement in results:
         x += 1
         if x not in self.requirements:
             self.requirements[x] = dict()
         if x not in self.secure_requirements:
             self.secure_requirements[x] = dict()
         for index, req in enumerate(requirement):
             req_header = headers[index]
             if not req_header in self.requirements[x]:
                 self.requirements[x][req_header] = req
             if not req_header in self.secure_requirements[
                     x] and req_header != 'Password':
                 self.secure_requirements[x][req_header] = req
Esempio n. 4
0
    def define_dictionary_results(
            self, query, var):  # Perform query and add data to dictionary
        query, title, all_results = QueryDB(self.arguments).query(query)
        x = 0
        for result in all_results:
            x += 1
            for index, r in enumerate(result):
                if var == self.app_groups or var == self.tenant_groups:
                    if title[index] == 'Name' or title[index] == 'Member_Of':
                        if self.arguments.app:
                            r = r.replace('app', self.arguments.app)
                        if self.arguments.tenant:
                            r = r.replace('tenant', self.arguments.tenant)

                if title[index] == 'Member_Of':
                    r = r.split(',\n')
                if len(r) >= 1 and (type(r) != list() and len(r[0]) >= 1):
                    if x not in var:
                        var[x] = dict()
                    if not title[index] in var[x]:
                        var[x][title[index]] = r