hashcat.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:WebHashcat 作者: hegusung 项目源码 文件源码
def get_wordlists(self, detailed=True):

        res = []
        if not detailed:
            path = os.path.join(os.path.dirname(__file__), "..", "Files", "Wordlistfiles")

            res = [{"name": f} for f in listdir(path) if isfile(join(path, f)) and f.endswith(".wordlist")]
        else:
            path = os.path.join(os.path.dirname(__file__), "..", "Files", "Wordlistfiles", "*")
            # use md5sum instead of python code for performance issues on a big file
            result = subprocess.run('md5sum %s' % path, shell=True, stdout=subprocess.PIPE).stdout.decode()

            for line in result.split("\n"):
                items = line.split()
                if len(items) == 2:
                    info = {
                        "name": items[1].split("/")[-1],
                        "md5": items[0],
                        "path": items[1],
                    }

                    try:
                        info["lines"] = humanize.intcomma(sum(1 for _ in open(items[1], errors="backslashreplace")))
                    except UnicodeDecodeError:
                        print("Unicode decode error in file %s" % items[1])
                        info["lines"] = "error"
                    res.append(info)


        return sorted(res, key=itemgetter('name'))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号