Skip to content

Commit

Permalink
exception handling within wfuzz payload (refs #427)
Browse files Browse the repository at this point in the history
  • Loading branch information
xmendez committed Aug 5, 2016
1 parent d1ee6ed commit f0acc94
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions plugins/payloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from framework.plugins.api.payloadtools import BingIter
from framework.plugins.api.payloadtools import range_results, filter_results
from framework.plugins.api.payloadtools import FuzzResPayload
from framework.fuzzer.fuzzobjects import FuzzResult

@wfuzz_iterator
class file:
Expand All @@ -32,8 +33,8 @@ def _my_gen(self, filename):
f = open(filename, "r")
self.__max = len(f.readlines())
f.seek(0)
except IOError:
raise FuzzException(FuzzException.FATAL, "Error opening file")
except IOError, e:
raise FuzzException(FuzzException.FATAL, "Error opening file. %s" % str(e))

return f

Expand Down Expand Up @@ -423,7 +424,13 @@ def _gen_wfuzz(self, output_fn):
with gzip.open(output_fn, 'r+b') as output:
#with open(self.output_fn, 'r+b') as output:
while 1:
yield pickle.load(output)
item = pickle.load(output)
if not isinstance(item, FuzzResult):
raise FuzzException(FuzzException.FATAL, "Wrong wfuzz payload format, the read object is not a valid fuzz result.")

yield item
except IOError, e:
raise FuzzException(FuzzException.FATAL, "Error opening wfuzz payload file. %s" % str(e))
except EOFError:
raise StopIteration

0 comments on commit f0acc94

Please sign in to comment.