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,31 +134,30 @@ 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)
|
cell.each(TLV_TYPE_CELL_ACTIVE_GSM) do |info|
|
||||||
lac = get_tlv_value(TLV_TYPE_CELL_LAC)
|
cid = info.get_tlv_value(TLV_TYPE_CELL_CID)
|
||||||
psc = get_tlv_value(TLV_TYPE_CELL_PSC)
|
lac = info.get_tlv_value(TLV_TYPE_CELL_LAC)
|
||||||
|
psc = info.get_tlv_value(TLV_TYPE_CELL_PSC)
|
||||||
info = sprintf("cid=%d lac=%d psc=%d", cid, lac, psc)
|
info = sprintf("cid=%d lac=%d psc=%d", cid, lac, psc)
|
||||||
result[:entries] << [timestamp, "GSM: #{info}"]
|
result[:entries] << [timestamp, "GSM: #{info}"]
|
||||||
end
|
end
|
||||||
|
|
||||||
active_cdma = g.get_tlv_value(TLV_TYPE_CELL_ACTIVE_CDMA)
|
cell.each(TLV_TYPE_CELL_ACTIVE_CDMA) do |info|
|
||||||
if active_cdma
|
bid = info.get_tlv_value(TLV_TYPE_CELL_BASE_ID)
|
||||||
bid = get_tlv_value(TLV_TYPE_CELL_BASE_ID)
|
lat = info.get_tlv_value(TLV_TYPE_CELL_BASE_LAT)
|
||||||
lat = get_tlv_value(TLV_TYPE_CELL_BASE_LAT)
|
lng = info.get_tlv_value(TLV_TYPE_CELL_BASE_LONG)
|
||||||
lng = get_tlv_value(TLV_TYPE_CELL_BASE_LONG)
|
net = info.get_tlv_value(TLV_TYPE_CELL_NET_ID)
|
||||||
net = get_tlv_value(TLV_TYPE_CELL_NET_ID)
|
sys = info.get_tlv_value(TLV_TYPE_CELL_SYSTEM_ID)
|
||||||
sys = 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)
|
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}"]
|
result[:entries] << [timestamp, "CDMA: #{info}"]
|
||||||
end
|
end
|
||||||
|
|
||||||
g.each(TLV_TYPE_CELL_NEIGHBOR) do |w|
|
cell.each(TLV_TYPE_CELL_NEIGHBOR) do |w|
|
||||||
net = w.get_tlv_value(TLV_TYPE_CELL_NET_TYPE)
|
net = w.get_tlv_value(TLV_TYPE_CELL_NET_TYPE)
|
||||||
cid = w.get_tlv_value(TLV_TYPE_CELL_CID)
|
cid = w.get_tlv_value(TLV_TYPE_CELL_CID)
|
||||||
lac = w.get_tlv_value(TLV_TYPE_CELL_LAC)
|
lac = w.get_tlv_value(TLV_TYPE_CELL_LAC)
|
||||||
|
@ -169,6 +166,8 @@ class Android < Extension
|
||||||
inf = sprintf("network_type=%d cid=%d lac=%d psc=%d rssi=%d", net, cid, lac, psc, sig)
|
inf = sprintf("network_type=%d cid=%d lac=%d psc=%d rssi=%d", net, cid, lac, psc, sig)
|
||||||
result[:entries] << [timestamp, inf]
|
result[:entries] << [timestamp, inf]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue