Skip to content

Commit

Permalink
Rename GBL to EC_GBL and gbls to ec_gbls
Browse files Browse the repository at this point in the history
  • Loading branch information
LocutusOfBorg authored and koeppea committed Apr 29, 2018
1 parent f2ed223 commit a260415
Show file tree
Hide file tree
Showing 126 changed files with 1,531 additions and 1,532 deletions.
2 changes: 1 addition & 1 deletion include/ec_dissect.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ EC_API_EXTERN int dissect_on_port_level(char *name, u_int16 port, u_int8 level);


#define DISSECT_MSG(x, ...) do { \
if (!GBL_OPTIONS->superquiet) \
if (!EC_GBL_OPTIONS->superquiet) \
USER_MSG(x, ## __VA_ARGS__ ); \
} while(0)

Expand Down
58 changes: 29 additions & 29 deletions include/ec_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ struct wifi_env {
};

/* the globals container */
struct globals {
struct ec_globals {
struct ec_conf *conf;
struct ec_options *options;
struct gbl_stats *stats;
Expand All @@ -196,37 +196,37 @@ struct globals {
struct filter_list *filters;
};

EC_API_EXTERN struct globals *gbls;

#define GBLS gbls

#define GBL_CONF (GBLS->conf)
#define GBL_OPTIONS (GBLS->options)
#define GBL_STATS (GBLS->stats)
#define GBL_UI (GBLS->ui)
#define GBL_ENV (GBLS->env)
#define GBL_PCAP (GBLS->pcap)
#define GBL_LNET (GBLS->lnet)
#define GBL_IFACE (GBLS->iface)
#define GBL_BRIDGE (GBLS->bridge)
#define GBL_SNIFF (GBLS->sm)
#define GBL_TARGET1 (GBLS->t1)
#define GBL_TARGET2 (GBLS->t2)
#define GBL_WIFI (GBLS->wifi)
#define GBL_HOSTLIST (GBLS->hosts_list)
#define GBL_PROFILES (GBLS->profiles_list_head)
#define GBL_FILTERS &(GBLS->filters)

#define GBL_FORMAT (GBL_OPTIONS->format)

#define GBL_PROGRAM (GBL_ENV->name)
#define GBL_VERSION (GBL_ENV->version)
#define GBL_DEBUG_FILE (GBL_ENV->debug_file)
EC_API_EXTERN struct ec_globals *ec_gbls;

#define EC_GBLS ec_gbls

#define EC_GBL_CONF (EC_GBLS->conf)
#define EC_GBL_OPTIONS (EC_GBLS->options)
#define EC_GBL_STATS (EC_GBLS->stats)
#define EC_GBL_UI (EC_GBLS->ui)
#define EC_GBL_ENV (EC_GBLS->env)
#define EC_GBL_PCAP (EC_GBLS->pcap)
#define EC_GBL_LNET (EC_GBLS->lnet)
#define EC_GBL_IFACE (EC_GBLS->iface)
#define EC_GBL_BRIDGE (EC_GBLS->bridge)
#define EC_GBL_SNIFF (EC_GBLS->sm)
#define EC_GBL_TARGET1 (EC_GBLS->t1)
#define EC_GBL_TARGET2 (EC_GBLS->t2)
#define EC_GBL_WIFI (EC_GBLS->wifi)
#define EC_GBL_HOSTLIST (EC_GBLS->hosts_list)
#define EC_GBL_PROFILES (EC_GBLS->profiles_list_head)
#define EC_GBL_FILTERS &(EC_GBLS->filters)

#define EC_GBL_FORMAT (EC_GBL_OPTIONS->format)

#define EC_GBL_PROGRAM (EC_GBL_ENV->name)
#define EC_GBL_VERSION (EC_GBL_ENV->version)
#define EC_GBL_DEBUG_FILE (EC_GBL_ENV->debug_file)

/* exported functions */

EC_API_EXTERN void globals_alloc(void);
EC_API_EXTERN void globals_free(void);
EC_API_EXTERN void ec_globals_alloc(void);
EC_API_EXTERN void ec_globals_free(void);

#endif

Expand Down
2 changes: 1 addition & 1 deletion include/ec_threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ EC_API_EXTERN void ec_thread_init(void);
EC_API_EXTERN void ec_thread_kill_all(void);
EC_API_EXTERN void ec_thread_exit(void);

#define RETURN_IF_NOT_MAIN() do{ if (strcmp(ec_thread_getname(EC_PTHREAD_SELF), GBL_PROGRAM)) return; }while(0)
#define RETURN_IF_NOT_MAIN() do{ if (strcmp(ec_thread_getname(EC_PTHREAD_SELF), EC_GBL_PROGRAM)) return; }while(0)

#define CANCELLATION_POINT() pthread_testcancel()

Expand Down
2 changes: 1 addition & 1 deletion include/ec_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ EC_API_EXTERN void ui_register(struct ui_ops *ops);
* else display a message and continue with the current GUI (curses or gtk)
*/
#define SEMIFATAL_ERROR(x, ...) do { \
if (!GBL_UI->initialized || GBL_UI->type == UI_TEXT || GBL_UI->type == UI_DAEMONIZE) \
if (!EC_GBL_UI->initialized || EC_GBL_UI->type == UI_TEXT || EC_GBL_UI->type == UI_DAEMONIZE) \
FATAL_ERROR(x, ## __VA_ARGS__); \
else \
FATAL_MSG(x, ## __VA_ARGS__); \
Expand Down
8 changes: 4 additions & 4 deletions plug-ins/arp_cop/arp_cop.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static void parse_arp(struct packet_object *po)
LIST_FOREACH(h2, &arp_cop_table, next) {
if (!memcmp(po->L2.src, h2->mac, MEDIA_ADDR_LEN)) {
/* don't report my own poisoning */
if (ip_addr_cmp(&h2->ip, &GBL_IFACE->ip))
if (ip_addr_cmp(&h2->ip, &EC_GBL_IFACE->ip))
USER_MSG("arp_cop: (WARNING) %s[%s] pretends to be %s[%s]\n", ip_addr_ntoa(&h2->ip, tmp1),
mac_addr_ntoa(h2->mac, str1),
ip_addr_ntoa(&h1->ip, tmp2),
Expand Down Expand Up @@ -164,7 +164,7 @@ static void arp_init_list()
return;

/* Fill the arp_cop_table with the initial host list */
LIST_FOREACH(h1, &GBL_HOSTLIST, next) {
LIST_FOREACH(h1, &EC_GBL_HOSTLIST, next) {
SAFE_CALLOC(h2, 1, sizeof(struct hosts_list));
memcpy(&h2->ip, &h1->ip, sizeof(struct ip_addr));
memcpy(h2->mac, h1->mac, MEDIA_ADDR_LEN);
Expand All @@ -173,8 +173,8 @@ static void arp_init_list()

/* Add our IP address */
SAFE_CALLOC(h2, 1, sizeof(struct hosts_list));
memcpy(&h2->ip, &GBL_IFACE->ip, sizeof(struct ip_addr));
memcpy(h2->mac, GBL_IFACE->mac, MEDIA_ADDR_LEN);
memcpy(&h2->ip, &EC_GBL_IFACE->ip, sizeof(struct ip_addr));
memcpy(h2->mac, EC_GBL_IFACE->mac, MEDIA_ADDR_LEN);
LIST_INSERT_HEAD(&arp_cop_table, h2, next);
}

Expand Down
16 changes: 8 additions & 8 deletions plug-ins/autoadd/autoadd.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,32 +99,32 @@ static void parse_arp(struct packet_object *po)
return;

/* don't add our addresses */
if (!ip_addr_cmp(&GBL_IFACE->ip, &po->L3.src))
if (!ip_addr_cmp(&EC_GBL_IFACE->ip, &po->L3.src))
return;
if (!memcmp(&GBL_IFACE->mac, &po->L2.src, MEDIA_ADDR_LEN))
if (!memcmp(&EC_GBL_IFACE->mac, &po->L2.src, MEDIA_ADDR_LEN))
return;

/* don't add undefined address */
if (ip_addr_is_zero(&po->L3.src))
return;

/* search in target 1 */
if (GBL_TARGET1->all_ip) {
if (EC_GBL_TARGET1->all_ip) {
if (add_to_victims(&arp_group_one, po) == E_SUCCESS)
USER_MSG("autoadd: %s %s added to GROUP1\n", ip_addr_ntoa(&po->L3.src, tmp), mac_addr_ntoa(po->L2.src, tmp2));
} else {
LIST_FOREACH(t, &GBL_TARGET1->ips, next)
LIST_FOREACH(t, &EC_GBL_TARGET1->ips, next)
if (!ip_addr_cmp(&t->ip, &po->L3.src))
if (add_to_victims(&arp_group_one, po) == E_SUCCESS)
USER_MSG("autoadd: %s %s added to GROUP1\n", ip_addr_ntoa(&po->L3.src, tmp), mac_addr_ntoa(po->L2.src, tmp2));
}

/* search in target 2 */
if (GBL_TARGET2->all_ip) {
if (EC_GBL_TARGET2->all_ip) {
if (add_to_victims(&arp_group_two, po) == E_SUCCESS)
USER_MSG("autoadd: %s %s added to GROUP2\n", ip_addr_ntoa(&po->L3.src, tmp), mac_addr_ntoa(po->L2.src, tmp2));
} else {
LIST_FOREACH(t, &GBL_TARGET2->ips, next)
LIST_FOREACH(t, &EC_GBL_TARGET2->ips, next)
if (!ip_addr_cmp(&t->ip, &po->L3.src))
if (add_to_victims(&arp_group_two, po) == E_SUCCESS)
USER_MSG("autoadd: %s %s added to GROUP2\n", ip_addr_ntoa(&po->L3.src, tmp), mac_addr_ntoa(po->L2.src, tmp2));
Expand Down Expand Up @@ -158,7 +158,7 @@ static int add_to_victims(void *group, struct packet_object *po)
LIST_INSERT_HEAD(head, h, next);

/* add the host even in the hosts list */
LIST_FOREACH(h, &GBL_HOSTLIST, next)
LIST_FOREACH(h, &EC_GBL_HOSTLIST, next)
if (!ip_addr_cmp(&h->ip, &po->L3.src))
return E_SUCCESS;

Expand All @@ -172,7 +172,7 @@ static int add_to_victims(void *group, struct packet_object *po)
memcpy(&h->mac, &po->L2.src, MEDIA_ADDR_LEN);

DEBUG_MSG("autoadd: added %s to hosts list", ip_addr_ntoa(&h->ip, tmp));
LIST_INSERT_HEAD(&GBL_HOSTLIST, h, next);
LIST_INSERT_HEAD(&EC_GBL_HOSTLIST, h, next);

return E_SUCCESS;
}
Expand Down
4 changes: 2 additions & 2 deletions plug-ins/chk_poison/chk_poison.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static int chk_poison_init(void *dummy)
(void) dummy;

/* don't show packets while operating */
GBL_OPTIONS->quiet = 1;
EC_GBL_OPTIONS->quiet = 1;

if (LIST_EMPTY(&arp_group_one) || LIST_EMPTY(&arp_group_two)) {
INSTANT_USER_MSG("chk_poison: You have to run this plugin during a poisoning session.\n\n");
Expand Down Expand Up @@ -127,7 +127,7 @@ static int chk_poison_init(void *dummy)
SLIST_FOREACH(p, &poison_table, next) {
for (i = 0; i <= 1; i++) {
send_L3_icmp_echo(&(p->ip[i]), &(p->ip[!i]));
ec_usleep(MILLI2MICRO(GBL_CONF->arp_storm_delay));
ec_usleep(MILLI2MICRO(EC_GBL_CONF->arp_storm_delay));
}
}

Expand Down
2 changes: 1 addition & 1 deletion plug-ins/dns_spoof/dns_spoof.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ static void dns_spoof(struct packet_object *po)
po->flags |= PO_DROPPED;

/* set incoming interface as outgoing interface for reply */
iface = po->flags & PO_FROMIFACE ? GBL_IFACE : GBL_BRIDGE;
iface = po->flags & PO_FROMIFACE ? EC_GBL_IFACE : EC_GBL_BRIDGE;

/* allocate memory for the dns reply */
SAFE_CALLOC(dns_reply, dns_len, sizeof(u_int8));
Expand Down
8 changes: 4 additions & 4 deletions plug-ins/dos_attack/dos_attack.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ static int dos_attack_init(void *dummy)
(void) dummy;

/* It doesn't work if unoffensive */
if (GBL_OPTIONS->unoffensive) {
if (EC_GBL_OPTIONS->unoffensive) {
INSTANT_USER_MSG("dos_attack: plugin doesn't work in UNOFFENSIVE mode\n");
return PLUGIN_FINISHED;
}

/* don't show packets while operating */
GBL_OPTIONS->quiet = 1;
EC_GBL_OPTIONS->quiet = 1;

memset(dos_addr, 0, sizeof(dos_addr));
memset(unused_addr, 0, sizeof(dos_addr));
Expand Down Expand Up @@ -207,7 +207,7 @@ EC_THREAD_FUNC(syn_flooder)
static void parse_arp(struct packet_object *po)
{
if (!ip_addr_cmp(&fake_host, &po->L3.dst))
send_arp(ARPOP_REPLY, &po->L3.dst, GBL_IFACE->mac, &po->L3.src, po->L2.src);
send_arp(ARPOP_REPLY, &po->L3.dst, EC_GBL_IFACE->mac, &po->L3.src, po->L2.src);
}

#ifdef WITH_IPV6
Expand All @@ -216,7 +216,7 @@ static void parse_icmp6(struct packet_object *po)
struct ip_addr ip;
ip_addr_init(&ip, AF_INET6, po->L4.options);
if(!ip_addr_cmp(&fake_host, &ip))
send_L2_icmp6_nadv(&fake_host, &po->L3.src, GBL_IFACE->mac, 0, po->L2.src);
send_L2_icmp6_nadv(&fake_host, &po->L3.src, EC_GBL_IFACE->mac, 0, po->L2.src);
}
#endif

Expand Down
16 changes: 8 additions & 8 deletions plug-ins/find_ip/find_ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ static int find_ip_init(void *dummy)
(void) dummy;

/* don't show packets while operating */
GBL_OPTIONS->quiet = 1;
EC_GBL_OPTIONS->quiet = 1;

if (LIST_EMPTY(&GBL_HOSTLIST)) {
if (LIST_EMPTY(&EC_GBL_HOSTLIST)) {
INSTANT_USER_MSG("find_ip: You have to build host-list to run this plugin.\n\n");
return PLUGIN_FINISHED;
}

INSTANT_USER_MSG("find_ip: Searching an unused IP address...\n");

/* If one of the targets is // search in the whole subnet */
if (GBL_TARGET1->scan_all || GBL_TARGET2->scan_all)
if (EC_GBL_TARGET1->scan_all || EC_GBL_TARGET2->scan_all)
e = search_netmask();
else
e = search_targets();
Expand Down Expand Up @@ -108,7 +108,7 @@ static int in_list(struct ip_addr *scanip)
{
struct hosts_list *h;

LIST_FOREACH(h, &GBL_HOSTLIST, next) {
LIST_FOREACH(h, &EC_GBL_HOSTLIST, next) {
if (!ip_addr_cmp(scanip, &h->ip)) {
return 1;
}
Expand All @@ -124,8 +124,8 @@ static struct ip_addr *search_netmask(void)
int nhosts, i;
static struct ip_addr scanip;

netmask = *GBL_IFACE->netmask.addr32;
myip = *GBL_IFACE->ip.addr32;
netmask = *EC_GBL_IFACE->netmask.addr32;
myip = *EC_GBL_IFACE->ip.addr32;

/* the number of hosts in this netmask */
nhosts = ntohl(~netmask);
Expand All @@ -148,12 +148,12 @@ static struct ip_addr *search_targets(void)
{
struct ip_list *i;

LIST_FOREACH(i, &GBL_TARGET1->ips, next) {
LIST_FOREACH(i, &EC_GBL_TARGET1->ips, next) {
if (!in_list(&i->ip))
return(&i->ip);
}

LIST_FOREACH(i, &GBL_TARGET2->ips, next) {
LIST_FOREACH(i, &EC_GBL_TARGET2->ips, next) {
if (!in_list(&i->ip))
return(&i->ip);
}
Expand Down
16 changes: 8 additions & 8 deletions plug-ins/finger/finger.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ static int finger_init(void *dummy)
(void) dummy;

/* don't show packets while operating */
GBL_OPTIONS->quiet = 1;
EC_GBL_OPTIONS->quiet = 1;

/* wipe the global vars */
memset(&ip, 0, sizeof(struct ip_addr));
port = 0;

/*
* can we use GBL_TARGETS ?
* can we use EC_GBL_TARGETS ?
* else ask the user
*/
if (good_target(&ip, &port) != E_SUCCESS) {
Expand All @@ -102,7 +102,7 @@ static int finger_init(void *dummy)
struct ip_list *host;

/* look over all the hosts in the TARGET */
LIST_FOREACH(host, &GBL_TARGET1->ips, next) {
LIST_FOREACH(host, &EC_GBL_TARGET1->ips, next) {
/*
* copy the ip address
* the port was alread retrived by good_target()
Expand All @@ -111,7 +111,7 @@ static int finger_init(void *dummy)

/* cicle thru all the specified port */
for (port = 0; port < 0xffff; port++) {
if (BIT_TEST(GBL_TARGET1->ports, port)) {
if (BIT_TEST(EC_GBL_TARGET1->ports, port)) {
/* do the actual finterprinting */
do_fingerprint();
}
Expand Down Expand Up @@ -147,21 +147,21 @@ static void get_finger(struct packet_object *po)
}

/*
* check if we can use GBL_TARGETS
* check if we can use EC_GBL_TARGETS
*/
static int good_target(struct ip_addr *p_ip, u_int16 *p_port)
{
struct ip_list *host;

/* is it possible to get it from GBL_TARGETS ? */
if ((host = LIST_FIRST(&GBL_TARGET1->ips)) != NULL) {
/* is it possible to get it from EC_GBL_TARGETS ? */
if ((host = LIST_FIRST(&EC_GBL_TARGET1->ips)) != NULL) {

/* copy the ip address */
memcpy(p_ip, &host->ip, sizeof(struct ip_addr));

/* find the port */
for (*p_port = 0; *p_port < 0xffff; (*p_port)++) {
if (BIT_TEST(GBL_TARGET1->ports, *p_port)) {
if (BIT_TEST(EC_GBL_TARGET1->ports, *p_port)) {
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion plug-ins/finger_submit/finger_submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static int finger_submit_init(void *dummy)
(void) dummy;

/* don't display messages while operating */
GBL_OPTIONS->quiet = 1;
EC_GBL_OPTIONS->quiet = 1;

memset(finger, 0, sizeof(finger));
memset(os, 0, sizeof(finger));
Expand Down
Loading

0 comments on commit a260415

Please sign in to comment.