Skip to content

Commit afb638d

Browse files
author
foreverneilyoung
committed
Legacy login fixed
Minor bugs fixed
1 parent 0869716 commit afb638d

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

core/g711_decoder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def decode(self, time_sec, time_usec, packet, len):
218218
else:
219219
# Was there a CN sequence before?
220220
if sd.has_key('ts_cn'):
221-
pad = array.array('B', (0 for i in range(sd['blockalign']*(timestamp - sd['ts_cn'])))) # Silence as word typed samples
221+
pad = array.array('B', (0 for i in range(sd['blockalign']*(timestamp - sd['ts_cn'])))) # Silence
222222
sd['fo'].write(pad)
223223
sd['nr_samples'] += timestamp - sd['ts_cn']
224224
del sd['ts_cn']

core/tracer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ def monitor(self, n1, n2, n3):
2828
def run(self):
2929
try:
3030
urllib.urlretrieve(self.url, self.filename, self.monitor)
31-
util.log('Trace stopped')
31+
util.log('Trace finished server side')
3232
except:
3333
util.log('Could not open %s' % self.url)

fritzcap.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/python
22
# -*- coding: iso-8859-1 -*-
3-
##################################################################################
4-
# Simple FritzCap python port
3+
################################################################################# Simple FritzCap python port
54
# Simplifies generation and examination of traces taken from AVM FritzBox and/or SpeedPort
65
# Traces can be examined using WireShark
76
# (c) neil.young 2010 (spongebob.squarepants in http://www.ip-phone-forum.de/)
@@ -41,9 +40,9 @@ def runparser():
4140

4241
# Main
4342
def main():
44-
43+
4544
global capfile
46-
45+
4746
capture = True # Audio debug shortcut
4847
extract_audio = True # Extract audio if available
4948

@@ -81,22 +80,25 @@ def main():
8180
except:
8281
# Legacy login
8382
command = urllib.urlopen(protocol + '://' + boxname + '/cgi-bin/webcm', default_login % password)
84-
if command.getcode() == 200 and len(command.read()) == 0:
85-
print 'Login OK'
86-
else:
87-
print "Could not login"
88-
return
83+
response = command.read()
84+
# Right now I don't know how to check the result of a login operation. So I just search for the errorMessage
85+
if command.getcode() == 200:
86+
try:
87+
result = urllib.unquote(re.search('<p class="errorMessage">(.*?)</p>', response).group(1).decode('iso-8859-1')).replace("&nbsp;"," ")
88+
except:
89+
result = ''
90+
print 'Login attempt was made. %s' % result
8991

9092

9193
# Create capfile folder
9294
folder = capfolder + '/' + (datetime.datetime.now().strftime('%d%m%Y%H%M'))
9395
capfile = folder + '/' + capfile
9496
if not os.path.exists(folder):
95-
os.makedirs(folder)
97+
os.makedirs(folder)
9698

9799
# Start tracer thread, wait for console input to stop
98100
Tracer(protocol + '://' + boxname + '/cgi-bin/capture_notimeout' + start, capfile).start()
99-
print 'Trace started, stop with <ENTER>'
101+
print 'Trace started, abandon with <ENTER>'
100102
raw_input()
101103
# Clean stop
102104
print 'Stopping trace'

0 commit comments

Comments
 (0)