#include "ekg2-config.h"#include <stdio.h>#include <string.h>#include <pcap.h>#include <errno.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <ekg/debug.h>#include <ekg/plugins.h>#include <ekg/commands.h>#include <ekg/vars.h>#include <ekg/userlist.h>#include <ekg/stuff.h>#include <ekg/recode.h>#include <ekg/themes.h>#include <ekg/queries.h>#include <ekg/xmalloc.h>#include <ekg/protocol.h>#include "sniff_ip.h"#include "sniff_gg.h"#include "sniff_dns.h"#include "sniff_rivchat.h"#include "sniff_dns.inc"#include "sniff_gg.inc"#include "sniff_rivchat.inc"Struktury danych | |
| struct | connection_t |
Definicje | |
| #define | _GNU_SOURCE |
| #define | SNAPLEN 2000 |
| #define | PROMISC 0 |
| #define | GET_DEV(s) ((pcap_t *) ((session_t *) s)->priv) |
| #define | MAX_BYTES_PER_LINE 16 |
| #define | SNIFF_HANDLER(x, type) static int x(session_t *s, const connection_t *hdr, const type *pkt, int len) |
| #define | CHECK_LEN(x) |
| #define | CHECK_LEN(x) |
| #define | RIVCHAT_PACKET_LEN 328 |
| #define | WATCHER_PCAP(x, y) |
| #define | DEFAULT_FILTER "(tcp and (net 217.17.41.80/28 or net 217.17.45.128/27 or net 85.232.236.0/24 or net 91.197.12.0/22)) or (udp and (port 16127 or port 53))" |
Definicje typów | |
| typedef int(* | sniff_handler_t )(session_t *, const connection_t *, const unsigned char *, int) |
Wyliczenia | |
| enum | pkt_way_t { SNIFF_OUTGOING = 0, SNIFF_INCOMING } |
Funkcje | |
| static int | sniff_theme_init () |
| PLUGIN_DEFINE (sniff, PLUGIN_PROTOCOL, sniff_theme_init) | |
| static char * | build_code (const unsigned char *code) |
| static char * | build_sha1 (const unsigned char *digest) |
| static char * | build_hex (uint32_t hex) |
| static char * | build_hex2 (uint32_t hex) |
| static char * | _inet_ntoa (struct in_addr ip) |
| static char * | _inet_ntoa6 (struct in6_addr ip) |
| static char * | build_windowip_name (struct in_addr ip) |
| static connection_t * | sniff_udp_get (const struct iphdr *ip, const struct udphdr *udp) |
| static connection_t * | sniff_tcp_find_connection (const struct iphdr *ip, const struct tcphdr *tcp) |
| static void | tcp_print_payload (u_char *payload, size_t len) |
| static char * | tcp_print_flags (u_char tcpflag) |
| static void | sniff_loop_tcp (session_t *s, int len, const u_char *packet, const struct iphdr *ip, int size_ip) |
| static void | sniff_loop_udp (session_t *s, int len, const u_char *packet, const struct iphdr *ip) |
| static void | sniff_loop_ip (session_t *s, int len, const u_char *packet) |
| static void | sniff_loop_ether (u_char *data, const struct pcap_pkthdr *header, const u_char *packet) |
| void | sniff_loop_sll (u_char *data, const struct pcap_pkthdr *header, const u_char *packet) |
| WATCHER_PCAP (sniff_pcap_read_EN10MB, sniff_loop_ether) | |
| WATCHER_PCAP (sniff_pcap_read_SLL, sniff_loop_sll) | |
| WATCHER_PCAP (sniff_pcap_read, sniff_loop_ether) | |
| static int | sniff_command_connect (const char *name, const char **params, session_t *session, const char *target, int quiet) |
| static int | sniff_command_disconnect (const char *name, const char **params, session_t *session, const char *target, int quiet) |
| static int | sniff_command_connections (const char *name, const char **params, session_t *session, const char *target, int quiet) |
| static int | sniff_session_deinit (void *data, va_list ap) |
| static int | sniff_validate_uid (void *data, va_list ap) |
| static int | sniff_status_show (void *data, va_list ap) |
| static int | sniff_print_version (void *data, va_list ap) |
| EXPORT int | sniff_plugin_init (int prio) |
| static int | sniff_plugin_destroy () |
Zmienne | |
| static list_t | tcp_connections |
| static plugins_params_t | sniff_plugin_vars [] |
| #define _GNU_SOURCE |
| #define CHECK_LEN | ( | x | ) |
if (len < x) {\ debug_error("%s() * READ less than: %d (len: %d) (%s)\n", __FUNCTION__, x, len, #x); \ return; \ }
| #define CHECK_LEN | ( | x | ) |
if (len < x) {\ debug_error("%s() * READ less than: %d (len: %d) (%s)\n", __FUNCTION__, x, len, #x);\ return -1;\ }
| #define DEFAULT_FILTER "(tcp and (net 217.17.41.80/28 or net 217.17.45.128/27 or net 85.232.236.0/24 or net 91.197.12.0/22)) or (udp and (port 16127 or port 53))" |
| #define GET_DEV | ( | s | ) | ((pcap_t *) ((session_t *) s)->priv) |
| #define MAX_BYTES_PER_LINE 16 |
| #define PROMISC 0 |
| #define RIVCHAT_PACKET_LEN 328 |
| #define SNAPLEN 2000 |
| #define SNIFF_HANDLER | ( | x, | ||
| type | ||||
| ) | static int x(session_t *s, const connection_t *hdr, const type *pkt, int len) |
| #define WATCHER_PCAP | ( | x, | ||
| y | ||||
| ) |
static WATCHER_SESSION(x) { \ if (type) return 0; \ if (!s) { \ debug_error("sniff_pcap_read() no session!\n"); \ return -1; \ } \ pcap_dispatch(GET_DEV(s), 1, y, (void *) s); \ return 0; \ }
| typedef int(* sniff_handler_t)(session_t *, const connection_t *, const unsigned char *, int) |
| enum pkt_way_t |
| static char* _inet_ntoa | ( | struct in_addr | ip | ) | [static] |
| static char* _inet_ntoa6 | ( | struct in6_addr | ip | ) | [static] |
| static char* build_code | ( | const unsigned char * | code | ) | [static] |
| static char* build_hex | ( | uint32_t | hex | ) | [static] |
| static char* build_hex2 | ( | uint32_t | hex | ) | [static] |
| static char* build_sha1 | ( | const unsigned char * | digest | ) | [static] |
| static char* build_windowip_name | ( | struct in_addr | ip | ) | [static] |
| PLUGIN_DEFINE | ( | sniff | , | |
| PLUGIN_PROTOCOL | , | |||
| sniff_theme_init | ||||
| ) |
| static int sniff_command_connect | ( | const char * | name, | |
| const char ** | params, | |||
| session_t * | session, | |||
| const char * | target, | |||
| int | quiet | |||
| ) | [static] |
| static int sniff_command_connections | ( | const char * | name, | |
| const char ** | params, | |||
| session_t * | session, | |||
| const char * | target, | |||
| int | quiet | |||
| ) | [static] |
| static int sniff_command_disconnect | ( | const char * | name, | |
| const char ** | params, | |||
| session_t * | session, | |||
| const char * | target, | |||
| int | quiet | |||
| ) | [static] |
| static void sniff_loop_ether | ( | u_char * | data, | |
| const struct pcap_pkthdr * | header, | |||
| const u_char * | packet | |||
| ) | [inline, static] |
| static void sniff_loop_ip | ( | session_t * | s, | |
| int | len, | |||
| const u_char * | packet | |||
| ) | [inline, static] |
| void sniff_loop_sll | ( | u_char * | data, | |
| const struct pcap_pkthdr * | header, | |||
| const u_char * | packet | |||
| ) |
| static void sniff_loop_tcp | ( | session_t * | s, | |
| int | len, | |||
| const u_char * | packet, | |||
| const struct iphdr * | ip, | |||
| int | size_ip | |||
| ) | [inline, static] |
| static void sniff_loop_udp | ( | session_t * | s, | |
| int | len, | |||
| const u_char * | packet, | |||
| const struct iphdr * | ip | |||
| ) | [inline, static] |
| static int sniff_plugin_destroy | ( | ) | [static] |
| EXPORT int sniff_plugin_init | ( | int | prio | ) |
| static int sniff_print_version | ( | void * | data, | |
| va_list | ap | |||
| ) | [static] |
| static int sniff_session_deinit | ( | void * | data, | |
| va_list | ap | |||
| ) | [static] |
| static int sniff_status_show | ( | void * | data, | |
| va_list | ap | |||
| ) | [static] |
| static connection_t* sniff_tcp_find_connection | ( | const struct iphdr * | ip, | |
| const struct tcphdr * | tcp | |||
| ) | [static] |
| static int sniff_theme_init | ( | ) | [static] |
| static connection_t* sniff_udp_get | ( | const struct iphdr * | ip, | |
| const struct udphdr * | udp | |||
| ) | [static] |
| static int sniff_validate_uid | ( | void * | data, | |
| va_list | ap | |||
| ) | [static] |
| static char* tcp_print_flags | ( | u_char | tcpflag | ) | [static] |
| static void tcp_print_payload | ( | u_char * | payload, | |
| size_t | len | |||
| ) | [static] |
| WATCHER_PCAP | ( | sniff_pcap_read_SLL | , | |
| sniff_loop_sll | ||||
| ) |
| WATCHER_PCAP | ( | sniff_pcap_read_EN10MB | , | |
| sniff_loop_ether | ||||
| ) |
| WATCHER_PCAP | ( | sniff_pcap_read | , | |
| sniff_loop_ether | ||||
| ) |
plugins_params_t sniff_plugin_vars[] [static] |
{
PLUGIN_VAR_ADD("alias", VAR_STR, 0, 0, NULL),
PLUGIN_VAR_ADD("auto_connect", VAR_BOOL, "0", 0, NULL),
PLUGIN_VAR_ADD("filter", VAR_STR, DEFAULT_FILTER, 0, NULL),
}
list_t tcp_connections [static] |
1.7.1