Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to write payloads to file #325

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion modes/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@
logger = setup_logger(__name__)


def scan(target, paramData, encoding, headers, delay, timeout, skipDOM, find, skip):
def write_vectors(vectors, filename):
with open(filename, 'w') as f:
for vs in vectors.values():
for v in vs:
f.write("{}\n".format(v))
logger.info('Written payloads to file')


def scan(target, paramData, encoding, headers, delay, timeout, skipDOM, find, skip, payloads_file):
GET, POST = (False, True) if paramData else (True, False)
# If the user hasn't supplied the root url with http(s), we will handle it
if not target.startswith('http'):
Expand Down Expand Up @@ -89,6 +97,8 @@ def scan(target, paramData, encoding, headers, delay, timeout, skipDOM, find, sk
logger.error('No vectors were crafted.')
continue
logger.info('Payloads generated: %i' % total)
if payloads_file:
write_vectors(vectors, payloads_file)
progress = 0
for confidence, vects in vectors.items():
for vect in vects:
Expand Down
4 changes: 3 additions & 1 deletion xsstrike.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
choices=core.log.log_config.keys(), default=None)
parser.add_argument('--log-file', help='Name of the file to log', dest='log_file',
default=core.log.log_file)
parser.add_argument('--write-payloads', dest="payloads_file", help='Write generated payloads to given file', default=None)
args = parser.parse_args()

# Pull all parameter values of dict from argparse namespace into local variables of name == key
Expand All @@ -103,6 +104,7 @@
skip = args.skip
skipDOM = args.skipDOM
blindXSS = args.blindXSS
payloads_file = args.payloads_file
core.log.console_log_level = args.console_log_level
core.log.file_log_level = args.file_log_level
core.log.log_file = args.log_file
Expand Down Expand Up @@ -171,7 +173,7 @@
if args_file:
bruteforcer(target, paramData, payloadList, encoding, headers, delay, timeout)
else:
scan(target, paramData, encoding, headers, delay, timeout, skipDOM, find, skip)
scan(target, paramData, encoding, headers, delay, timeout, skipDOM, find, skip, payloads_file)
else:
if target:
seedList.append(target)
Expand Down