-
-
Save kylemsguy/2dc493b3f78563dbabe1da14dc60c160 to your computer and use it in GitHub Desktop.
A script that dumps convoluted XML log files from MSN Messenger to readable plaintext.
This file contains hidden or 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
""" | |
Simple script I whipped up to dump MSN Messenger logs in XML to a readable | |
plaintext format. It's not very robust, nor am I sure which versions of MSN | |
Messenger it's compatible or incompatible with; I just had a specific | |
conversation I wanted to read, and this was the vehicle to that end. | |
By David Warde-Farley -- user AT cs dot toronto dot edu (user = dwf) | |
Updated for Python 3.6 by Kyle Zhou (also former CS student at UofT) | |
Redistributable under the terms of the 3-clause BSD license | |
(see http://www.opensource.org/licenses/bsd-license.php for details) | |
""" | |
import sys | |
from xml.dom.minidom import parse | |
if len(sys.argv) != 2: | |
print("usage:", sys.argv[0], "<inputfile>", file=sys.stderr) | |
sys.exit(1) | |
doml = parse(sys.argv[1]) | |
for message in doml.getElementsByTagName("Message"): | |
sentDateTime = message.getAttribute("DateTime") | |
fromNode = message.getElementsByTagName("From")[0] | |
userNode = fromNode.getElementsByTagName("User")[0] | |
name = userNode.getAttribute("FriendlyName") | |
msg = message.getElementsByTagName("Text")[0].firstChild.nodeValue | |
print(f"[{sentDateTime}] {name} says: {msg}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment