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 new parameter "userpass" #6

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 13 additions & 5 deletions kerbrute/main.py
Expand Up @@ -44,6 +44,7 @@ def _define_args(self):
user_group = self._parser.add_mutually_exclusive_group(required=True)
user_group.add_argument('-user', help='User to perform bruteforcing')
user_group.add_argument('-users', help='File with user per line')
user_group.add_argument('-userpass', help='File with users and passwords (separated by :)')

password_group = self._parser.add_mutually_exclusive_group()
password_group.add_argument('-password', help='Password to perform bruteforcing')
Expand Down Expand Up @@ -73,8 +74,8 @@ def parse_args(self):
sys.exit(1)

args = self._parser.parse_args()

args.users = self._get_file_lines(args.users) if args.users else [args.user]
args.userpass = self._get_file_lines(args.userpass) if args.userpass else False

if args.passwords:
args.passwords = self._get_file_lines(args.passwords)
Expand Down Expand Up @@ -108,7 +109,7 @@ def main():
out_users_file = open(args.outputusers, "w") if args.outputusers else None

kerberos_bruter = KerberosBruter(args.domain, args.dc_ip, args.save_ticket, out_creds_file, out_users_file)
kerberos_bruter.attack(args.users, args.passwords, args.threads)
kerberos_bruter.attack(args.users, args.passwords, args.threads, args.userpass)

if out_creds_file:
out_creds_file.close()
Expand Down Expand Up @@ -142,14 +143,21 @@ def __init__(self, domain, kdc_host, save_ticket=True, out_creds_file=None, out_
self.out_creds_file = out_creds_file
self.out_users_file = out_users_file

def attack(self, users, passwords, threads=1):
def attack(self, users, passwords, threads=1, userpass=False):
pool = ThreadPoolExecutor(threads)
threads = []

for password in passwords:
for user in users:
if userpass:
for line in userpass:
user = line.split(":")[0]
password = line.split(":")[1]
t = pool.submit(self._handle_user_password, user, password)
threads.append(t)
else:
for password in passwords:
for user in users:
t = pool.submit(self._handle_user_password, user, password)
threads.append(t)

for f in as_completed(threads):
try:
Expand Down