Exemple #1
0
def test_parser(test_case):
    parser = Parser(test_case['url'])
    expected = {
        'title': parser.get_title(),
        'name': parser.get_name(),
    }
    assert expected == test_case['expected']
Exemple #2
0
def test_parser(test_case):
    parser = Parser(test_case['url'])
    expected = {
        'title': parser.get_title(),
        'name': parser.get_name(),
    }
    assert expected == test_case['expected']
Exemple #3
0
 def execute(self, data):
     Helpers().print_warning("Starting Have I Been Pwned plugin...",
                             jumpline=True)
     all_emails = Parser(self.args).all_unique_emails(data)
     if all_emails:
         self.check_all_emails(all_emails)
         return True
     return False
Exemple #4
0
 def print_raw(self, data):
     authors = []
     if data:
         for item in data:
             authors.append(Parser(self.args).get_authors(item))
     if authors:
         Helpers().print_success("All emails:\n")
         self.print_raw_authors(set(Helpers().flatten(authors)))
     else:
         Helpers().print_error("gitmails: No authors to print")
Exemple #5
0
 def print_users(self, users):
     if users:
         for u in users:
             self.print_user(u, with_repos=self.args.include_repositories)
             if not self.args.include_repositories:
                 self.print_authors(
                     Parser(self.args).get_authors(u),
                     headers=["Name", "Email"],
                     table="fancy_grid",
                 )
Exemple #6
0
 def print_organizations(self, organizations):
     if organizations:
         for o in organizations:
             self.print_organization(o, with_repos=self.args.include_repositories)
             if not self.args.include_repositories:
                 self.print_authors(
                     Parser(self.args).get_authors(o),
                     headers=["Name", "Email"],
                     table="fancy_grid",
                 )
Exemple #7
0
 def dataReceived(self, request):
     try:
         headers, content = Parser(request.decode())
         url = content['resource']
         host = headers['Host']
         client_ip = str(self.transport.getPeer().host)
         date = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
         useragent = headers['User-Agent']
         result = Handler(date, request, host, url, client_ip, useragent)
         if result == 'Safe':
             return proxy.Proxy.dataReceived(self, request)
         else:
             return proxy.Proxy.dataReceived(
                 self,
                 b'GET http://house.proxy:8000/redirect HTTP/1.1\r\nHost: house.proxy:8000\r\n\r\n'
             )
     except Exception as e:
         pass
Exemple #8
0
 def execute(self):
     if self.args.repository:
         Helpers().print_success("Collecting information for {}".format(
             self.args.repository))
         collected = GitUtils(self.args).get_repo_authors_by_url(
             self.args.repository)
     else:
         collected = self.collect(self.get_collectors())
     if not collected:
         sys.exit(3)
     Printer(self.args).print(collected)
     if self.args.file:
         authors_to_print = collected
         if not self.args.repository:
             authors_to_print = Parser(
                 self.args).get_collected_authors(collected)
         Helpers().write_authors_file(self.args.file, collected)
     if self.args.run_plugins and not self.args.repository:
         self.apply_plugins(self.get_plugins(), collected)
     return collected
Exemple #9
0
 def parser_and_update(cls, args):
     key, url = args
     content = Parser(url)
     Product_db(get_engine_db(cls._test)).update_product(
         key, content.get_title(), content.get_name(), 'PROCESSED')
Exemple #10
0
 def parser_and_update(cls, args):
     key, url = args
     content = Parser(url)
     Product_db(get_engine_db(cls._test)).update_product(
         key, content.get_title(), content.get_name(), 'PROCESSED'
     )