struct / querub

QueRub embeds a ruby interpreter into a libnetfilter_queue C program for inline fuzzing and reversing of network protocols

This URL has Read+Write access

querub / querub.h
100644 49 lines (40 sloc) 0.989 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#define __USE_BSD
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#define __FAVOR_BSD
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <arpa/inet.h>
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <linux/netfilter.h>
#include <libnetfilter_queue/libnetfilter_queue.h>
#include <ruby.h>
 
#define ERR -1
#define OK 0
#define PKTSIZE 65535
#define TCP_P 0x6
#define UDP_P 0x11
 
VALUE pkt_array;
 
int callback(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg, struct nfq_data *nfa, void *data);
char *get_ruby_error(int err);
int error(char *str);
void sig_handler(int signum);
 
void IpChecksum(struct ip *ip);
void TcpChecksum(struct ip *ip);
void UdpChecksum(struct ip *ip);
int SumWords(u_int16_t *buf, int nwords);
 
struct nfq_handle *nfqh;
struct nfq_q_handle *qh;
struct nfnl_handle *nh;
 
char *my_script;
char *my_method;
 
struct pkt_t
{
    char pkt[PKTSIZE];
    long int pkt_count;
} pkt;