Fix up cell result parsing
parent
99a74fd4d2
commit
b9e176cd77
|
@ -84,8 +84,6 @@ class Android < Extension
|
||||||
collections: []
|
collections: []
|
||||||
}
|
}
|
||||||
|
|
||||||
p [opts, response]
|
|
||||||
|
|
||||||
case COLLECT_TYPES[opts[:type]]
|
case COLLECT_TYPES[opts[:type]]
|
||||||
when COLLECT_TYPE_WIFI
|
when COLLECT_TYPE_WIFI
|
||||||
result[:headers] = ['Last Seen', 'BSSID', 'SSID', 'Level']
|
result[:headers] = ['Last Seen', 'BSSID', 'SSID', 'Level']
|
||||||
|
@ -136,38 +134,39 @@ class Android < Extension
|
||||||
records = {}
|
records = {}
|
||||||
|
|
||||||
response.each(TLV_TYPE_COLLECT_RESULT_GROUP) do |g|
|
response.each(TLV_TYPE_COLLECT_RESULT_GROUP) do |g|
|
||||||
p ["RESULT", g]
|
|
||||||
timestamp = g.get_tlv_value(TLV_TYPE_COLLECT_RESULT_TIMESTAMP)
|
timestamp = g.get_tlv_value(TLV_TYPE_COLLECT_RESULT_TIMESTAMP)
|
||||||
timestamp = Time.at(timestamp).to_datetime.strftime('%Y-%m-%d %H:%M:%S')
|
timestamp = Time.at(timestamp).to_datetime.strftime('%Y-%m-%d %H:%M:%S')
|
||||||
|
|
||||||
active_gsm = g.get_tlv_value(TLV_TYPE_CELL_ACTIVE_GSM)
|
g.each(TLV_TYPE_COLLECT_RESULT_CELL) do |cell|
|
||||||
if active_gsm
|
|
||||||
cid = get_tlv_value(TLV_TYPE_CELL_CID)
|
|
||||||
lac = get_tlv_value(TLV_TYPE_CELL_LAC)
|
|
||||||
psc = get_tlv_value(TLV_TYPE_CELL_PSC)
|
|
||||||
info = sprintf("cid=%d lac=%d psc=%d", cid, lac, psc)
|
|
||||||
result[:entries] << [timestamp, "GSM: #{info}"]
|
|
||||||
end
|
|
||||||
|
|
||||||
active_cdma = g.get_tlv_value(TLV_TYPE_CELL_ACTIVE_CDMA)
|
cell.each(TLV_TYPE_CELL_ACTIVE_GSM) do |info|
|
||||||
if active_cdma
|
cid = info.get_tlv_value(TLV_TYPE_CELL_CID)
|
||||||
bid = get_tlv_value(TLV_TYPE_CELL_BASE_ID)
|
lac = info.get_tlv_value(TLV_TYPE_CELL_LAC)
|
||||||
lat = get_tlv_value(TLV_TYPE_CELL_BASE_LAT)
|
psc = info.get_tlv_value(TLV_TYPE_CELL_PSC)
|
||||||
lng = get_tlv_value(TLV_TYPE_CELL_BASE_LONG)
|
info = sprintf("cid=%d lac=%d psc=%d", cid, lac, psc)
|
||||||
net = get_tlv_value(TLV_TYPE_CELL_NET_ID)
|
result[:entries] << [timestamp, "GSM: #{info}"]
|
||||||
sys = get_tlv_value(TLV_TYPE_CELL_SYSTEM_ID)
|
end
|
||||||
info = sprintf("base_id=%d lat=%d lng=%d net_id=%d sys_id=%d", bid, lat, lng, net, sys)
|
|
||||||
result[:entries] << [timestamp, "CDMA: #{info}"]
|
cell.each(TLV_TYPE_CELL_ACTIVE_CDMA) do |info|
|
||||||
end
|
bid = info.get_tlv_value(TLV_TYPE_CELL_BASE_ID)
|
||||||
|
lat = info.get_tlv_value(TLV_TYPE_CELL_BASE_LAT)
|
||||||
|
lng = info.get_tlv_value(TLV_TYPE_CELL_BASE_LONG)
|
||||||
|
net = info.get_tlv_value(TLV_TYPE_CELL_NET_ID)
|
||||||
|
sys = info.get_tlv_value(TLV_TYPE_CELL_SYSTEM_ID)
|
||||||
|
info = sprintf("base_id=%d lat=%d lng=%d net_id=%d sys_id=%d", bid, lat, lng, net, sys)
|
||||||
|
result[:entries] << [timestamp, "CDMA: #{info}"]
|
||||||
|
end
|
||||||
|
|
||||||
|
cell.each(TLV_TYPE_CELL_NEIGHBOR) do |w|
|
||||||
|
net = w.get_tlv_value(TLV_TYPE_CELL_NET_TYPE)
|
||||||
|
cid = w.get_tlv_value(TLV_TYPE_CELL_CID)
|
||||||
|
lac = w.get_tlv_value(TLV_TYPE_CELL_LAC)
|
||||||
|
psc = w.get_tlv_value(TLV_TYPE_CELL_PSC)
|
||||||
|
sig = w.get_tlv_value(TLV_TYPE_CELL_RSSI) * -1
|
||||||
|
inf = sprintf("network_type=%d cid=%d lac=%d psc=%d rssi=%d", net, cid, lac, psc, sig)
|
||||||
|
result[:entries] << [timestamp, inf]
|
||||||
|
end
|
||||||
|
|
||||||
g.each(TLV_TYPE_CELL_NEIGHBOR) do |w|
|
|
||||||
net = w.get_tlv_value(TLV_TYPE_CELL_NET_TYPE)
|
|
||||||
cid = w.get_tlv_value(TLV_TYPE_CELL_CID)
|
|
||||||
lac = w.get_tlv_value(TLV_TYPE_CELL_LAC)
|
|
||||||
psc = w.get_tlv_value(TLV_TYPE_CELL_PSC)
|
|
||||||
sig = w.get_tlv_value(TLV_TYPE_CELL_RSSI) * -1
|
|
||||||
inf = sprintf("network_type=%d cid=%d lac=%d psc=%d rssi=%d", net, cid, lac, psc, sig)
|
|
||||||
result[:entries] << [timestamp, inf]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue