|
NETWORK ATTACKS FRAMEWORK
1.0.0
A NETwork Attacks framework. Making network attacks impact evaluation easier!
|
#include "NA_defs.h"#include "NA_debug.h"#include <sys/types.h>#include <sys/ioctl.h>#include <sys/uio.h>#include <asm/types.h>#include <ctype.h>#include <time.h>#include <sys/time.h>#include <net/ethernet.h>#include <linux/netlink.h>#include <linux/rtnetlink.h>#include <linux/wireless.h>#include <iwlib.h>#include "NA_aodv_neighbor.h"#include "NA_routing_table.h"Go to the source code of this file.
Classes | |
| struct | rtnl_handle |
| struct | wireless_iface |
Typedefs | |
| typedef struct wireless_iface | wireless_iface |
Functions | |
| void | llf_init () |
| void | llf_cleanup () |
| int | mac_to_ip (struct sockaddr *hwaddr, struct in_addr *ip_addr, char *ifname) |
Variables | |
| struct wireless_iface * | interface_cache = NULL |
| typedef struct wireless_iface wireless_iface |
| void llf_cleanup | ( | ) |
| void llf_init | ( | ) |
| int mac_to_ip | ( | struct sockaddr * | hwaddr, |
| struct in_addr * | ip_addr, | ||
| char * | ifname | ||
| ) |
Definition at line 221 of file NA_llf.c.
{
FILE *fp;
char ip[100];
char hwa[100];
char mask[100];
char line[200];
char dev[100];
int type, flags, num;
struct ether_addr eth;
if ((fp = fopen("/proc/net/arp", "r")) == NULL) {
perror("/proc/net/arp");
return (-1);
}
/* Bypass header -- read until newline */
if (fgets(line, sizeof(line), fp) != (char *) NULL) {
strcpy(mask, "-");
strcpy(dev, "-");
/* Read the ARP cache entries. */
for (; fgets(line, sizeof(line), fp);) {
num = sscanf(line, "%s 0x%x 0x%x %100s %100s %100s\n",
ip, &type, &flags, hwa, mask, dev);
if (num < 4)
break;
iw_ether_aton(hwa, ð);
if (memcmp(ð, hwaddr->sa_data, ETH_ALEN) == 0) {
inet_aton(ip, ip_addr);
fclose(fp);
return 0;
}
}
}
fclose(fp);
return -1;
}
| struct wireless_iface* interface_cache = NULL |