Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save i1ikey0u/bc691172275c89de4f97504d6ef5f066 to your computer and use it in GitHub Desktop.
Save i1ikey0u/bc691172275c89de4f97504d6ef5f066 to your computer and use it in GitHub Desktop.
Decode WebSphere passwords that use {xor} prepended tag
#
# 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