Skip to content

Commit

Permalink
using get_field within fuzzrespayload (fixes #460)
Browse files Browse the repository at this point in the history
  • Loading branch information
xmendez committed Aug 13, 2016
1 parent 613cd99 commit 635c674
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions framework/plugins/api/payloadtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,13 @@ def __init__(self, default_param, extra_params):
self._params = []

if extra_params:
if extra_params.has_key('attr'):
if 'attr' in extra_params:
self._attr = extra_params['attr']

first_index = self._attr.find("(")
sec_index = self._attr.find(")")

if first_index > 0:
if sec_index != len(self._attr) - 1:
raise FuzzException(FuzzException.FATAL, "Wrong expression.")

if sec_index < 0 or first_index > sec_index:
raise FuzzException(FuzzException.FATAL, "Wrong expression, Unbalanced parenthesis.")

self._params = self._attr[first_index + 1:sec_index].split("-")
self._attr = self._attr[:first_index]

def next(self):
next_item = self._it.next()

if not self._attr:
return next_item

try:
attr = reduce(lambda x, y: getattr(x, y), self._attr.split("."), next_item)
except AttributeError:
raise FuzzException(FuzzException.FATAL, "Unknown fuzz result attribute.")

try:
if callable(attr):
attr = attr(*self._params)

except TypeError:
raise FuzzException(FuzzException.FATAL, "Incorrect paramaters specified for Fuzz result attribute.")

return str(attr)

return next_item if not self._attr else next_item.get_field(self._attr)

class BingIter:
def __init__(self, dork, offset = 0, limit = 0, key = None):
Expand Down

0 comments on commit 635c674

Please sign in to comment.