Skip to content

Commit

Permalink
flags -o and -f, for output and for storing results respectively (this
Browse files Browse the repository at this point in the history
…closes #53)
  • Loading branch information
xmendez committed Sep 25, 2017
1 parent 43471b2 commit be25652
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/library/guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CLI Option Library Option
<URL> url="url"
--recipe <filename> recipe="filename"
--oF <filename> save="filename"
-o filename,printer printer=("filename", "printer")
-f filename,printer printer=("filename", "printer")
--dry-run dryrun=True
-p addr proxies=[("ip","port","type")]
-t N concurrent=N
Expand Down
14 changes: 13 additions & 1 deletion docs/user/basicusage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,18 @@ Wfuzz supports writing the results to a file in a different format. This is perf

For example, to write results to an output file in json format use the following command::

$ python wfuzz -o /tmp/outfile,json -w wordlist/general/common.txt http://testphp.vulnweb.com/FUZZ
$ python wfuzz -f /tmp/outfile,json -w wordlist/general/common.txt http://testphp.vulnweb.com/FUZZ


Different output
-----------------

Wfuzz supports showing the results in various formats. This is performed by plugins called "printers". The available printers can be listed executing::

$ python wfuzz -e printers

For example, to show results in json format use the following command::

$ python wfuzz -o json -w wordlist/general/common.txt http://testphp.vulnweb.com/FUZZ


3 changes: 2 additions & 1 deletion wfuzz/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def _defaults(self):
return dict(
seed_payload = False,
send_discarded = False,
console_printer = "",
hs = None,
hc = [],
hw = [],
Expand Down Expand Up @@ -178,7 +179,7 @@ def export_json(self):
wfuzz_recipe = defaultdict(dict)
)
defaults = self._defaults()
not_to_dump = ["recipe", "seed_payload", "send_discarded", "compiled_genreq", "compiled_filter", "compiled_prefilter", "compiled_printer"]
not_to_dump = ["interactive", "recipe", "seed_payload", "send_discarded", "compiled_genreq", "compiled_filter", "compiled_prefilter", "compiled_printer"]

# Only dump the non-default options
for k, v in self.data.items():
Expand Down
12 changes: 8 additions & 4 deletions wfuzz/plugin_api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from wfuzz.utils import find_file_in_paths

import sys
import os

# Util methods for accessing search results
Expand Down Expand Up @@ -64,10 +65,13 @@ def queue_url(self, url):
class BasePrinter:
def __init__(self, output):
self.f = None
try:
self.f = open(output,'w')
except IOError, e:
raise FuzzExceptBadFile("Error opening file. %s" % str(e))
if output:
try:
self.f = open(output,'w')
except IOError, e:
raise FuzzExceptBadFile("Error opening file. %s" % str(e))
else:
self.f = sys.stdout

self.verbose = Facade().printers.kbase["verbose"]

Expand Down
12 changes: 9 additions & 3 deletions wfuzz/ui/console/clparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def show_plugin_ext_help(self, registrant, category="$all$"):
def parse_cl(self):
# Usage and command line help
try:
opts, args = getopt.getopt(self.argv[1:], "hLAZX:vcb:e:R:d:z:r:f:t:w:V:H:m:o:s:p:w:u:",['slice=','zP=','oF=','recipe=', 'dump-recipe=', 'req-delay=','conn-delay=','sc=','sh=','sl=','sw=','ss=','hc=','hh=','hl=','hw=','hs=','ntlm=','basic=','digest=','follow','script-help=','script=','script-args=','prefilter=','filter=','interact','help','version','dry-run'])
opts, args = getopt.getopt(self.argv[1:], "hLAZX:vcb:e:R:d:z:r:f:t:w:V:H:m:f:o:s:p:w:u:",['slice=','zP=','oF=','recipe=', 'dump-recipe=', 'req-delay=','conn-delay=','sc=','sh=','sl=','sw=','ss=','hc=','hh=','hl=','hw=','hs=','ntlm=','basic=','digest=','follow','script-help=','script=','script-args=','prefilter=','filter=','interact','help','version','dry-run'])
optsd = defaultdict(list)

payload_cache = {}
Expand Down Expand Up @@ -169,6 +169,9 @@ def _parse_help_opt(self, optsd):
else:
raise FuzzExceptBadOptions("Unknown category. Valid values are: payloads, encoders, iterators, printers or scripts.")

if "-f" in optsd:
if "help" in optsd["-f"]:
self.show_plugins_help("printers")
if "-o" in optsd:
if "help" in optsd["-o"]:
self.show_plugins_help("printers")
Expand Down Expand Up @@ -411,14 +414,17 @@ def _parse_options(self, optsd, options):
options["verbose"] = True
options["colour"] = True

if "-o" in optsd:
vals = optsd['-o'][0].split(",", 1)
if "-f" in optsd:
vals = optsd['-f'][0].split(",", 1)

if len(vals) == 1:
options["printer"] = (vals[0], None)
else:
options["printer"] = vals

if "-o" in optsd:
options["console_printer"] = optsd['-o'][0]

if "--recipe" in optsd:
options["recipe"] = optsd['--recipe'][0]

Expand Down
3 changes: 2 additions & 1 deletion wfuzz/ui/console/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
\t
\t-c : Output with colors
\t-v : Verbose information.
\t-o filename,printer : Store results in the output file using the specified printer (raw printer if omitted).
\t-f filename,printer : Store results in the output file using the specified printer (raw printer if omitted).
\t-o printer : Show results using the specified printer.
\t--interact : (beta) If selected,all key presses are captured. This allows you to interact with the program.
\t--dry-run : Print the results of applying the requests without actually making any HTTP request.
\t
Expand Down
2 changes: 2 additions & 0 deletions wfuzz/wfuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def main():
kb.start()

printer = View(session_options["colour"], session_options["verbose"])
if session_options["console_printer"]:
printer = Facade().printers.get_plugin(session_options["console_printer"])(None)
printer.header(fz.genReq.stats)

for res in fz:
Expand Down

0 comments on commit be25652

Please sign in to comment.