Skip to content

Commit

Permalink
add test for previous payload filter
Browse files Browse the repository at this point in the history
  • Loading branch information
xmendez committed Nov 2, 2020
1 parent 546bc11 commit 48d99f4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/acceptance/test_saved_filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import pytest
import os
import tempfile

import wfuzz


def get_temp_file():
temp_name = next(tempfile._get_candidate_names())
defult_tmp_dir = tempfile._get_default_tempdir()

return os.path.join(defult_tmp_dir, temp_name)


def test_filter_prev_payload():

filename = get_temp_file()
for res in wfuzz.get_session("-z range --zD 0-0 -H test:1 -u http://localhost:9000/anything/FUZZ").fuzz(save=filename):
pass

filename_new = get_temp_file()
for res in wfuzz.get_session("-z wfuzzp --zD {} -u FUZZ -H test:2 --oF {}".format(filename, filename_new)).fuzz(save=filename_new):
pass

assert len(list(wfuzz.get_session("-z wfuzzp --zD {} --slice r.headers.request.test=2 --dry-run -u FUZZ".format(filename_new)).fuzz())) == 1
assert len(list(wfuzz.get_session("-z wfuzzp --zD {} --slice FUZZ[r.headers.request.test]=1 --dry-run -u FUZZ".format(filename_new)).fuzz())) == 1

0 comments on commit 48d99f4

Please sign in to comment.