Created
March 12, 2018 22:38
-
-
Save mastier/f95a139b1b4d66e8db39fcf5376508be to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python3 | |
# very crude but works ;-) | |
import bs4 | |
import base64 | |
bs4.BeautifulSoup(open('sms.xml'), 'lxml-xml') | |
parts=bs.findAll('part') | |
for part in parts: | |
if part.parent.parent.findAll('addr', attrs={'address':'+48XXXXXXXXXX'}): | |
if part.attrs['ct'] not in ('text/plain', 'application/smil'): | |
open('extracted/{}'.format(part.attrs['cl']), 'wb').write(base64.decodestring(part.attrs['data'].encode('ascii'))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment