Beispiel #1
0
def test_dummy_docker_collector(mock_current_task):
    mock_current_task.request.delivery_info = {
        'routing_key': 'dummy-collector'
    }
    res = tasks.scan.s(
        uuid.uuid4(),
        [
            Person(firstname='agent-test', lastname='dummy-collector'),
            Email(address='*****@*****.**'),
        ],
    ).apply()
    result = res.get()
Beispiel #2
0
    def scan(self, domain):
        data = self.run_container(command=['-d', domain.fqdn, '-l', '5', '-v', 'y'])

        for email in self.findall_regex(data, r'Email found! (.*) '):
            yield Email(address=email)

        for number in self.findall_regex(data, r'Telephone # found! (.*) '):
            yield Phone(number=number)

        for url in self.findall_regex(
            data,
            r'(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]\
            {2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|\
            https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})',
        ):
            yield Uri(location=url)
Beispiel #3
0
    def scan(self, target):
        data = self.run_container(command=[
            "-d",
            target,
            "--source",
            "anubis,baidu,bing,bufferoverun,certspotter,crtsh,dnsdumpster,duckduckgo,google,hackertarget,linkedin,linkedin_links,n45ht,omnisint,qwant,rapiddns,threatcrowd,threatminer,trello,twitter,urlscan,yahoo",
        ], )

        for item, _ in self.findall_regex(
                data,
                r"\[\*\] IPs found: \d+\n-------------------\n((.|\n)*)\n\[\*\] Emails found",
        ):
            for ip in item.split("\n"):
                if ip:
                    yield from [IPv4(address=i.strip()) for i in ip.split(",")]

        for item, _ in self.findall_regex(
                data,
                r"\[\*\] Emails found: \d+\n----------------------\n((.|\n)*)\n\[\*\] Hosts found",
        ):
            for email in item.split("\n"):
                if email:
                    yield Email(address=email)

        for item, _ in self.findall_regex(
                data,
                r"\[\*\] Hosts found: \d+\n---------------------\n((.|\n)*)",
        ):
            for host in item.split("\n"):
                if not host:
                    continue
                if ":" in host:
                    domain, ip = host.split(":")
                    yield Domain(fqdn=domain, address=ip)
                    yield from [
                        IPv4(address=i.strip(), domain=domain)
                        for i in ip.split(",")
                    ]
                else:
                    yield Domain(fqdn=host)
Beispiel #4
0
 def cb_email(self, email):
     date = self.run_container(command="date")
     yield Username(name=email.address + date)
     yield Email(address="dummy@" + date)
Beispiel #5
0
 def cb_username(self, username):
     whoami = self.run_container(command="whoami")
     yield Username(name=username.name + whoami)
     yield Email(address="dummy@" + whoami)
Beispiel #6
0
 def from_company(self, company):
     data = self.run_container(command=[company.name, "--org"])
     logger.debug(data)
     for username, email in self.findall_regex(data, r"(.*) : (.*)"):
         yield Username(name=username, email=email)
         yield Email(address=email, username=username)
Beispiel #7
0
 def from_username(self, username):
     data = self.run_container(command=[username.name])
     logger.debug(data)
     for email in self.findall_regex(data, f"{username.name} : (.*)"):
         yield Email(address=email)
Beispiel #8
0
 def scan(self, domain):
     data = self.run_container(command=['--domain', domain.fqdn, '-v', '1'])
     for item in self.findall_regex(data, r'Email: (.*) \('):
         yield Email(address=item)