Skip to content
Permalink
Browse files

fix bugs of -w and -b option

  • Loading branch information...
E7mer committed Aug 14, 2019
1 parent 0b22a65 commit 46c70663d8935dad7812e54f0a4f77520b763436
Showing with 56 additions and 30 deletions.
  1. +28 −3 src/attacks/deauth.c
  2. +28 −27 src/greylist.c
@@ -178,9 +178,10 @@ unsigned char accept_target1(struct packet *pkt, struct deauth_options *dopt) {

// If any of the Adresses is Blacklisted, ACCEPT target
if (dopt->blacklist_from_file == 1) {
if (is_blacklisted(hdr->addr1)) return 1;
if (is_blacklisted(hdr->addr2)) return 1;
if (is_blacklisted(hdr->addr3)) return 1;
if (is_blacklisted(hdr->addr1) || is_blacklisted(hdr->addr2) || is_blacklisted(hdr->addr3))
{
return 1;
}
}

if(dopt->blacklist_from_bssid == 1 && dopt->blacklist_from_station == 1)
@@ -260,6 +261,30 @@ unsigned char accept_target1(struct packet *pkt, struct deauth_options *dopt) {
if(MAC_MATCHES(mac_block, hdr->addr1) || MAC_MATCHES(mac_block, hdr->addr2) || MAC_MATCHES(mac_block, hdr->addr3))
return 1;
}

if(dopt->whitelist_from_file == 1)
{
if (is_whitelisted(hdr->addr1) || is_whitelisted(hdr->addr2) || is_whitelisted(hdr->addr3))
{
return 0;
}
else
{
return 1;
}
}

if(dopt->whitelist_from_station == 1)
{
if(MAC_MATCHES(white_mac, hdr->addr1) || MAC_MATCHES(white_mac, hdr->addr2) || MAC_MATCHES(white_mac, hdr->addr3))
{
return 0;
}
else
{
return 1;
}
}

return 0;
}
@@ -18,41 +18,42 @@ typedef enum
}list_type;

struct greylist *glist = NULL;
struct blacklist *blist = NULL;
struct whitelist *wlist = NULL;
struct greylist *blist = NULL;
struct greylist *wlist = NULL;

char black = 0;
char white = 0;


struct greylist *add_to_greylist(struct ether_addr new, struct greylist *glist) {
struct greylist *add_to_greylist(struct ether_addr new, struct greylist *gl) {
struct greylist *gnew = malloc(sizeof(struct greylist));

gnew->mac = new;

if (glist) {
gnew->next = glist->next;
glist->next = gnew;
if (gl) {
gnew->next = gl->next;
gl->next = gnew;
} else {
glist = gnew;
gl = gnew;
gnew->next = gnew;
}

return glist;
return gl;
}

struct greylist *search_in_greylist(struct ether_addr mac, struct greylist *glist) {
struct greylist *search_in_greylist(struct ether_addr mac, struct greylist *gl) {
struct greylist *first;

if (! glist) return NULL;
if (! gl) return NULL;

first = glist;
first = gl;

do {
if (MAC_MATCHES(mac, glist->mac)) {
return glist;
if (MAC_MATCHES(mac, gl->mac)) {
return gl;
}
glist = glist->next;
} while (glist != first);
gl = gl->next;
} while (gl != first);

return NULL;
}
@@ -61,28 +62,28 @@ void load_greylist(list_type type, char *filename) {
char *entry;

if (filename) {

if(type == BLACK_LIST)
{
glist = blist;
black = 1;
}
else if(type == WHITE_LIST)
{
glist = wlist;
white = 1;
}

entry = read_next_line(filename, 1);
while(entry)
{
if (!search_in_greylist(parse_mac(entry), glist)) //Only add new entries
{
{
glist = add_to_greylist(parse_mac(entry), glist);
}
free(entry);
entry = read_next_line(filename, 0);
}

if(type == BLACK_LIST)
{
blist = glist;
black = 1;
}
else if(type == WHITE_LIST)
{
wlist = glist;
white = 1;
}
}
}

0 comments on commit 46c7066

Please sign in to comment.
You can’t perform that action at this time.