From f66e8aea782861188a78cbd52aedfc3fdb039442 Mon Sep 17 00:00:00 2001 From: ache Date: Mon, 4 Feb 2019 15:35:36 +0100 Subject: AutoMMS is standard now --- Makefile | 2 +- autoMMS.py | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 08d2588..3d497ce 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -INSTALL_LIST=autoDHCP.sh autoWall.sh cmount.sh coWifi.sh cumount.sh imgs2pdf.sh light2.sh tethapp.sh toMp3.sh bot4chan.py track.py +INSTALL_LIST=autoDHCP.sh autoWall.sh cmount.sh coWifi.sh cumount.sh imgs2pdf.sh light2.sh toMp3.sh bot4chan.py track.py autoMMS.py install: @if [ -z $(filter-out $@,$(MAKECMDGOALS)) ] ; then \ diff --git a/autoMMS.py b/autoMMS.py index e592cd8..ba0bcb6 100755 --- a/autoMMS.py +++ b/autoMMS.py @@ -1,20 +1,23 @@ #!/bin/env python -import os, binascii, sys - +import os +import binascii +import sys """ Read MMS from gammu file format""" -if len(sys.argv) < 2 : +if len(sys.argv) < 2: print("Usage : autoMMS.py [FILE]...") exit(1) -info = "" +info = "" with open(sys.argv[1],'r') as f: for line in f: if "Text00 = " in line: info = line[9:-1] # 9 = len('Text00 = ') ,strip the final '\n' + if "Text01 = " in line: + info += line[9:-1] # 9 = len('Text00 = ') ,strip the final '\n' if info : @@ -24,13 +27,13 @@ else: exit(2) # a = "00060401BEAF848C82986B317844755F58374565656E6841416D756672443041008D928918802B33333635313037323235372F545950453D504C4D4E0086818A808F818E0308712383687474703A2F2F3231332E3232382E322E382F6D6D732E7068703F".encode('utf8') +# or +# a = "00060401BEAF848C8298356F69377978793245656D6E6841416D756672443041008D928918802B33333736393132313834342F545950453D504C4D4E0086808A808F818E02EF8183687474703A2F2F3231332E3232382E322E382F6D6D732E7068703F35 b = binascii.unhexlify(a).split(b'\x00') c = list(map( (lambda b_: bytes(filter( (lambda x : x>0x1F and x<0x7F), b_))), b)) d = list(map( lambda x: x.decode('utf8'), c)) - -print(d) - -url = d[-1][d[-1].find('http://'):]+'?'+d[1] -print(url) -os.system("wget \"" + url + "\" -O /tmp/mmsFile") +for yeah in d: + if 'http' in yeah: + url = yeah[yeah.find('http'):] +os.system("wget \"" + url + "\" -q -O /tmp/mmsFile") -- cgit v1.2.3