本文整理汇总了C++中USER_MSG函数的典型用法代码示例。如果您正苦于以下问题:C++ USER_MSG函数的具体用法?C++ USER_MSG怎么用?C++ USER_MSG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了USER_MSG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: icmp_redirect
/*
* the redirect function.
*
* redirect all the traffic that goes thru the gateway
* check the dst mac address and the dst ip address.
*
* respect the TARGETs for the redirections
*/
static void icmp_redirect(struct packet_object *po)
{
struct ip_list *i;
char tmp[MAX_ASCII_ADDR_LEN];
/* retrieve the gw ip */
i = LIST_FIRST(&redirected_gw.ips);
/* the packet must be directed to the gateway */
if (memcmp(po->L2.dst, redirected_gw.mac, MEDIA_ADDR_LEN))
return;
/*
* if the packet endpoint is the gateway, skip it.
* we are interested only in packet going THRU the
* gateway, not TO the gateway
*/
if (!ip_addr_cmp(&po->L3.dst, &i->ip))
return;
/* redirect only the connection that match the TARGETS */
EXECUTE(GBL_SNIFF->interesting, po);
/* the packet is not interesting */
if ( po->flags & PO_IGNORE )
return;
USER_MSG("ICMP redirected %s:%d -> ", ip_addr_ntoa(&po->L3.src, tmp), ntohs(po->L4.src));
USER_MSG("%s:%d\n", ip_addr_ntoa(&po->L3.dst, tmp), ntohs(po->L4.dst));
/* send the ICMP redirect */
send_icmp_redir(ICMP_REDIRECT_HOST, &i->ip, &GBL_IFACE->ip, po);
}
示例2: parse_smb
/* Clear the encryption bit in the SecurityModel request */
static void parse_smb(struct packet_object *po)
{
SMB_header *smb;
NetBIOS_header *NetBIOS;
u_char *ptr;
char tmp[MAX_ASCII_ADDR_LEN];
/* It's unuseful to modify packets that won't be forwarded */
if (!(po->flags & PO_FORWARDABLE))
return;
/* Catch netbios and smb headers */
NetBIOS = (NetBIOS_header *)po->DATA.data;
smb = (SMB_header *)(NetBIOS + 1);
/* Let's go to the data */
ptr = (u_char *)(smb + 1);
/* According to the Hook Point we are sure that this is
* a NegotiateProtocol response packet.
* Now we can change the Security Mode
* 010 (encrypted) 000 (plaintext)
*/
if (ptr[3] & 2) {
ptr[3] ^= 2;
USER_MSG("smb_clear: Forced SMB clear text auth %s -> ", ip_addr_ntoa(&po->L3.src, tmp));
USER_MSG("%s\n", ip_addr_ntoa(&po->L3.dst, tmp));
po->flags |= PO_MODIFIED;
}
}
示例3: func_log
/*
* log the packet to a file
*/
static int func_log(struct filter_op *fop, struct packet_object *po)
{
int fd;
DEBUG_MSG("filter engine: func_log");
/* open the file */
fd = open(fop->op.func.string, O_CREAT | O_APPEND | O_RDWR | O_BINARY, 0600);
if (fd == -1) {
USER_MSG("filter engine: Cannot open file %s\n", fop->op.func.string);
return -EFATAL;
}
/* which data should I have to log ? */
switch(fop->op.func.level) {
case 5:
if (write(fd, po->DATA.data, po->DATA.len) < 0)
USER_MSG("filter engine: Cannot write to file...%d\n", errno);
break;
case 6:
if (write(fd, po->DATA.disp_data, po->DATA.disp_len) < 0)
USER_MSG("filter engine: Cannot write to file...\n");
break;
default:
JIT_FAULT("unsupported log level [%d]", fop->op.func.level);
break;
}
/* close the file */
close(fd);
return ESUCCESS;
}
示例4: stop_unified_sniff
/*
* kill the capturing threads, but leave untouched the others
*/
void stop_unified_sniff(void)
{
pthread_t pid;
DEBUG_MSG("stop_unified_sniff");
if (GBL_SNIFF->active == 0) {
USER_MSG("Unified sniffing is not running...\n");
return;
}
/* kill it */
capture_stop(GBL_IFACE);
if(GBL_OPTIONS->secondary)
secondary_sources_foreach(capture_stop);
pid = ec_thread_getpid("sslwrap");
if (!pthread_equal(pid, EC_PTHREAD_NULL))
ec_thread_destroy(pid);
USER_MSG("Unified sniffing was stopped.\n");
GBL_SNIFF->active = 0;
}
示例5: parse_tcp
/*
* parse the packet for ettercap traces
*/
static void parse_tcp(struct packet_object *po)
{
struct libnet_tcp_hdr *tcp;
char tmp[MAX_ASCII_ADDR_LEN];
char tmp2[MAX_ASCII_ADDR_LEN];
tcp = (struct libnet_tcp_hdr *)po->L4.header;
switch (ntohl(tcp->th_seq)) {
case EC_MAGIC_16:
USER_MSG("ettercap traces (tcp) from %s...\n", ip_addr_ntoa(&po->L3.src, tmp));
break;
case 6969:
USER_MSG("ettercap plugin (shadow) is scanning from %s to %s:%d...\n", ip_addr_ntoa(&po->L3.src, tmp), ip_addr_ntoa(&po->L3.dst, tmp2), ntohs(po->L4.dst));
break;
case 0xabadc0de:
if (ntohl(tcp->th_ack) == 0xabadc0de)
USER_MSG("ettercap plugin (spectre) is flooding the lan.\n");
else
USER_MSG("ettercap plugin (golem) is DOSing from %s to %s...\n", ip_addr_ntoa(&po->L3.src, tmp), ip_addr_ntoa(&po->L3.dst, tmp2));
break;
}
if (ntohs(tcp->th_sport) == EC_MAGIC_16 && (tcp->th_flags & TH_SYN) )
USER_MSG("ettercap NG plugin (gw_discover) is trying to dicover the gateway from %s...\n", ip_addr_ntoa(&po->L3.src, tmp));
}
示例6: start_unified_sniff
/*
* creates the threads for capturing
*/
void start_unified_sniff(void)
{
DEBUG_MSG("start_unified_sniff");
if (GBL_SNIFF->active == 1) {
USER_MSG("Unified sniffing already started...\n");
return;
}
USER_MSG("Starting Unified sniffing...\n\n");
/* create the timeouter thread */
if (!GBL_OPTIONS->read) {
pthread_t pid;
pid = ec_thread_getpid("timer");
if (pthread_equal(pid, EC_PTHREAD_NULL))
ec_thread_new("timer", "conntrack timeouter", &conntrack_timeouter, NULL);
}
/* create the thread for packet capture */
ec_thread_new("capture", "pcap handler and packet decoder", &capture, GBL_OPTIONS->iface);
/* start ssl_wrapper thread */
if (!GBL_OPTIONS->read && !GBL_OPTIONS->unoffensive && !GBL_OPTIONS->only_mitm && GBL_OPTIONS->ssl_mitm)
ec_thread_new("sslwrap", "wrapper for ssl connections", &sslw_start, NULL);
GBL_SNIFF->active = 1;
}
示例7: main
int main(int argc, char *argv[])
{
int ret_value = 0;
libettercap_init(PROGRAM, EC_VERSION);
ef_globals_alloc();
select_text_interface();
libettercap_ui_init();
/* etterfilter copyright */
USER_MSG("\n" EC_COLOR_BOLD "%s %s" EC_COLOR_END " copyright %s %s\n\n",
PROGRAM, EC_VERSION, EC_COPYRIGHT, EC_AUTHORS);
/* initialize the line number */
EF_GBL->lineno = 1;
/* getopt related parsing... */
parse_options(argc, argv);
/* set the input for source file */
if (EF_GBL_OPTIONS->source_file) {
yyin = fopen(EF_GBL_OPTIONS->source_file, "r");
if (yyin == NULL)
FATAL_ERROR("Input file not found !");
} else {
FATAL_ERROR("No source file.");
}
/* no buffering */
setbuf(yyin, NULL);
setbuf(stdout, NULL);
setbuf(stderr, NULL);
/* load the tables in etterfilter.tbl */
load_tables();
/* load the constants in etterfilter.cnt */
load_constants();
/* print the message */
USER_MSG("\n Parsing source file \'%s\' ", EF_GBL_OPTIONS->source_file);
ef_debug(1, "\n");
/* begin the parsing */
if (yyparse() == 0)
USER_MSG(" done.\n\n");
else
USER_MSG("\n\nThe script contains errors...\n\n");
/* write to file */
ret_value = write_output();
if (ret_value == -E_NOTHANDLED)
FATAL_ERROR("Cannot write output file (%s): the filter is not correctly handled.", EF_GBL_OPTIONS->output_file);
else if (ret_value == -E_INVALID)
FATAL_ERROR("Cannot write output file (%s): the filter format is not correct. ", EF_GBL_OPTIONS->output_file);
ef_exit(0);
}
示例8: parse_ip
/*
* parse the packet for ettercap traces
*/
static void parse_ip(struct packet_object *po)
{
struct libnet_ipv4_hdr *ip;
char tmp[MAX_ASCII_ADDR_LEN];
char tmp2[MAX_ASCII_ADDR_LEN];
ip = (struct libnet_ipv4_hdr *)po->L3.header;
if (ntohs(ip->ip_id) == EC_MAGIC_16)
USER_MSG("ettercap traces (ip) from %s...\n", ip_addr_ntoa(&po->L3.src, tmp));
if (ntohs(ip->ip_id) == 0xbadc)
USER_MSG("ettercap plugin (banshee) is killing from %s to %s...\n", ip_addr_ntoa(&po->L3.src, tmp), ip_addr_ntoa(&po->L3.dst, tmp2));
}
示例9: parse_arp
/* Parse the arp request */
static void parse_arp(struct packet_object *po)
{
char tmp1[MAX_ASCII_ADDR_LEN];
char tmp2[MAX_ASCII_ADDR_LEN];
USER_MSG("find_conn: Probable connection attempt %s -> %s\n", ip_addr_ntoa(&po->L3.src, tmp1), ip_addr_ntoa(&po->L3.dst, tmp2));
}
示例10: find_conn_fini
static int find_conn_fini(void *dummy)
{
USER_MSG("find_conn: plugin terminated...\n");
hook_del(HOOK_PACKET_ARP_RQ, &parse_arp);
return PLUGIN_FINISHED;
}
示例11: find_conn_init
static int find_conn_init(void *dummy)
{
USER_MSG("find_conn: plugin running...\n");
hook_add(HOOK_PACKET_ARP_RQ, &parse_arp);
return PLUGIN_RUNNING;
}
示例12: finger_submit_init
static int finger_submit_init(void *dummy)
{
char finger[FINGER_LEN + 1];
char os[OS_LEN + 1];
/* don't display messages while operating */
GBL_OPTIONS->quiet = 1;
memset(finger, 0, sizeof(finger));
memset(os, 0, sizeof(finger));
/* get the user input */
ui_input("Fingerprint ('quit' to exit) : ", finger, sizeof(finger), NULL);
/* exit on user request */
if (!strcasecmp(finger, "quit") || !strcmp(finger, ""))
return PLUGIN_FINISHED;
ui_input("Operating System ('quit' to exit) : ", os, sizeof(os), NULL);
/* exit on user request */
if (!strcasecmp(os, "quit") || !strcmp(os, ""))
return PLUGIN_FINISHED;
USER_MSG("\n");
/* send the fingerprint */
fingerprint_submit(finger, os);
/* flush all the messages */
ui_msg_flush(MSG_ALL);
return PLUGIN_FINISHED;
}
示例13: icmp_redirect_start
/*
* init the ICMP REDIRECT attack
*/
static int icmp_redirect_start(char *args)
{
struct ip_list *i;
char tmp[MAX_ASCII_ADDR_LEN];
DEBUG_MSG("icmp_redirect_start");
/* check the parameter */
if (!strcmp(args, "")) {
SEMIFATAL_ERROR("ICMP redirect needs a parameter.\n");
} else {
char tmp[strlen(args)+2];
/* add the / to be able to use the target parsing function */
sprintf(tmp, "%s/", args);
if (compile_target(tmp, &redirected_gw) != ESUCCESS)
SEMIFATAL_ERROR("Wrong target parameter");
}
/* we need both mac and ip addresses */
if (redirected_gw.all_mac || redirected_gw.all_ip)
SEMIFATAL_ERROR("You must specify both MAC and IP addresses for the GW");
i = LIST_FIRST(&redirected_gw.ips);
USER_MSG("ICMP redirect: victim GW %s\n", ip_addr_ntoa(&i->ip, tmp));
/* add the hook to receive all the tcp and udp packets */
hook_add(HOOK_PACKET_TCP, &icmp_redirect);
hook_add(HOOK_PACKET_UDP, &icmp_redirect);
return ESUCCESS;
}
示例14: set_utf8_encoding
/*
* set the encoding to use when converting to UTF-8
*/
int set_utf8_encoding(u_char *fromcode)
{
#ifndef HAVE_UTF8
USER_MSG("UTF-8 support not compiled in.");
return ESUCCESS;
#else
iconv_t cd;
DEBUG_MSG("set_utf8_encoding: %s", fromcode);
if (fromcode == NULL || strlen(fromcode) < 1)
return -EINVALID;
SAFE_FREE(utf8_encoding);
/* make sure encoding type is supported */
cd = iconv_open("UTF-8", fromcode);
if (cd == (iconv_t)(-1))
SEMIFATAL_ERROR("The conversion from %s to UTF-8 is not supported.", fromcode);
iconv_close(cd);
utf8_encoding = strdup(fromcode);
return ESUCCESS;
#endif
}
示例15: smb_clear_fini
static int smb_clear_fini(void *dummy)
{
USER_MSG("smb_clear: plugin terminated...\n");
hook_del(HOOK_PROTO_SMB, &parse_smb);
return PLUGIN_FINISHED;
}