@@ -233,9 +233,6 @@ void Packet::write_wigle_output(const std::string& p_time)
233
233
char buffer[32 ] = {0 };
234
234
std::string time;
235
235
236
- std::string most;
237
- std::size_t count = 0 ;
238
-
239
236
// loop over the router
240
237
boost::upgrade_lock<boost::shared_mutex> readLock (m_router_mutex);
241
238
for (boost::ptr_unordered_map<boost::uint64_t , AP>::iterator it = m_devices.begin ();
@@ -251,12 +248,6 @@ void Packet::write_wigle_output(const std::string& p_time)
251
248
os << it->second ->get_ssid () << " ," ;
252
249
}
253
250
254
- if (it->second ->get_client_count () > count && !it->second ->get_ssid ().empty () && it->second ->get_ssid () != " <Unknown>" )
255
- {
256
- count = it->second ->get_client_count ();
257
- most.assign (it->second ->get_ssid ());
258
- }
259
-
260
251
if (it->second ->get_encryption ().find (" /" ) != std::string::npos)
261
252
{
262
253
os << " [WPA-PSK][WPA2-PSK]" ;
@@ -287,7 +278,6 @@ void Packet::write_wigle_output(const std::string& p_time)
287
278
os << " WIFI" << " \n " ;
288
279
}
289
280
290
- std::cout << most << " :" << count << std::endl;
291
281
// close it
292
282
wigle_output.close ();
293
283
}
@@ -361,6 +351,50 @@ void Packet::write_probe_csv_output(const std::string& p_time)
361
351
client_output.close ();
362
352
}
363
353
354
+ void Packet::write_ap_clients_csv_output (const std::string& p_time)
355
+ {
356
+ std::string filename (m_configuration.get_output_path () + " pi_sniffer_ap_clients_" + p_time + " .csv" );
357
+
358
+ // create the file
359
+ std::filebuf ap_clients_output;
360
+ ap_clients_output.open (filename, std::ios::out);
361
+ if (!ap_clients_output.is_open ())
362
+ {
363
+ std::cerr << " Failed to write " << filename << std::endl;
364
+ return ;
365
+ }
366
+ std::ostream os (&ap_clients_output);
367
+
368
+ // data fields
369
+ os << " Clients,SSID,MAC,\n " ;
370
+
371
+ // loop over the router
372
+ boost::upgrade_lock<boost::shared_mutex> readLock (m_router_mutex);
373
+ for (boost::ptr_unordered_map<boost::uint64_t , AP>::iterator it = m_devices.begin ();
374
+ it != m_devices.end (); ++it)
375
+ {
376
+ if (it->second ->get_mac () == " 00:00:00:00:00:00" )
377
+ {
378
+ continue ;
379
+ }
380
+
381
+ os << it->second ->get_client_count () << " ," ;
382
+ if (it->second ->get_ssid () == " <Unknown>" )
383
+ {
384
+ os << " ," ;
385
+ }
386
+ else
387
+ {
388
+ os << it->second ->get_ssid () << " ," ;
389
+ }
390
+
391
+ os << it->second ->get_mac () << std::endl;
392
+ }
393
+
394
+ // close it
395
+ ap_clients_output.close ();
396
+ }
397
+
364
398
void Packet::add_probe_network (const std::string& p_network, const std::string& p_client)
365
399
{
366
400
if (p_network.size () < 3 )
0 commit comments