Example #1
0
# -*- coding: utf-8 -*-
from bing_api import BingAPI
from emailgrabber.domain import CommonIGDomainToolsTask
from core import execute_task


class IG_Domain_BingAPI(CommonIGDomainToolsTask):
    """
    Search emails in pages from source
    """
    parser = BingAPI

    def _wrap_target(self, target):
        """
        Wrap target
        """
        return "'%s'" % target

    def test(self):
        """
        Test function
        """
        self.target = 'clariant.com'
        self.main(['aPosOzbRqf1/1/tXtoHug3VSXJYKC9YQHTnsip+cq34='])

execute_task(IG_Domain_BingAPI)
Example #2
0
# -*- coding: utf-8 -*-
from exalead import Exalead
from core import execute_task
from emailgrabber import CommonIGEmailTask


class IG_Email_Exalead(CommonIGEmailTask):
    """
    Search emails in pages from source
    """
    parser = Exalead

    def test(self):
        """
        Test function
        """
        self.target = "clariant.com"
        self.main()


execute_task(IG_Email_Exalead)
Example #3
0
# -*- coding: utf-8 -*-
from wotbox import Wotbox
from emailgrabber import CommonIGEmailTask
from core import execute_task


class IG_Email_Wotbox(CommonIGEmailTask):
    """
    Search emails in pages from source
    """
    parser = Wotbox

    def test(self):
        """
        Test function
        """
        self.target = "microsoft.com"
        self.main()

execute_task(IG_Email_Wotbox)
Example #4
0
        return ''

    def main(self, *args):
        """
        Main function
        """
        target = self.host or self.ip
        result = []

        for packet in [2**x for x in xrange(4, 15)] + [64000]:
            try:
                result.append(self._ping(target, packet))
            except ValueError as err:
                self._write_result(unicode(err))
                return

            self._check_stop()

        self._write_result('\n'.join(result))

    def test(self):
        """
        Test function
        """
        self.host = "google.com"
        self.main()


execute_task(PingTask)
Example #5
0
class TheHarvesterEmailsTask(Task):
    """
    Get all emails from theHarvester script
    """
    def main(self, *args, **kwargs):
        """
        Main function
        @param args:
        @param kwargs:
        @return:
        """
        cmd = os.path.join(self._get_library_path("harvester"),
                           "theHarvester_email.py")

        ok, output = call.call(["python", cmd, "-b", "all", "-d", self.target])

        if ok:
            self._write_result(output)
        else:
            self._write_result("ERROR CALLING theHarvester script")

    def test(self):
        """
        Test function
        """
        self.target = "lu.ch"
        self.main()


execute_task(TheHarvesterEmailsTask)
Example #6
0
            if spf_valid:
                self._write_result('SPF record is valid.')
            else:
                self._write_result('SPF record is invalid.')

            if (spf_record and not txt_record) or (not spf_record
                                                   and txt_record):
                errors.append(
                    'It\'s recommended to have SPF records of both SPF and TXT record types, RFC 4408.'
                )
            elif spf_record != txt_record:
                errors.append(
                    'SPF record contents should be identical for TXT and SPF record types.'
                )

            if errors:
                self._write_result('\n'.join(errors))

        else:
            self._write_result('No SPF records.')

    def test(self):
        """
        Test function
        """
        self.host = "google.com"
        self.main()


execute_task(DNS_SPF)
Example #7
0

class KeySizeTask(SSLyzeLauncher):
    """
    Size of SSL certificate public key
    """
    def _get_commands(self):
        """
        Returns the list of sslyze options
        """
        return [
            "--certinfo=basic",
        ]

    def _parse_result(self, data):
        """
        Parses the sslyze output (@data)
        """
        size = re.search(r'Key Size: *(\d+)', data).groups()[0]
        return 'Key size: %s\n' % size

    def test(self):
        """
        Test function
        """
        self.host = "www.google.com"
        self.main()


execute_task(KeySizeTask)
Example #8
0
        """
        if not self.ip:
            try:
                self.ip = gethostbyname(self.host)
            except Exception:
                self._write_result('Host not found: %s' % self.host)
                return

        for server in self.SERVER_LIST:
            try:
                res = self.query_whois(self.ip, server)
                self._write_result(res)

            except:
                continue

            break

        if not self.produced_output:
            self._write_result('No info found.')

    def test(self):
        """
        Test function
        """
        self.host = "google.com"
        self.main()


execute_task(NIC_Whois)
Example #9
0
# -*- coding: utf-8 -*-
from bing import Bing
from emailgrabber.domain import CommonIGDomainToolsTask
from core import execute_task


class IG_Domain_Bing(CommonIGDomainToolsTask):
    """
    Search emails in pages from source
    """
    parser = Bing

    def test(self):
        """
        Test function
        """
        self.target = "microsoft.com"
        self.main()


execute_task(IG_Domain_Bing)
Example #10
0
            packet = IP(dst=self.ip, src=SANDBOX_IP) / ICMP()
            packet.id = id

            try:
                data = sr1(packet, timeout=self.ICMP_TIMEOUT)

                if not data:
                    raise Exception('Host unreachable')

                ids.append((i + 1, str(id), str(data.id)))

            except Exception as e:
                ids.append((i + 1, str(id), 'N/A (%s)' % str(e)))

            id += 1

        self._write_result('#\tSrc ID\tDst ID')

        for id in ids:
            self._write_result('%i\t%s\t%s' % id)

    def test(self):
        """
        Test function
        """
        self.host = "google.com"
        self.main()


execute_task(ICMP_IP_ID)
Example #11
0
        if not target:
            target = self.ip

        self._check_stop()

        self._write_result(
            Popen([
                "/usr/sbin/tcptraceroute", "-m",
                str(self.MAX_HOPS), target,
                str(self.port)
            ],
                  stdout=PIPE,
                  stderr=STDOUT,
                  shell=False).communicate()[0])

        self._check_stop()

        if not self.produced_output:
            self._write_result("No result.")

    def test(self):
        """
        Test function
        """
        self.port = 80
        self.host = "google.com"
        self.main()


execute_task(TCP_Traceroute)
Example #12
0
                            if info[0] == "\"" and info[-1] == "\"":
                                info = info[1:-1]

                    except:
                        pass

                    message = "%s is blacklisted in %s" % (ip, blacklist)

                    if info:
                        message = "%s\nDetails: %s\n" % (message, info)

                    self._write_result(message)

            except:
                pass

        self._check_stop()

        if not self.produced_output:
            self._write_result("Server is not listed in any known blocklist.")

    def test(self):
        """
        Test function
        """
        self.host = "smtp.gmail.com"
        self.main()


execute_task(SMTP_DNSBL)
Example #13
0
                                      re.DOTALL | re.IGNORECASE).group(1)

                except AttributeError:
                    title = '<none>'

                self._write_result('Title: "%s"' % title)

                # extract part of body
                self._check_stop()

                try:
                    body = re.search(r'<body.*?>(.*)</body>', page,
                                     re.DOTALL | re.IGNORECASE).group(1)

                except AttributeError:
                    body = ''

                self._write_result(
                    'Body:\n%s' %
                    re.sub(r'<.*?>', '', body[:self.BODY_FRAGMENT_SIZE]))

    def test(self):
        """
        Test function
        """
        self.host = "google.com"
        self.main()


core.execute_task(CallByIPTask)
Example #14
0
            challenge).hexdigest()

        req = requests.get(url,
                           headers=headers,
                           cookies=requests.utils.cookiejar_from_dict(cookies))

        soup = BeautifulSoup(req.content)
        try:
            table = soup.find('div', attrs={
                'id': 'content'
            }).find('table', attrs={'class': 'TBtable'})
        except:
            return

        for tag in table.findAll('a', attrs={'rel': 'nofollow'}):
            result = tag.text

            if result not in results:
                results.append(result)
                self._write_result(result)

    def test(self):
        """
        Test function
        """
        self.target = "clariant"
        self.main()


execute_task(IG_Domain_Netcraft)
Example #15
0
import cms_explorer


class CMSDetectionTask(core.Task):
    """
    CMS Detection checker
    """
    def main(self, *args):
        """
        Main function
        """
        target = '%s://%s' % (self.proto or 'http', self.host or self.ip)

        ok, cms = cms_explorer.get_cms_type(target)

        if not ok:
            self._write_result('CMS-Explorer call error!')

        self._write_result(cms)

    def test(self):
        """
        Test function
        """
        self.proto = "http"
        self.host = "gtta.demo.stellarbit.com"
        self.main()


core.execute_task(CMSDetectionTask)
Example #16
0
# -*- coding: utf-8 -*-
from yahoo import Yahoo
from emailgrabber.domain import CommonIGDomainToolsTask
from core import execute_task


class IG_Domain_Yahoo(CommonIGDomainToolsTask):
    """
    Search emails in pages from source
    """
    parser = Yahoo

    def _search_by_ip(self):
        """
        Search by self.ip
        """
        pass

    def test(self):
        """
        Test function
        """
        self.target = "microsoft"
        self.main()


execute_task(IG_Domain_Yahoo)
Example #17
0
    """
    def _get_commands(self):
        """
        Returns the list of sslyze options
        """
        return [
            "--reneg",
        ]

    def _parse_result(self, data):
        """
        Parses the sslyze output (@data)
        """
        result = []

        for line in data.split('\n'):
            if ' Renegotiation' in line:
                result.append(line.strip())

        return '\n'.join(result)

    def test(self):
        """
        Test function
        """
        self.host = "google.com"
        self.main()


