op = '?' print "[!] Telecoms company code unknown" cid, lac, mnc = [int(cid,16),int(lac,16),int(mnc)] a = "000E00000000000000000000000000001B0000000000000000000000030000" b = hex(cid)[2:].zfill(8) + hex(lac)[2:].zfill(8) c = hex(divmod(mnc,100)[1])[2:].zfill(8) + hex(divmod(mnc,100)[0])[2:].zfill(8) string = (a + b + c + "FFFFFFFF00000000").decode("hex") r = urllib.urlopen("http://www.google.com/glm/mmap",string).read().encode("hex") if len(r) > 14: lon, lat = float(int(r[14:22], 16)) / 1000000, float(int(r[22:30], 16)) / 1000000 print "[+] Coordinates : %f:%f" % (lon, lat) if not BTS.if_already_mapped(lon, lat): try: bts = BTS.create( op=op, lon=lon, lat=lat, cid=cid, mcc=mcc, mnc=mnc, lac=lac, date=date ) except Exception as err: print "Error : %s" % err else: print "[!] Already in database"
http = HTTP('www.google.com', 80) http.putrequest('POST', '/glm/mmap') http.putheader('Content-Type', 'application/binary') http.putheader('Content-Length', str(len(b_string))) http.endheaders() http.send(b_string) code, msg, headers = http.getreply() bytes = http.file.read() (a, b, errorCode, latitude, longitude, c, d, e) = unpack(">hBiiiiih", bytes) lat = latitude / 1000000.0 lon = longitude / 1000000.0 print "[+] Coordinates : %f:%f" % (lat, lon) if not BTS.if_already_mapped(lat, lon): try: bts = BTS.create(op=op, lat=lat, lon=lon, cid=cid, mcc=mcc, mnc=mnc, lac=lac, date=date) except Exception as err: print "Error : %s" % err else: print "[!] Already in database" # SYSTEM INFORMATION TYPE 4
def debug_clicked(self): # Checking permissions if os.geteuid() != 0: for su_gui_cmd in ['gksu', 'kdesu', 'ktsuss', 'beesu', '']: if getoutput("which "+su_gui_cmd): break if not su_gui_cmd: # gtk.gdk.threads_enter() self.msg_dialog("One of the following tools is required to gain administrator privileges :\n" + \ "\n" + \ "gksu\n" + \ "kdesu\n" + \ "ktsuss\n" + \ "beesu", type_msg=1) # gtk.gdk.threads_leave() else: self.vterm.fork_command() self.vterm.set_color_foreground(self.foreground) self.vterm.set_color_background(self.background) self.vterm.feed_child("%s '%s %s/interface/cli/__init__.py'\n" % (su_gui_cmd, sys.executable, BTSMAPPER_PATH)) else: self.vterm.fork_command() self.vterm.set_color_foreground(self.foreground) self.vterm.set_color_background(self.background) self.vterm.feed_child("%s %s/interface/cli/__init__.py\n" % (sys.executable, BTSMAPPER_PATH)) btsObj = BTS.get_already_mapped() if btsObj and len(list(btsObj)) >= 1: for x in btsObj: if 'sfr' in x.op.lower(): pb = gtk.gdk.pixbuf_new_from_file_at_size("%s/images/sfr.png" % BTSMAPPER_PATH, 24, 24) elif 'orange' in x.op.lower(): pb = gtk.gdk.pixbuf_new_from_file_at_size("%s/images/orange.png" % BTSMAPPER_PATH, 24, 24) else: pb = gtk.gdk.pixbuf_new_from_file_at_size("%s/images/bts.png" % BTSMAPPER_PATH, 24, 24) self.osm.image_add(x.lat, x.lon, pb) # Add to the history self.liststore_geoloc.append([datetime.fromtimestamp(x.date), x.op, x.lat, x.lon, x.cid, x.mcc, x.mnc, x.lac]) while True: btsObj = BTS.get_non_mapped() if btsObj and len(list(btsObj)) >= 1: # If at least one BTS on hold for x in btsObj: # For eatch BTS try: # Add to the history self.liststore_geoloc.append([datetime.fromtimestamp(x.date), x.op, x.lat, x.lon, x.cid, x.mcc, x.mnc, x.lac]) if 'sfr' in x.op.lower(): # SFR pb = gtk.gdk.pixbuf_new_from_file_at_size("%s/images/sfr.png" % BTSMAPPER_PATH, 24, 24) elif 'orange' in x.op.lower(): # ORANGE pb = gtk.gdk.pixbuf_new_from_file_at_size("%s/images/orange.png" % BTSMAPPER_PATH, 24, 24) else: # Unknown company pb = gtk.gdk.pixbuf_new_from_file_at_size("%s/images/bts.png" % BTSMAPPER_PATH, 24, 24) # Adding the BTS on the map self.osm.image_add(x.lat, x.lon, pb) # Focus and zoom on BTS #self.osm.set_center_and_zoom(x.lat, x.lon, 16) # Mark as mapped in the db x.mapped = True x.save() except Exception as err: print "Error : %s" % err
def debug_clicked(self): # Checking permissions if os.geteuid() != 0: for su_gui_cmd in ['gksu', 'kdesu', 'ktsuss', 'beesu', '']: if getoutput("which " + su_gui_cmd): break if not su_gui_cmd: # gtk.gdk.threads_enter() self.msg_dialog("One of the following tools is required to gain administrator privileges :\n" + \ "\n" + \ "gksu\n" + \ "kdesu\n" + \ "ktsuss\n" + \ "beesu", type_msg=1) # gtk.gdk.threads_leave() else: self.vterm.fork_command() self.vterm.set_color_foreground(self.foreground) self.vterm.set_color_background(self.background) self.vterm.feed_child( "%s '%s %s/interface/cli/__init__.py'\n" % (su_gui_cmd, sys.executable, BTSMAPPER_PATH)) else: self.vterm.fork_command() self.vterm.set_color_foreground(self.foreground) self.vterm.set_color_background(self.background) self.vterm.feed_child("%s %s/interface/cli/__init__.py\n" % (sys.executable, BTSMAPPER_PATH)) btsObj = BTS.get_already_mapped() if btsObj and len(list(btsObj)) >= 1: for x in btsObj: if 'sfr' in x.op.lower(): pb = gtk.gdk.pixbuf_new_from_file_at_size( "%s/images/sfr.png" % BTSMAPPER_PATH, 24, 24) elif 'orange' in x.op.lower(): pb = gtk.gdk.pixbuf_new_from_file_at_size( "%s/images/orange.png" % BTSMAPPER_PATH, 24, 24) else: pb = gtk.gdk.pixbuf_new_from_file_at_size( "%s/images/bts.png" % BTSMAPPER_PATH, 24, 24) self.osm.image_add(x.lat, x.lon, pb) # Add to the history self.liststore_geoloc.append([ datetime.fromtimestamp(x.date), x.op, x.lat, x.lon, x.cid, x.mcc, x.mnc, x.lac ]) while True: btsObj = BTS.get_non_mapped() if btsObj and len(list(btsObj)) >= 1: # If at least one BTS on hold for x in btsObj: # For eatch BTS try: # Add to the history self.liststore_geoloc.append([ datetime.fromtimestamp(x.date), x.op, x.lat, x.lon, x.cid, x.mcc, x.mnc, x.lac ]) if 'sfr' in x.op.lower(): # SFR pb = gtk.gdk.pixbuf_new_from_file_at_size( "%s/images/sfr.png" % BTSMAPPER_PATH, 24, 24) elif 'orange' in x.op.lower(): # ORANGE pb = gtk.gdk.pixbuf_new_from_file_at_size( "%s/images/orange.png" % BTSMAPPER_PATH, 24, 24) else: # Unknown company pb = gtk.gdk.pixbuf_new_from_file_at_size( "%s/images/bts.png" % BTSMAPPER_PATH, 24, 24) # Adding the BTS on the map self.osm.image_add(x.lat, x.lon, pb) # Focus and zoom on BTS #self.osm.set_center_and_zoom(x.lat, x.lon, 16) # Mark as mapped in the db x.mapped = True x.save() except Exception as err: print "Error : %s" % err
def debug_clicked(self): # self.osm.set_center_and_zoom(50.27, 3.97, 12) # Vérification des permissions if os.geteuid() != 0: for su_gui_cmd in ['gksu','kdesu','ktsuss','beesu','']: if getoutput("which "+su_gui_cmd): break if not su_gui_cmd: # gtk.gdk.threads_enter() self.msgbox("Un des outils suivant est nécessaire pour acquérir les droits administrateur, veuillez en installer un :\n" + \ "\n" + \ "gksu\n" + \ "kdesu\n" + \ "ktsuss\n" + \ "beesu", type_msg=1) # gtk.gdk.threads_leave() else: self.vterm.fork_command() self.vterm.set_color_foreground(self.foreground) self.vterm.set_color_background(self.background) self.vterm.feed_child("%s '%s %s/interface/cli/__init__.py'\n" % (su_gui_cmd, sys.executable, BTSMAPPER_PATH)) else: self.vterm.fork_command() self.vterm.set_color_foreground(self.foreground) self.vterm.set_color_background(self.background) self.vterm.feed_child("%s %s/interface/cli/__init__.py\n" % (sys.executable, BTSMAPPER_PATH)) btsObj = BTS.get_already_mapped() if btsObj and len(list(btsObj)) >= 1: for x in btsObj: if 'sfr' in x.op.lower(): pb = gtk.gdk.pixbuf_new_from_file_at_size("%s/images/sfr.png" % BTSMAPPER_PATH, 24,24) elif 'orange' in x.op.lower(): pb = gtk.gdk.pixbuf_new_from_file_at_size("%s/images/orange.png" % BTSMAPPER_PATH, 24,24) else: pb = gtk.gdk.pixbuf_new_from_file_at_size("%s/images/bts.png" % BTSMAPPER_PATH, 24,24) self.osm.image_add(x.lon, x.lat, pb) # ajouter à l'historique self.liststore_geoloc.append([datetime.fromtimestamp(x.date), x.op, x.lon, x.lat, x.cid, x.mcc, x.mnc, x.lac]) while True: btsObj = BTS.get_non_mapped() if btsObj and len(list(btsObj)) >= 1: # Si bts en attente & au moin 1 for x in btsObj: # Pour chaque bts try: # Ajouter à l'historique self.liststore_geoloc.append([datetime.fromtimestamp(x.date), x.op, x.lon, x.lat, x.cid, x.mcc, x.mnc, x.lac]) if 'sfr' in x.op.lower(): # Si opérateur SFR pb = gtk.gdk.pixbuf_new_from_file_at_size("%s/images/sfr.png" % BTSMAPPER_PATH, 24,24) elif 'orange' in x.op.lower(): # Sinon si opréateur ORANGE pb = gtk.gdk.pixbuf_new_from_file_at_size("%s/images/orange.png" % BTSMAPPER_PATH, 24,24) else: # Sinon opérateur INCONNU pb = gtk.gdk.pixbuf_new_from_file_at_size("%s/images/bts.png" % BTSMAPPER_PATH, 24,24) # Ajout sur la map self.osm.image_add(x.lon, x.lat, pb) # Centrer et zommer sur bts # Self.osm.set_center_and_zoom(lon, lat, 16) # Maquer comme mappé dans la db x.mapped = True x.save() except Exception as err: print "Erreur : %s" % err