Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.