Storing of multiple packets in an array
Posted: Wed Oct 07, 2015 2:20 am
Hello folks,
Working on promusicous (sniffer)mode. I have to store multiple packets i.e string in an array.My following codes just provide me the last MAC address as shown below. Plz guide me how to resolve the issue or another approach to do it .
count=0;
os_printf("Starting for Sniffing the packets \r\n");
switch (len)
{
case 128:
os_printf("Management Packet (len=128) Sniffed on Channel %d\n", sniffer_channel);
break;
case 60:
os_printf("Data Packet (len=60) Sniffed on Channel %d\n", sniffer_channel);
struct sniffer_buf *sniffer_data = (struct sniffer_buf*) buf;
os_printf("cnt: %d\n", sniffer_data->cnt);
struct probe_request_80211 *probe_request = (struct probe_request_80211*) sniffer_data->buf;
os_sprintf(buffer0, " rdaddr: %02x:%02x:%02x:%02x:%02x:%02x\r\n ", probe_request->rdaddr[0],probe_request->rdaddr[1],probe_request->rdaddr[2],probe_request->rdaddr[3],probe_request->rdaddr[4],probe_request->rdaddr[5]);
os_sprintf(buffer1, " tsaddr: %02x:%02x:%02x:%02x:%02x:%02x\r\n ", probe_request->tsaddr[0],probe_request->tsaddr[1],probe_request->tsaddr[2],probe_request->tsaddr[3],probe_request->tsaddr[4],probe_request->tsaddr[5]);
os_sprintf(buffer2, " bssid: %02x:%02x:%02x:%02x:%02x:%02x\r\n ", probe_request->bssid[0],probe_request->bssid[1],probe_request->bssid[2],probe_request->bssid[3],probe_request->bssid[4],probe_request->bssid[5]);
os_sprintf(buffer3, " addr4: %02x:%02x:%02x:%02x:%02x:%02x\r\n ", probe_request->addr4[0],probe_request->addr4[1],probe_request->addr4[2],probe_request->addr4[3],probe_request->addr4[4],probe_request->addr4[5]);
os_strcat(buffer0,buffer1);
os_strcat(buffer0,buffer2);
os_strcat(buffer0,buffer3);
os_printf("Final string:- %s\r\n ",buffer0);
packets[count] =buffer0;
count=count+1;
if(count<3)
{
os_printf("Counter mode\r\n");
}
else
{
int i;
for(i=0;i<count;i++)
{
os_printf("Multiple Packet: %s\r\n ",packets[i]);
}
}
Working on promusicous (sniffer)mode. I have to store multiple packets i.e string in an array.My following codes just provide me the last MAC address as shown below. Plz guide me how to resolve the issue or another approach to do it .
count=0;
os_printf("Starting for Sniffing the packets \r\n");
switch (len)
{
case 128:
os_printf("Management Packet (len=128) Sniffed on Channel %d\n", sniffer_channel);
break;
case 60:
os_printf("Data Packet (len=60) Sniffed on Channel %d\n", sniffer_channel);
struct sniffer_buf *sniffer_data = (struct sniffer_buf*) buf;
os_printf("cnt: %d\n", sniffer_data->cnt);
struct probe_request_80211 *probe_request = (struct probe_request_80211*) sniffer_data->buf;
os_sprintf(buffer0, " rdaddr: %02x:%02x:%02x:%02x:%02x:%02x\r\n ", probe_request->rdaddr[0],probe_request->rdaddr[1],probe_request->rdaddr[2],probe_request->rdaddr[3],probe_request->rdaddr[4],probe_request->rdaddr[5]);
os_sprintf(buffer1, " tsaddr: %02x:%02x:%02x:%02x:%02x:%02x\r\n ", probe_request->tsaddr[0],probe_request->tsaddr[1],probe_request->tsaddr[2],probe_request->tsaddr[3],probe_request->tsaddr[4],probe_request->tsaddr[5]);
os_sprintf(buffer2, " bssid: %02x:%02x:%02x:%02x:%02x:%02x\r\n ", probe_request->bssid[0],probe_request->bssid[1],probe_request->bssid[2],probe_request->bssid[3],probe_request->bssid[4],probe_request->bssid[5]);
os_sprintf(buffer3, " addr4: %02x:%02x:%02x:%02x:%02x:%02x\r\n ", probe_request->addr4[0],probe_request->addr4[1],probe_request->addr4[2],probe_request->addr4[3],probe_request->addr4[4],probe_request->addr4[5]);
os_strcat(buffer0,buffer1);
os_strcat(buffer0,buffer2);
os_strcat(buffer0,buffer3);
os_printf("Final string:- %s\r\n ",buffer0);
packets[count] =buffer0;
count=count+1;
if(count<3)
{
os_printf("Counter mode\r\n");
}
else
{
int i;
for(i=0;i<count;i++)
{
os_printf("Multiple Packet: %s\r\n ",packets[i]);
}
}