Forked from metall0id/decode-websphere-xor-password.py
Created
December 2, 2016 13:35
-
-
Save i1ikey0u/bc691172275c89de4f97504d6ef5f066 to your computer and use it in GitHub Desktop.
Decode WebSphere passwords that use {xor} prepended tag
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
# | |
# Author : Tyrone Erasmus | |
# Version : 1.0 | |
# Description: Decode WebSphere passwords that use {xor} prepended tag | |
# | |
#!/usr/bin/python | |
import argparse | |
import base64 | |
import sys | |
# Decoded password | |
password = "" | |
# Read arguments | |
parser = argparse.ArgumentParser(description='Decode WebSphere passwords that use {xor} prepended tag.') | |
parser.add_argument('encoded_password', help='The {xor} encoded password') | |
args = parser.parse_args() | |
# Remove {xor} tag if present | |
if args.encoded_password.startswith("{xor}"): | |
args.encoded_password = args.encoded_password.replace("{xor}", "") | |
# Decode by base64 decoding and xor'ing with underscore | |
for i in base64.b64decode(args.encoded_password): | |
password += chr(ord(i) ^ ord('_')) | |
# Output | |
sys.stdout.write("[+] Decoded password string = %s\n" % password) | |
sys.stdout.write("[+] Decoded password hex = %s\n" % "".join("\\x%s" % byte.encode("hex") for byte in password)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment