summaryrefslogtreecommitdiff
path: root/other/b-scan/tmp/include
diff options
context:
space:
mode:
authorRoot THC2026-02-24 12:42:47 +0000
committerRoot THC2026-02-24 12:42:47 +0000
commitc9cbeced5b3f2bdd7407e29c0811e65954132540 (patch)
treeaefc355416b561111819de159ccbd86c3004cf88 /other/b-scan/tmp/include
parent073fe4bf9fca6bf40cef2886d75df832ef4b6fca (diff)
initial
Diffstat (limited to 'other/b-scan/tmp/include')
-rw-r--r--other/b-scan/tmp/include/bscan/arpg.h13
-rw-r--r--other/b-scan/tmp/include/bscan/bscan.h94
-rw-r--r--other/b-scan/tmp/include/bscan/cf_prse.h11
-rw-r--r--other/b-scan/tmp/include/bscan/dcd_icmp.h13
-rw-r--r--other/b-scan/tmp/include/bscan/garage.h178
-rw-r--r--other/b-scan/tmp/include/bscan/module.h26
-rw-r--r--other/b-scan/tmp/include/bscan/network_raw.h57
-rw-r--r--other/b-scan/tmp/include/bscan/restore.h6
-rw-r--r--other/b-scan/tmp/include/bscan/signal.h10
-rw-r--r--other/b-scan/tmp/include/bscan/snarf.h31
-rw-r--r--other/b-scan/tmp/include/bscan/system.h38
-rw-r--r--other/b-scan/tmp/include/bscan/tty.h7
-rw-r--r--other/b-scan/tmp/include/bscan/version.h5
13 files changed, 489 insertions, 0 deletions
diff --git a/other/b-scan/tmp/include/bscan/arpg.h b/other/b-scan/tmp/include/bscan/arpg.h
new file mode 100644
index 0000000..19ebddc
--- /dev/null
+++ b/other/b-scan/tmp/include/bscan/arpg.h
@@ -0,0 +1,13 @@
1#include <libnet.h>
2
3struct _libnet
4{
5 int packet_size;
6 u_char *packet;
7 char err_buf[LIBNET_ERRBUF_SIZE];
8 u_char *device;
9 struct libnet_link_int *network;
10};
11
12void prepare_libnet (struct _libnet *lnet);
13int play_arpg (struct _libnet *, u_char *, u_char *, u_char *, u_char *);
diff --git a/other/b-scan/tmp/include/bscan/bscan.h b/other/b-scan/tmp/include/bscan/bscan.h
new file mode 100644
index 0000000..c1ad9bb
--- /dev/null
+++ b/other/b-scan/tmp/include/bscan/bscan.h
@@ -0,0 +1,94 @@
1/*
2 * bscan, lame (and hopefully fast) banner scanner [port 21,25,110,...]
3 *
4 * "<es> skyper its a cool idea"
5 * "<es> i'd like to see the k0ad when ur finished"
6 * HI ES :)
7 * greetings to all my !el8 brothers :))
8 */
9
10#include <stdio.h>
11#include <stdarg.h>
12#include <sys/socket.h>
13#include <sys/wait.h>
14#include <pthread.h>
15#ifndef __FAVOR_BSD
16#define __FAVOR_BSD
17#endif
18#ifndef __USE_BSD
19#define __USE_BSD
20#endif
21#ifndef __BSD_SOURCE
22#define __BSD_SOURCE
23#endif
24#include "arpg.h"
25#include "network_raw.h"
26
27
28#define SPF_SMAC "\x00\x20\xAF\xA3\x13\x37"
29
30#define OPT_VERB 0x1
31#define OPT_RESERV1 0x2
32#define OPT_SETARP 0x4
33#define OPT_SPREADSCAN 0x8
34#define OPT_OUTONLY 0x10
35
36#define OPT_ABRT 0x20
37#define OPT_REST 0x40
38#define OPT_HOSTFILE 0x80
39#define OPT_W8SEMA 0x100
40
41
42struct _opt
43{
44 int (*getnextip) ();
45 int sox;
46 u_char *packet;
47 int pkg_maxlen;
48 int pkg_len; /* actual length of contructed packet */
49 char *hostfile;
50 char **argvlist;
51 FILE *ffd; /* e.g. input file */
52 char *target;
53 unsigned long netmask; /* depricated */
54 unsigned long network; /* depricated */
55 unsigned int limit;
56 unsigned short flags;
57 unsigned long random_maxcount;
58 u_int delay; /* w8 for outstanding packets */
59 u_int pscanstat; /* scan stats every x pkts, default NEVER */
60 u_long start_ip; /* in HBO */
61 u_long end_ip; /* in HBO */
62 u_long ipscan_count; /* scanned ip's of a SPECIFIC range [temp!] */
63 u_long iptotscan_count; /* total scan_count over all ranges */
64 /* used for flood protection */
65 u_long bsent_count; /* byte-sent counter. TMP (!) variable */
66 u_long ip_offset; /* spread scan offset */
67 u_long ip_blklen; /* block-length for spread-scan */
68 u_long ip_pos; /* position for SPREAD scan, non-linear */
69 struct timeval scan_start; /* scan start for ALL ranges */
70 /* the real beginning */
71 struct timeval tv2; /* flood protection timer 2 + restore */
72 /* must be the last gettimeofday() from scan */
73 float sec; /* flood protection distance time */
74 struct _libnet lnet;
75 u_char spf_smac[6]; /* spoofed ethernet sender mac */
76 pthread_t bscantid; /* 'parent' thread id */
77 pthread_t snarftid; /* snarf thread id */
78 struct _snarf
79 {
80 u_long icmp_c;
81 u_long close_c;
82 u_long open_c;
83 u_long refused_c;
84 }
85 snarf;
86 struct net_tuple nt;
87};
88
89
90void make_iprange (u_long *, u_long *, u_long *, u_long *, char *);
91void init_spreadscan (u_long diff);
92void sigdriver (int);
93void print_scanstat (FILE *);
94void die (int);
diff --git a/other/b-scan/tmp/include/bscan/cf_prse.h b/other/b-scan/tmp/include/bscan/cf_prse.h
new file mode 100644
index 0000000..6185ab3
--- /dev/null
+++ b/other/b-scan/tmp/include/bscan/cf_prse.h
@@ -0,0 +1,11 @@
1struct confFileOpt
2{
3 unsigned short flags;
4 unsigned int limit;
5 char *device;
6 unsigned long int delay;
7 unsigned long srcAddr;
8 unsigned short mac[5];
9} FileOpt;
10
11int readConfFile (char *);
diff --git a/other/b-scan/tmp/include/bscan/dcd_icmp.h b/other/b-scan/tmp/include/bscan/dcd_icmp.h
new file mode 100644
index 0000000..215d0c8
--- /dev/null
+++ b/other/b-scan/tmp/include/bscan/dcd_icmp.h
@@ -0,0 +1,13 @@
1/* bscan - icmp include file
2 */
3
4#ifndef BS_DCD_ICMP_H
5#define BS_DCD_ICMP_H
6
7#define ICMP_HDRSIZE 8
8
9const char *
10icmp_str (int type, int code);
11
12#endif
13
diff --git a/other/b-scan/tmp/include/bscan/garage.h b/other/b-scan/tmp/include/bscan/garage.h
new file mode 100644
index 0000000..0d63774
--- /dev/null
+++ b/other/b-scan/tmp/include/bscan/garage.h
@@ -0,0 +1,178 @@
1/* bscan - mod_garage.h - per IP storage functions include file
2 *
3 * by scut / teso
4 */
5
6#ifndef _MOD_GARAGE_H
7#define _MOD_GARAGE_H
8
9#include <sys/types.h>
10
11#define GARAGE_VERSION "1.0.1"
12
13
14typedef struct ip_elem {
15 struct ip_elem * next; /* more then one data stored */
16
17 int data_free; /* 1 = do free() on destroy */
18 size_t data_len;
19 void * data; /* must be free() able */
20} ip_elem;
21
22
23typedef struct ip_list {
24 struct ip_list * next; /* another IP, always greater then this ! */
25 unsigned long int ip;
26
27 ip_elem * data;
28} ip_list;
29
30
31/* not for use in other code then garage.c
32 */
33typedef struct {
34 char * name;
35 ip_list ** garage;
36
37 void (* cleaner)(ip_list *);
38
39 unsigned long int ip_count;
40
41 unsigned long int timeout_max;
42 unsigned long int timeout_idx;
43 unsigned long int * timeout_tbl;
44} garage_hdlr;
45
46
47/* mg_init
48 *
49 * setup the required structures for the garage
50 *
51 * return 0 on success
52 * return 1 on failure
53 */
54
55garage_hdlr *
56mg_init (char *name, unsigned long int max_hosts_in_list,
57 void (* cleaner)(ip_list *));
58
59
60/* mg_destroy
61 *
62 * destroy all data in the garage `g', use the standard handler in case
63 * `do_handler' is not zero, otherwise just free.
64 */
65
66void
67mg_destroy (garage_hdlr *g, int do_handler);
68
69
70/* mg_write
71 *
72 * store pointer `data' with len `data_len' to the garage for IP `ip'
73 * if `data_free' is non-zero the `data' pointer will be freed if mg_clean
74 * or mg_destroy is called.
75 */
76
77void
78mg_write (garage_hdlr *g, unsigned long int ip, void *data, size_t data_len,
79 int data_free);
80
81
82/* mg_read
83 *
84 * return first ip_elem for ip `ip' on success (it is not removed from garage)
85 * return NULL on failure
86 */
87
88ip_elem *
89mg_read (garage_hdlr *g, unsigned long int ip);
90
91
92/* mg_clean
93 *
94 * clean everything stored in the garage for IP `ip'
95 */
96
97void
98mg_clean (garage_hdlr *g, unsigned long int ip, void (*cleaner)(ip_list *));
99
100
101/* mg_show
102 *
103 * DEBUG function, to show IP distribution in garage
104 */
105
106void
107mg_show (garage_hdlr *g);
108
109
110/* mg_count
111 *
112 * count elements in garage
113 */
114
115unsigned long int
116mg_count (garage_hdlr *g);
117
118
119/* mg_ip_isin
120 *
121 * check whether the ip `ip' is stored in the garage pointed to by `g'.
122 *
123 * return zero in case it is not
124 * return != zero if it is
125 */
126
127int
128mg_ip_isin (garage_hdlr *g, unsigned long int ip);
129
130
131/* CIDR routines
132 */
133
134/* mg_cidr_getmask
135 *
136 * convert a netmask (eg 0xfffffc00) or a cidr notation (eg 24) given in
137 * `mask' to a netmask.
138 */
139
140unsigned long int
141mg_cidr_getmask (unsigned long int mask);
142
143
144/* mg_cidr_maskcount
145 *
146 * return the number of hosts that are possible using a mask `mask' in
147 * either CIDR or netmask notation
148 */
149
150unsigned long int
151mg_cidr_maskcount (unsigned long int mask);
152
153
154/* mg_cidr_match
155 *
156 * check whether `ip1' and `ip2' are in the same network, given the network
157 * size by `mask' (CIDR or netmask notation)
158 */
159
160int
161mg_cidr_match (unsigned long int ip1, unsigned long int ip2,
162 unsigned long int mask);
163
164
165/* mg_cidr_count
166 *
167 * count elements in garage `g', that are within the CIDR range build from
168 * ip `ip' and netmask `mask'. `mask' is either the number of bits, if it's in
169 * the range of 0-32, or the real mask, if it is greater then 32. (for the
170 * zero case the netmask is equal to the cidr notation).
171 */
172
173unsigned long int
174mg_cidr_count (garage_hdlr *g, unsigned long int ip, unsigned long int mask);
175
176
177#endif
178
diff --git a/other/b-scan/tmp/include/bscan/module.h b/other/b-scan/tmp/include/bscan/module.h
new file mode 100644
index 0000000..3ad316b
--- /dev/null
+++ b/other/b-scan/tmp/include/bscan/module.h
@@ -0,0 +1,26 @@
1
2#define MAX_MODULES 8
3
4#define MOD_FIRSTPKG 0x00
5#define MOD_RCV 0x01
6
7#define RMOD_OK 0x00
8#define RMOD_SKIP 0x01
9#define RMOD_ERROR 0x02
10#define RMOD_ABRT 0x04
11
12struct _mods
13{
14 int (*init) (char **, int, char **, void *); /* init the module stuff */
15 int (*fini) (); /* finish the module */
16 void (*musage) (); /* print out usage informations */
17 int (*callmdl) (int, void *); /* call a function */
18 const char *modname; /* name of the module after init */
19 int modid; /* id of the module. who needs this ? */
20 char *modarg; /* arg to module */
21};
22
23int add_module (char *, char *);
24void split_margs (const char *, char ***, int *);
25int loadinit_mod (char *);
26
diff --git a/other/b-scan/tmp/include/bscan/network_raw.h b/other/b-scan/tmp/include/bscan/network_raw.h
new file mode 100644
index 0000000..9ffed74
--- /dev/null
+++ b/other/b-scan/tmp/include/bscan/network_raw.h
@@ -0,0 +1,57 @@
1
2/*
3 * network_raw.h, depends on libnet.h
4 */
5
6
7#define ETH_SIZE 14
8#define IP_SIZE 20
9#define TCP_SIZE 20
10#define ICMP_SIZE 8
11#define UDP_SIZE 8
12
13/*
14 * Checksum stuff
15 */
16#define CKSUM_CARRY(x) \
17 (x = (x >> 16) + (x & 0xffff), (~(x + (x >> 16)) & 0xffff))
18#define int_ntoa(x) inet_ntoa(*((struct in_addr *)&(x)))
19
20
21/*
22 * leet net tuple
23 */
24struct net_tuple
25{
26 uint32_t src;
27 unsigned short int sport;
28 uint32_t dst;
29 unsigned short int dport;
30};
31
32
33/*
34 * pseudo TCP header for calculating the chksum
35 */
36struct _fakehead
37{
38 uint32_t saddr;
39 uint32_t daddr;
40 uint8_t zero;
41 uint8_t protocol;
42 uint16_t tot_len;
43};
44
45int init_network_raw (void);
46int in_cksum (unsigned short *, int);
47int send_ipv4 (int, u_char *, size_t);
48void add_udphdr (unsigned char *, struct net_tuple *, int);
49void add_tcphdr (unsigned char *, struct net_tuple *, uint8_t, int,
50 tcp_seq *, tcp_seq *);
51void add_icmpping (unsigned char *, int, int);
52void add_iphdr (unsigned char *, uint8_t ip_p, struct net_tuple *, int);
53int answer_tcp (int, struct ip *, struct tcphdr *, uint8_t, u_char *, uint);
54int vrfy_ip (struct ip *, uint32_t, u_short *);
55int vrfy_tcp (struct tcphdr *, uint32_t, u_short *);
56int decode_nvt(u_char *, uint, u_char *, uint *, u_char *, uint *);
57
diff --git a/other/b-scan/tmp/include/bscan/restore.h b/other/b-scan/tmp/include/bscan/restore.h
new file mode 100644
index 0000000..960efe6
--- /dev/null
+++ b/other/b-scan/tmp/include/bscan/restore.h
@@ -0,0 +1,6 @@
1/*
2 * restore.h
3 */
4
5int write_restore (void);
6int read_restore (char *);
diff --git a/other/b-scan/tmp/include/bscan/signal.h b/other/b-scan/tmp/include/bscan/signal.h
new file mode 100644
index 0000000..fab56f6
--- /dev/null
+++ b/other/b-scan/tmp/include/bscan/signal.h
@@ -0,0 +1,10 @@
1/*
2 * this space for rent....
3 */
4
5typedef void (*sighandler_t) (int);
6
7#define SIG_SETALL 0x01
8
9
10int sigctl (int, sighandler_t);
diff --git a/other/b-scan/tmp/include/bscan/snarf.h b/other/b-scan/tmp/include/bscan/snarf.h
new file mode 100644
index 0000000..fee7047
--- /dev/null
+++ b/other/b-scan/tmp/include/bscan/snarf.h
@@ -0,0 +1,31 @@
1
2#define int_ntoa(x) inet_ntoa(*((struct in_addr *)&(x)))
3
4#define ETH_ALEN 6
5#define PCAP_FILTER "arp or tcp or icmp or udp"
6
7struct Ether_header
8{
9 uint8_t ether_dhost[ETH_ALEN];
10 uint8_t ether_shost[ETH_ALEN];
11 uint16_t ether_type;
12};
13
14struct Arphdr
15{
16 unsigned short int ar_hrd; /* Format of hardware address. */
17 unsigned short int ar_pro; /* Format of protocol address. */
18 unsigned char ar_hln; /* Length of hardware address. */
19 unsigned char ar_pln; /* Length of protocol address. */
20 unsigned short int ar_op; /* ARP opcode (command). */
21 /* Ethernet looks like this : This bit is variable sized
22 however... */
23 unsigned char ar_sha[ETH_ALEN]; /* Sender hardware address. */
24 unsigned char ar_sip[4]; /* Sender IP address. */
25 unsigned char ar_tha[ETH_ALEN]; /* Target hardware address. */
26 unsigned char ar_tip[4]; /* Target IP address. */
27};
28
29
30void *do_snarf (void *);
31void undo_snarf ();
diff --git a/other/b-scan/tmp/include/bscan/system.h b/other/b-scan/tmp/include/bscan/system.h
new file mode 100644
index 0000000..6eed6d8
--- /dev/null
+++ b/other/b-scan/tmp/include/bscan/system.h
@@ -0,0 +1,38 @@
1/*
2 * generic system functions
3 */
4
5#include <sys/time.h>
6#include <unistd.h>
7#include <errno.h>
8#include <stdio.h>
9#include <string.h>
10
11#define DEV_ZERO "/dev/zero"
12
13/*
14 * we use the 'do while' trick to use err_abort as if they were functions
15 */
16#define err_abort(code,text) do { \
17 fprintf (stderr, "%s at \"%s\":%d: %s\n", \
18 text, __FILE__, __LINE__, strerror (code)); \
19 abort(); \
20 } while (0)
21
22#define errno_abort(text) do { \
23 fprintf(stderr, "%s at \"%s\":%d: %s\n", \
24 text, __FILE__, __LINE__, strerror (errno)); \
25 abort(); \
26 } while (0)
27
28
29void *shmalloc (int, size_t);
30void do_nanosleep (time_t, long);
31void xchange (void *, void *, int);
32void time_diff (struct timeval *, struct timeval *);
33int ctoreal(char *, char *);
34void save_write(FILE *, char *, unsigned char *, int);
35int isprintdata(char *, int);
36int dat2hexstr(unsigned char *, unsigned int, unsigned char *, unsigned int);
37int dat2strip(unsigned char *, unsigned int, unsigned char *, unsigned int);
38
diff --git a/other/b-scan/tmp/include/bscan/tty.h b/other/b-scan/tmp/include/bscan/tty.h
new file mode 100644
index 0000000..09d73c0
--- /dev/null
+++ b/other/b-scan/tmp/include/bscan/tty.h
@@ -0,0 +1,7 @@
1/*
2 * tty support functions
3 */
4
5void tty_done ();
6void tty_init ();
7int tty_getchar ();
diff --git a/other/b-scan/tmp/include/bscan/version.h b/other/b-scan/tmp/include/bscan/version.h
new file mode 100644
index 0000000..39b1298
--- /dev/null
+++ b/other/b-scan/tmp/include/bscan/version.h
@@ -0,0 +1,5 @@
1#define VER_MAJOR 0
2#define VER_MINOR 7
3#define VER_SUFFIX d
4#define VER_EMAIL "anonymous@segfault.net"
5#define VERSION "bscan v0.7-dev, anonymous@segfault.net"