badchars.py 文件源码

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

项目:expdevBadChars 作者: mgeeky 项目源码 文件源码
def recognize_format(self):
        for line in self.input.split('\n'):
            if self.format: break
            for format, rex in BytesParser.formats_compiled.items():
                line = BytesParser.make_line_printable(line)

                out(dbg("Trying format %s on ('%s')" % (format, line)))

                if rex.match(line):
                    out(ok("%s has been recognized as %s formatted." % (self.name, format)))
                    self.format = format
                    break

        if not self.format:
            if not all(c in string.printable for c in self.input):
                out(ok("%s has been recognized as RAW bytes." % (self.name)))
                self.format = 'raw'
                return True
            else:
                out(err("Could not recognize input bytes format of the %s!" % self.name))
                return False

        return (len(self.format) > 0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号