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

Use positional argument for input files in 2john scripts #5649

Merged
merged 2 commits into from
Jan 20, 2025
Merged
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
20 changes: 5 additions & 15 deletions run/aix2john.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


import argparse
import binascii
import sys
import re

Expand Down Expand Up @@ -62,26 +61,17 @@ def process_file(filename, is_standard):

if __name__ == "__main__":

if len(sys.argv) < 2:
sys.stderr.write("Usage: %s [-s] -f <AIX passwd file (/etc/security/passwd)>\n" % sys.argv[0])
sys.exit(1)

parser = argparse.ArgumentParser()
parser.add_argument('-s', action="store_true",
default=False,
dest="is_standard",
help='Use this option if "lpa_options = std_hash=true" is activated'
)
)

parser.add_argument('-f', dest="filename",
default=False,
help='Specify the AIX shadow file filename to read (usually /etc/security/passwd)'
)
parser.add_argument("filename",
help='The AIX shadow file to read (usually /etc/security/passwd)'
)

args = parser.parse_args()

if args.filename:
process_file(args.filename, args.is_standard)
else:
print("Please specify a filename (-f)")
sys.exit(1)
process_file(args.filename, args.is_standard)
22 changes: 10 additions & 12 deletions run/radius2john.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
# ---

# Utility to bruteforce RADIUS shared-secret
# Usage: ./radius2john.py -f <pcap files>
# Usage: ./radius2john.py <pcap files>
#
# This script depends on Scapy (https://scapy.net)
# To install: pip install --user scapy

# ---

# Application of two methods described in http://www.untruth.org/~josh/security/radius/radius-auth.html :
# Application of two methods described in https://www.untruth.org/~josh/security/radius/radius-auth.html :
# "3.3 User-Password Attribute Based Shared Secret Attack"
# "3.1 Response Authenticator Based Shared Secret Attack"

Expand All @@ -40,10 +40,12 @@
import scapy.all as scapy
except ImportError:
print(
"Scapy seems to be missing, run 'pip install --user scapy' to install it"
"Scapy seems to be missing, run 'pip install --user scapy' to install it",
file=sys.stderr
)
sys.exit(1)


def read_file(args, filename):
packets = scapy.rdpcap(filename)
for packet in packets:
Expand Down Expand Up @@ -122,11 +124,10 @@ def dump_access_request(args, ip, ra, hashed): # 3.3 attack
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,epilog=
"""
### Utility to bruteforce RADIUS shared-secret written by k4amos
Basic Usage: ./radius2john.py -f <pcap files>"

---

Application of two methods described in http://www.untruth.org/~josh/security/radius/radius-auth.html :
Application of two methods described in https://www.untruth.org/~josh/security/radius/radius-auth.html :
- "3.3 User-Password Attribute Based Shared Secret Attack"
- "3.1 Response Authenticator Based Shared Secret Attack"

Expand All @@ -140,20 +141,17 @@ def dump_access_request(args, ip, ra, hashed): # 3.3 attack
and dumps md5 and salt as needed.
""")

parser.add_argument('-f', '--file', type=str, required=True, nargs='+')
parser.add_argument('--single', help='To get only one hash per client IPs', action='store_true', default=False)
parser.add_argument('-l', '--login', type=str,help='User login used for the 3.3 attack')
parser.add_argument('file', type=str, nargs='+', help='Input PCAP files')
parser.add_argument('--single', help='To get only one hash per client IP', action='store_true', default=False)
parser.add_argument('-l', '--login', type=str, help='User login used for the 3.3 attack')
parser.add_argument('-p', '--password', type=str, help='User password used for the 3.3 attack')

parsed_args = parser.parse_args()
args = vars(parsed_args)

if args["login"] is not None and args["password"] is None:
# Attack 3.3 can work without login verification (if there is only one client, there is no point), but cannot work without a password
print("You must specify the password used by the client for the '3.3 User-Password Attribute Based Shared Secret Attack'")
print("Basic Usage: ./radius2john.py -f <pcap files>")
print("You can specify '-h' to display help")
sys.exit(1)
parser.error("You must specify the password used by the client for the '3.3 User-Password Attribute Based Shared Secret Attack'")

all_requests = {}
dumped_ips = {}
Expand Down
Loading