1#!/usr/bin/env python 2 3########################################################################## 4# Copyright (c) 2009, ETH Zurich. 5# All rights reserved. 6# 7# This file is distributed under the terms in the attached LICENSE file. 8# If you do not find this file, copies can be found by writing to: 9# ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 10########################################################################## 11 12import sys,string,socket 13 14if len(sys.argv) != 2: 15 print "usage: bfscope.py <host>" 16 sys.exit(1) 17 18#create an INET, STREAMing socket 19s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 20 21s.connect((sys.argv[1], 666)) 22 23s.send("trace\n") 24 25header = s.recv(6) 26print header 27tracelen = int(header) 28 29trace = "" 30while len(trace) < tracelen: 31 trace += s.recv(1000000) 32 #print len(trace) 33 34print "Done" 35s.close() 36 37of=open("TRACE", "w") 38of.write(trace) 39 40