execute_task(RenegotiationTask)
Example #18
0
    def test(self):
        """
        Test function
        """
        self.target = "google.com"

        script = NamedTemporaryFile(delete=False)
        script.write("\n".join([
            "use auxiliary/scanner/ssh/ssh_login",
            "set rhosts @target",
            "set userpass_file @arg0",
            "set threads 3",
        ]))
        script.file.flush()

        passwords = NamedTemporaryFile(delete=False)
        passwords.write("test:123\nhello:world\n")
        passwords.file.flush()

        try:
            self.main(script.name, passwords.name)
        finally:
            try:
                unlink(script.name)
                unlink(passwords.name)
            except:
                pass

execute_task(Metasploit)
Example #19
0
# -*- coding: utf-8 -*-
from google import Google
from emailgrabber import CommonIGEmailTask
from core import execute_task


class IG_Email_Google(CommonIGEmailTask):
    """
    Search emails in pages from source
    """
    parser = Google

    def test(self):
        """
        Test function
        """
        self.target = "clariant.com"
        self.main()

execute_task(IG_Email_Google)
Example #20
0
# -*- coding: utf-8 -*-

from core import execute_task
from smtp_extension_checker import SMTPExtensionChecker


class SMTP_StartTLS(SMTPExtensionChecker):
    """
    Check SMTP STARTTLS extension
    """
    EXTENSION = 'STARTTLS'

    def test(self):
        """
        Test function
        """
        self.host = "smtp.gmail.com"
        self.main()


