def get_cells(self): s=self.send(['show cell 1']) lc=[l.split('|') for l in s.split('\n')] lc=[l for l in lc if l.__class__.__name__=='list' and len(l)==10] lc=[[to_int(e) for e in l] for l in lc][1:] # Keep only resolved antennas lc=[(l[:5],geoloc(*l[1:5])) for l in lc if None not in l[:5]] # Geolocation of antennas lc=[(a,b) for a,b in lc if b] # Keep only geolocated antennas for a,b in lc: arfcn, mcc, mnc, lac, cid = a lat, lon = b mcc2,mnc2, country, network = imsi2mccmnc("%d%02d000000" % (mcc,mnc)) try: self.mydbcur.execute('''INSERT INTO antennas VALUES (strftime('%Y-%m-%d %H:%M:%S'),?,?,?,?,?,?,?,?,?)''',(arfcn,mcc,mnc,lac,cid,country,network,lat,lon)) except sqlite3.Error, msg: pass
def handleFrame(self, fc): lr = self.reimsi.findall(fc) if lr: le = self.reepoch.findall(fc) st = time.localtime(float(le[0])) arfcn = self.rearfcn.findall(fc)[0] for imsi in lr: i2m = imsi2mccmnc(imsi) print "%s %s" % (time.strftime("[%d/%m/%Y %H:%M:%S]", st), imsi), i2m, arfcn # try: self.mydbcur.execute( """INSERT INTO imsis VALUES (strftime('%Y-%m-%d %H:%M:%S'),?,?,?,?,?,?)""", (imsi, int(arfcn[0]), i2m[0], i2m[1], i2m[2], i2m[3]), ) # except sqlite3.Error: # pass """ if len(lr)>2: print fc self.tocontinue=False """ self.handleImmediateFrame(fc)
def handleFrame(self, fc): lr = self.reimsi.findall(fc) if lr: le = self.reepoch.findall(fc) st = time.localtime(float(le[0])) arfcn = self.rearfcn.findall(fc)[0] for imsi in lr: i2m = imsi2mccmnc(imsi) print '%s %s' % (time.strftime('[%d/%m/%Y %H:%M:%S]', st), imsi), i2m, arfcn #try: self.mydbcur.execute( '''INSERT INTO imsis VALUES (strftime('%Y-%m-%d %H:%M:%S'),?,?,?,?,?,?)''', (imsi, int(arfcn[0]), i2m[0], i2m[1], i2m[2], i2m[3])) #except sqlite3.Error: # pass """ if len(lr)>2: print fc self.tocontinue=False """ self.handleImmediateFrame(fc)