sensepost / snoopy-ng

Snoopy v2.0 - modular digital terrestrial tracking framework
Other
429 stars 128 forks source link

Garbled SSID fail to sync #42

Closed glennzw closed 9 years ago

glennzw commented 9 years ago

As mentioned in issue #14 Scapy fails to implement the FCS check, and therefore sometimes we get garbled SSIDs. This seems to affect syncing too. Unrelated to garbled SSIDs, this likely affects non-ASCII character sets.

e.g. Trying to sync [T>UEUX+nUd%vOnG'6h0ú>ьB ߧ0x9#)iY-u to a server results in the server outputting:

[!!] Exception whilst trying to insert data, will sleep for 5 seconds then continue. Exception was:
'latin-1' codec can't encode character u'\u044c' in position 29: ordinal not in range(256)
[!!] Offending table: wifi_AP_ssids
[!!] Data: [{u'sunc': 0, u'mac': u'50a733485398', u'ssid': u" \x07\x7f[T>U\x1dEUX+n\x13Ud\x15\x10%vOnG'6h0\xfa>\u044c\x04B \u07e70\x10xL\x08\x079#\x15)\x11i\x12Y-\x10u\x01\x1b", u'run_id': 1091695474}]

This feels like bad Unicode handling. I'll re-watch "Pragmatic Unicode, or, How do I stop the pain?"

glennzw commented 9 years ago

Actually this turned out to be a MySQL issue, as a server running sqlite was not affected. The solution was to append ?charset=utf8 on the end of the connection string. e.g:

snoopy -v -m server --dbms mysql://someuser:somepass@localhost/snoopy?charset=utf8