Changeset 9579 for src/django_gheat/gheat
- Timestamp:
- Aug 26, 2011, 8:54:24 PM (14 years ago)
- Location:
- src/django_gheat/gheat
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/gheat/admin.py
r9395 r9579 2 2 from django.contrib import admin 3 3 4 admin.site.register(Accespoint) 4 class AccespointAdmin(admin.ModelAdmin): 5 list_display = ['ssid','mac', 'organization'] 6 search_fields = ['ssid', 'mac', 'organization'] 7 8 admin.site.register(Accespoint, AccespointAdmin) 5 9 admin.site.register(Apparatuur) 6 10 admin.site.register(Gebruiker) -
src/django_gheat/gheat/management/commands/import_droidstumbler.py
r9565 r9579 96 96 ssid, encryption = ap_pool[bssid] 97 97 # Special trick in SSID ts avoid escaping in later stage 98 item = str((bssid.upper(),ssid.replace('%','%%'),encryption ))98 item = str((bssid.upper(),ssid.replace('%','%%'),encryption,Accespoint.get_organization(ssid))) 99 99 sql_values.append(item) 100 counters['ap_added'] = bulk_sql('gheat_accespoint (`mac`, `ssid`, `encryptie` )',sql_values)100 counters['ap_added'] = bulk_sql('gheat_accespoint (`mac`, `ssid`, `encryptie`, `organization`)',sql_values) 101 101 102 102 # Build mapping for meting import -
src/django_gheat/gheat/management/commands/import_kismet.py
r9565 r9579 76 76 ssid, encryption = ap_pool[bssid] 77 77 # Special trick in SSID ts avoid escaping in later stage 78 item = str((bssid.upper(),ssid.replace('%','%%'),encryption ))78 item = str((bssid.upper(),ssid.replace('%','%%'),encryption,Accespoint.get_organization(ssid))) 79 79 sql_values.append(item) 80 counters['ap_added'] = bulk_sql('gheat_accespoint (`mac`, `ssid`, `encryptie` )',sql_values)80 counters['ap_added'] = bulk_sql('gheat_accespoint (`mac`, `ssid`, `encryptie`, `organization`)',sql_values) 81 81 82 82 # Determine which Wireless Clients to add -
src/django_gheat/gheat/models.py
r9562 r9579 57 57 return self.mac 58 58 59 60 ORGANIZATION_CHOICES = ( 61 ('WirelessLeiden', 'Wireless Leiden'), 62 ) 63 59 64 class Accespoint(models.Model): 60 65 mac = models.CharField(max_length=17) 61 66 ssid = models.CharField(max_length=64) 67 organization = models.CharField(max_length="50",choices=ORGANIZATION_CHOICES,null=True,blank=True) 62 68 encryptie = models.BooleanField() 63 69 class Meta: … … 65 71 def __unicode__(self): 66 72 return "%s - %s" % (self.mac, self.ssid) 73 74 @staticmethod 75 def get_organization(ssid): 76 """ Try to determine the organization via the SSID """ 77 organization = '' 78 if ssid.startswith('ap') and ssid.endswith('wleiden.net'): 79 organization = 'WirelessLeiden' 80 elif ssid.startswith('ap') and 'WirelessLeiden' in ssid: 81 organization = 'WirelessLeiden' 82 return organization 83 84 def save(self, *args, **kwargs): 85 self.organization = self.get_organization(self.ssid) 86 super(Accespoint, self).save(*args, **kwargs) 67 87 68 88 class Gebruiker(models.Model):
Note:
See TracChangeset
for help on using the changeset viewer.