execute_task(SMTP_StartTLS)
Example #21
0
    """
    TELNET_TIMEOUT = 10

    def main(self, *args):
        """
        Main function
        """
        self._check_stop()

        target = self.target or self.host or self.ip
        port = self.port or TELNET_PORT

        try:
            telnet = Telnet(target, port, self.TELNET_TIMEOUT)
            banner = telnet.read_until("login:"******"Unable to connect to %s:%d" % (target, port))

    def test(self):
        """
        Test function
        """
        self.target = "demo.stellarbit.com"
        self.main()

execute_task(Telnet_Banner)
Example #22
0
                self._write_result('Host not found: %s' % self.host)
                return
        s = socket.socket()
        s.connect((socket.gethostbyname('v4.whois.cymru.com'), 43))
        # query for AS
        self._write_result('SOURCE  | v4.whois.cymru.com')
        s.send(' -v %s\n' % self.ip)
        output = s.recv(4096)
        s.close()
        self._write_result(output.strip())
        # query for AS peers
        s = socket.socket()
        s.connect((socket.gethostbyname('v4-peer.whois.cymru.com'), 43))
        self._write_result('SOURCE  | v4-peer.whois.cymru.com')
        s.send(' -v %s\n' % self.ip)
        output = s.recv(4096)
        s.close()
        self._write_result(output.strip())
        self._write_result('\nUPSTREAM PEER(s) DETECTED: %s' %
                           (len(output.strip().split('\n')) - 1))

    def test(self):
        """
        Test function
        """
        self.ip = "8.8.8.8"
        self.main()


execute_task(CheckASPeers)
Example #23
0
        if self.ip:
            params = '-r %s' % self.ip
        else:
            params = '-d %s -w files/%s.txt' % (self.host, word_list)

        results = set()

        proc = subprocess.Popen('reverseraider %s' % params,
                                shell=True,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.PIPE)
        res = proc.communicate()

        strings = filter(lambda x: len(x), res[0].split('\n'))
        map(lambda x: results.add(x.split('\t')[0].replace(' ', '')), strings)

        map(lambda x: self._write_result(x), results)

    def test(self):
        """
        Test function
        """
        self.host = "clariant.com"
        self.main(["fast"])
        self.ip = "208.67.1.4"
        self.main()


execute_task(IG_Domain_RR)
Example #24
0
        self._write_result(
            'Trying to read the system description through SNMP...')

        try:
            data = sr1(packet, timeout=self.SNMP_TIMEOUT)

            if not data or ICMP in data:
                self._write_result('No response received.')
                return

            value = data[SNMPvarbind].value.val

            if not value:
                value = 'no such object'

            self._write_result('Received response: %s' % str(value))

        except Exception as e:
            self._write_result(str(e))

    def test(self):
        """
        Test function
        """
        self.host = "google.com"
        self.main()


execute_task(SNMP_Community)
Example #25
0
                if result['message']:
                    line += ' (%s)' % result['message']

                self._write_result(line)

            serials_equal = True
            sample_serial = serials[0]

            for soa in serials[1:]:
                if soa != sample_serial:
                    serials_equal = False
                    break

            if not serials_equal:
                errors.append('SOA record serial numbers should be equal across all name servers.')

            if errors:
                self._write_result('\n'.join(errors))

        else:
            self._write_result('No SOA records.')

    def test(self):
        """
        Test function
        """
        self.host = "google.com"
        self.main()

execute_task(DNS_SOA)
Example #26
0
            if add:
                line = line[8:]

                if line not in accepted:
                    accepted.append(line)

            if line.find('Accepted Cipher Suite(s):') != -1 and line.find(
                    'None') == -1:
                add = True
                continue

        out_data = []

        if accepted:
            out_data = 'Accepted ciphers:\n' + '\n'.join(accepted)
        else:
            out_data = 'No ciphers accepted.'

        return out_data

    def test(self):
        """
        Test function
        """
        self.host = "www.google.com"
        self.main()


execute_task(SSLCiphersTask)
Example #27
0
                self._write_result(u'\n'.join(domains))
            else:
                self._write_result('No host names found.')

        except URLError, e:
            self._write_result('%s: %s' % (e.__class__.__name__, e.reason))
            return

        except HTTPError, e:
            self._write_result('HTTP error: %s' % str(e))
            return

        except ValueError, e:
            self._write_result('Value Error: Invalid API key.')
            return

        self._check_stop()

        if not self.produced_output:
            self._write_result('No result.')

    def test(self):
        """
        Test function
        """
        self.host = "bible-history.com"
        self.main(["ee61b8eb5e63aa95a63d15fa39d6e16e7ec15375"])


execute_task(DNS_Hosting)
Example #28
0
# -*- coding: utf-8 -*-
from yahoo_api import YahooAPI
from emailgrabber import CommonIGEmailTask
from core import execute_task


class IG_Email_YahooAPI(CommonIGEmailTask):
    """
    Search emails in pages from source
    """
    parser = YahooAPI

    def test(self):
        """
        Test function
        """
        self.target = "clariant.com"
        self.main([
            'dj0yJmk9SnhqbG5CR3IyRFVXJmQ9WVdrOWMyMTRlVlEzTjJNbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD00Mw--'
        ], ['0239d730f5c6bf89233a185f6c7794829ba7947a'])


execute_task(IG_Email_YahooAPI)
Example #29
0
            lines = 0

            while True:
                line = file.readline()
                line = strip(line)

                self._write_result(line)
                lines += 1

                if match('^\d{3} ', line) or lines > self.MAX_LINES:
                    break

        except:
            self._write_result('Error reading SMTP banner.')
            return

        self._check_stop()

        if not self.produced_output:
            self._write_result('No SMTP banner.')

    def test(self):
        """
        Test function
        """
        self.host = "smtp.gmail.com"
        self.main()


execute_task(SMTP_Banner)
Example #30
0
        proto_domain = url.split('//')
        domain = proto_domain[1].split('/')[0]

        if domain not in self.domains:
            self._write_result(domain)
            self.domains.add(domain)

    def main(self, *args):
        """
        Main function
        """
        link_crawler = LinkCrawler()
        link_crawler.stop_callback = self._check_stop
        link_crawler.ext_link_callback = self.collect_unique_urls

        if not self.proto:
            self.proto = 'http'

        link_crawler.process(self.proto + '://' + self.host + '/')

    def test(self):
        """
        Test function
        """
        self.proto = "http"
        self.host = "google.com"
        self.main()


execute_task(IG_Domain_Craw)