Skip to content

Instantly share code, notes, and snippets.

@r0yfire
Created April 15, 2015 17:18
Show Gist options
  • Save r0yfire/e9940605c6e7a3a55ec5 to your computer and use it in GitHub Desktop.
Save r0yfire/e9940605c6e7a3a55ec5 to your computer and use it in GitHub Desktop.
Decode quoted-printable text in a file
#!/usr/bin/python
"""
Decode quoted-printable text in a file
"""
import sys
import quopri
from BeautifulSoup import BeautifulSoup as bs
print '\t\tHTML Extract0r 2014\n'
f = open(sys.argv[1], 'r')
# Decode quoted-printable
encoded = f.read()
f.close()
html = quopri.decodestring(encoded)
# Make pretty
soup = bs(html)
html = soup.prettify()
# Save
f = open(sys.argv[1], 'w')
f.write(html)
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment