admin管理员组文章数量:1194611
I'm learning Boofuzz, and it would be convenient to be able to convert between a boofuzz.Block and an arbitrary custom python object. This is especially the case when encoding. I'm hopeful this example explains what I'm trying to do:
class MyClass:
def __init__(self, header, data, footer):
self.header = header
self.data = data
self.footer = footer
bf_block = boofuzz.Block('Block-Instance', children=(
boofuzz.Group('Header', values=['foo', 'bar']),
boofuzz.RandomData('Data', min_length=1, max_length=20),
boofuzz.Group('Footer', values=['spam', 'spam', 'spam', 'egg', 'spam'])
))
#How do I tell boofuzz to use this method for encode instead?
def encode_to_override(bf_block):
#How do I access block members like this?
class_instance = MyClass(bf_block.header, bf_block.data, bf_block.footer)
encode(class_instance)
def encode(class_instance):
#I'll be doing something more complicated than this:
return bytes(class_instance.header) + bytes(class_instance.data) + bytes(class_instance.footer)
I was able to make the block using the second block of code in this example, and successfully run fuzz(). However, I don't know how to override encode without using a custom block, so it was only encoded using the default method.
本文标签: pythonTrying to learn how encoding works in BoofuzzStack Overflow
版权声明:本文标题:python - Trying to learn how encoding works in Boofuzz - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738475834a2088854.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论