Skip to content

Commit fc079f6

Browse files
author
foreverneilyoung
committed
0 parents  commit fc079f6

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

fritzcap.py

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Simple FritzCap python port
2+
# Simplifies generation and examination of traces taken from AVM FritzBox and/or SpeedPort
3+
# Traces can be examined using WireShark
4+
# (c) neil.young 2010 (spongebob.squarepants in http://www.ip-phone-forum.de/)
5+
# based on the Windows GUI exe with same name
6+
7+
import urllib, threading, sys
8+
9+
# Configuration (just change here)
10+
boxname = 'speedport.ip' # or ip (also fritz.box)
11+
password = 'yourpassword' # your password
12+
protocol = 'https' # or http
13+
capfile = 'test.cap' # name of capture file
14+
15+
# URL templates
16+
url = protocol + '://' + boxname + '/cgi-bin'
17+
18+
# Commands
19+
login = 'getpage=../html/de/menus/menu2.html&errorpage=../html/index.html&var:lang=de&var:pagename=home&var:menu=home&=&login:command/password=%s'
20+
start = '/capture_notimeout?start=1&start1=Start'
21+
stop = '/capture_notimeout?stop=1&stop1=Stop'
22+
23+
24+
# Attempt to login
25+
command = urllib.urlopen(url + '/webcm', login % password)
26+
response = command.read()
27+
print 'Login', response
28+
29+
class TraceGetter(threading.Thread):
30+
def __init__(self, url, filename):
31+
self.url = url
32+
self.i = 0
33+
self.filename = filename
34+
threading.Thread.__init__(self)
35+
36+
def monitor(self, n1, n2, n3):
37+
print ["|", "/", "-", "\\"][self.i], "\r",
38+
self.i += 1
39+
self.i %= 4
40+
41+
def run(self):
42+
try:
43+
urllib.urlretrieve(self.url, self.filename, self.monitor)
44+
print "Trace stopped"
45+
except:
46+
print "Could not open %s" % self.url
47+
48+
49+
thread = TraceGetter(url + start, capfile)
50+
thread.start()
51+
print "Trace started, stop with <ENTER>"
52+
raw_input()
53+
print "Stopping trace"
54+
urllib.urlopen(url + stop)
55+
print "Capture done"

0 commit comments

Comments
 (0)