From c9cbeced5b3f2bdd7407e29c0811e65954132540 Mon Sep 17 00:00:00 2001 From: Root THC Date: Tue, 24 Feb 2026 12:42:47 +0000 Subject: initial --- other/b-scan/tmp/include/bscan/arpg.h | 13 ++ other/b-scan/tmp/include/bscan/bscan.h | 94 ++++++++++++++ other/b-scan/tmp/include/bscan/cf_prse.h | 11 ++ other/b-scan/tmp/include/bscan/dcd_icmp.h | 13 ++ other/b-scan/tmp/include/bscan/garage.h | 178 +++++++++++++++++++++++++++ other/b-scan/tmp/include/bscan/module.h | 26 ++++ other/b-scan/tmp/include/bscan/network_raw.h | 57 +++++++++ other/b-scan/tmp/include/bscan/restore.h | 6 + other/b-scan/tmp/include/bscan/signal.h | 10 ++ other/b-scan/tmp/include/bscan/snarf.h | 31 +++++ other/b-scan/tmp/include/bscan/system.h | 38 ++++++ other/b-scan/tmp/include/bscan/tty.h | 7 ++ other/b-scan/tmp/include/bscan/version.h | 5 + 13 files changed, 489 insertions(+) create mode 100644 other/b-scan/tmp/include/bscan/arpg.h create mode 100644 other/b-scan/tmp/include/bscan/bscan.h create mode 100644 other/b-scan/tmp/include/bscan/cf_prse.h create mode 100644 other/b-scan/tmp/include/bscan/dcd_icmp.h create mode 100644 other/b-scan/tmp/include/bscan/garage.h create mode 100644 other/b-scan/tmp/include/bscan/module.h create mode 100644 other/b-scan/tmp/include/bscan/network_raw.h create mode 100644 other/b-scan/tmp/include/bscan/restore.h create mode 100644 other/b-scan/tmp/include/bscan/signal.h create mode 100644 other/b-scan/tmp/include/bscan/snarf.h create mode 100644 other/b-scan/tmp/include/bscan/system.h create mode 100644 other/b-scan/tmp/include/bscan/tty.h create mode 100644 other/b-scan/tmp/include/bscan/version.h (limited to 'other/b-scan/tmp/include') 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 @@ +#include + +struct _libnet +{ + int packet_size; + u_char *packet; + char err_buf[LIBNET_ERRBUF_SIZE]; + u_char *device; + struct libnet_link_int *network; +}; + +void prepare_libnet (struct _libnet *lnet); +int 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 @@ +/* + * bscan, lame (and hopefully fast) banner scanner [port 21,25,110,...] + * + * " skyper its a cool idea" + * " i'd like to see the k0ad when ur finished" + * HI ES :) + * greetings to all my !el8 brothers :)) + */ + +#include +#include +#include +#include +#include +#ifndef __FAVOR_BSD +#define __FAVOR_BSD +#endif +#ifndef __USE_BSD +#define __USE_BSD +#endif +#ifndef __BSD_SOURCE +#define __BSD_SOURCE +#endif +#include "arpg.h" +#include "network_raw.h" + + +#define SPF_SMAC "\x00\x20\xAF\xA3\x13\x37" + +#define OPT_VERB 0x1 +#define OPT_RESERV1 0x2 +#define OPT_SETARP 0x4 +#define OPT_SPREADSCAN 0x8 +#define OPT_OUTONLY 0x10 + +#define OPT_ABRT 0x20 +#define OPT_REST 0x40 +#define OPT_HOSTFILE 0x80 +#define OPT_W8SEMA 0x100 + + +struct _opt +{ + int (*getnextip) (); + int sox; + u_char *packet; + int pkg_maxlen; + int pkg_len; /* actual length of contructed packet */ + char *hostfile; + char **argvlist; + FILE *ffd; /* e.g. input file */ + char *target; + unsigned long netmask; /* depricated */ + unsigned long network; /* depricated */ + unsigned int limit; + unsigned short flags; + unsigned long random_maxcount; + u_int delay; /* w8 for outstanding packets */ + u_int pscanstat; /* scan stats every x pkts, default NEVER */ + u_long start_ip; /* in HBO */ + u_long end_ip; /* in HBO */ + u_long ipscan_count; /* scanned ip's of a SPECIFIC range [temp!] */ + u_long iptotscan_count; /* total scan_count over all ranges */ + /* used for flood protection */ + u_long bsent_count; /* byte-sent counter. TMP (!) variable */ + u_long ip_offset; /* spread scan offset */ + u_long ip_blklen; /* block-length for spread-scan */ + u_long ip_pos; /* position for SPREAD scan, non-linear */ + struct timeval scan_start; /* scan start for ALL ranges */ + /* the real beginning */ + struct timeval tv2; /* flood protection timer 2 + restore */ + /* must be the last gettimeofday() from scan */ + float sec; /* flood protection distance time */ + struct _libnet lnet; + u_char spf_smac[6]; /* spoofed ethernet sender mac */ + pthread_t bscantid; /* 'parent' thread id */ + pthread_t snarftid; /* snarf thread id */ + struct _snarf + { + u_long icmp_c; + u_long close_c; + u_long open_c; + u_long refused_c; + } + snarf; + struct net_tuple nt; +}; + + +void make_iprange (u_long *, u_long *, u_long *, u_long *, char *); +void init_spreadscan (u_long diff); +void sigdriver (int); +void print_scanstat (FILE *); +void 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 @@ +struct confFileOpt +{ + unsigned short flags; + unsigned int limit; + char *device; + unsigned long int delay; + unsigned long srcAddr; + unsigned short mac[5]; +} FileOpt; + +int 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 @@ +/* bscan - icmp include file + */ + +#ifndef BS_DCD_ICMP_H +#define BS_DCD_ICMP_H + +#define ICMP_HDRSIZE 8 + +const char * +icmp_str (int type, int code); + +#endif + 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 @@ +/* bscan - mod_garage.h - per IP storage functions include file + * + * by scut / teso + */ + +#ifndef _MOD_GARAGE_H +#define _MOD_GARAGE_H + +#include + +#define GARAGE_VERSION "1.0.1" + + +typedef struct ip_elem { + struct ip_elem * next; /* more then one data stored */ + + int data_free; /* 1 = do free() on destroy */ + size_t data_len; + void * data; /* must be free() able */ +} ip_elem; + + +typedef struct ip_list { + struct ip_list * next; /* another IP, always greater then this ! */ + unsigned long int ip; + + ip_elem * data; +} ip_list; + + +/* not for use in other code then garage.c + */ +typedef struct { + char * name; + ip_list ** garage; + + void (* cleaner)(ip_list *); + + unsigned long int ip_count; + + unsigned long int timeout_max; + unsigned long int timeout_idx; + unsigned long int * timeout_tbl; +} garage_hdlr; + + +/* mg_init + * + * setup the required structures for the garage + * + * return 0 on success + * return 1 on failure + */ + +garage_hdlr * +mg_init (char *name, unsigned long int max_hosts_in_list, + void (* cleaner)(ip_list *)); + + +/* mg_destroy + * + * destroy all data in the garage `g', use the standard handler in case + * `do_handler' is not zero, otherwise just free. + */ + +void +mg_destroy (garage_hdlr *g, int do_handler); + + +/* mg_write + * + * store pointer `data' with len `data_len' to the garage for IP `ip' + * if `data_free' is non-zero the `data' pointer will be freed if mg_clean + * or mg_destroy is called. + */ + +void +mg_write (garage_hdlr *g, unsigned long int ip, void *data, size_t data_len, + int data_free); + + +/* mg_read + * + * return first ip_elem for ip `ip' on success (it is not removed from garage) + * return NULL on failure + */ + +ip_elem * +mg_read (garage_hdlr *g, unsigned long int ip); + + +/* mg_clean + * + * clean everything stored in the garage for IP `ip' + */ + +void +mg_clean (garage_hdlr *g, unsigned long int ip, void (*cleaner)(ip_list *)); + + +/* mg_show + * + * DEBUG function, to show IP distribution in garage + */ + +void +mg_show (garage_hdlr *g); + + +/* mg_count + * + * count elements in garage + */ + +unsigned long int +mg_count (garage_hdlr *g); + + +/* mg_ip_isin + * + * check whether the ip `ip' is stored in the garage pointed to by `g'. + * + * return zero in case it is not + * return != zero if it is + */ + +int +mg_ip_isin (garage_hdlr *g, unsigned long int ip); + + +/* CIDR routines + */ + +/* mg_cidr_getmask + * + * convert a netmask (eg 0xfffffc00) or a cidr notation (eg 24) given in + * `mask' to a netmask. + */ + +unsigned long int +mg_cidr_getmask (unsigned long int mask); + + +/* mg_cidr_maskcount + * + * return the number of hosts that are possible using a mask `mask' in + * either CIDR or netmask notation + */ + +unsigned long int +mg_cidr_maskcount (unsigned long int mask); + + +/* mg_cidr_match + * + * check whether `ip1' and `ip2' are in the same network, given the network + * size by `mask' (CIDR or netmask notation) + */ + +int +mg_cidr_match (unsigned long int ip1, unsigned long int ip2, + unsigned long int mask); + + +/* mg_cidr_count + * + * count elements in garage `g', that are within the CIDR range build from + * ip `ip' and netmask `mask'. `mask' is either the number of bits, if it's in + * the range of 0-32, or the real mask, if it is greater then 32. (for the + * zero case the netmask is equal to the cidr notation). + */ + +unsigned long int +mg_cidr_count (garage_hdlr *g, unsigned long int ip, unsigned long int mask); + + +#endif + 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 @@ + +#define MAX_MODULES 8 + +#define MOD_FIRSTPKG 0x00 +#define MOD_RCV 0x01 + +#define RMOD_OK 0x00 +#define RMOD_SKIP 0x01 +#define RMOD_ERROR 0x02 +#define RMOD_ABRT 0x04 + +struct _mods +{ + int (*init) (char **, int, char **, void *); /* init the module stuff */ + int (*fini) (); /* finish the module */ + void (*musage) (); /* print out usage informations */ + int (*callmdl) (int, void *); /* call a function */ + const char *modname; /* name of the module after init */ + int modid; /* id of the module. who needs this ? */ + char *modarg; /* arg to module */ +}; + +int add_module (char *, char *); +void split_margs (const char *, char ***, int *); +int loadinit_mod (char *); + 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 @@ + +/* + * network_raw.h, depends on libnet.h + */ + + +#define ETH_SIZE 14 +#define IP_SIZE 20 +#define TCP_SIZE 20 +#define ICMP_SIZE 8 +#define UDP_SIZE 8 + +/* + * Checksum stuff + */ +#define CKSUM_CARRY(x) \ + (x = (x >> 16) + (x & 0xffff), (~(x + (x >> 16)) & 0xffff)) +#define int_ntoa(x) inet_ntoa(*((struct in_addr *)&(x))) + + +/* + * leet net tuple + */ +struct net_tuple +{ + uint32_t src; + unsigned short int sport; + uint32_t dst; + unsigned short int dport; +}; + + +/* + * pseudo TCP header for calculating the chksum + */ +struct _fakehead +{ + uint32_t saddr; + uint32_t daddr; + uint8_t zero; + uint8_t protocol; + uint16_t tot_len; +}; + +int init_network_raw (void); +int in_cksum (unsigned short *, int); +int send_ipv4 (int, u_char *, size_t); +void add_udphdr (unsigned char *, struct net_tuple *, int); +void add_tcphdr (unsigned char *, struct net_tuple *, uint8_t, int, + tcp_seq *, tcp_seq *); +void add_icmpping (unsigned char *, int, int); +void add_iphdr (unsigned char *, uint8_t ip_p, struct net_tuple *, int); +int answer_tcp (int, struct ip *, struct tcphdr *, uint8_t, u_char *, uint); +int vrfy_ip (struct ip *, uint32_t, u_short *); +int vrfy_tcp (struct tcphdr *, uint32_t, u_short *); +int decode_nvt(u_char *, uint, u_char *, uint *, u_char *, uint *); + 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 @@ +/* + * restore.h + */ + +int write_restore (void); +int 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 @@ +/* + * this space for rent.... + */ + +typedef void (*sighandler_t) (int); + +#define SIG_SETALL 0x01 + + +int 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 @@ + +#define int_ntoa(x) inet_ntoa(*((struct in_addr *)&(x))) + +#define ETH_ALEN 6 +#define PCAP_FILTER "arp or tcp or icmp or udp" + +struct Ether_header +{ + uint8_t ether_dhost[ETH_ALEN]; + uint8_t ether_shost[ETH_ALEN]; + uint16_t ether_type; +}; + +struct Arphdr +{ + unsigned short int ar_hrd; /* Format of hardware address. */ + unsigned short int ar_pro; /* Format of protocol address. */ + unsigned char ar_hln; /* Length of hardware address. */ + unsigned char ar_pln; /* Length of protocol address. */ + unsigned short int ar_op; /* ARP opcode (command). */ + /* Ethernet looks like this : This bit is variable sized + however... */ + unsigned char ar_sha[ETH_ALEN]; /* Sender hardware address. */ + unsigned char ar_sip[4]; /* Sender IP address. */ + unsigned char ar_tha[ETH_ALEN]; /* Target hardware address. */ + unsigned char ar_tip[4]; /* Target IP address. */ +}; + + +void *do_snarf (void *); +void 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 @@ +/* + * generic system functions + */ + +#include +#include +#include +#include +#include + +#define DEV_ZERO "/dev/zero" + +/* + * we use the 'do while' trick to use err_abort as if they were functions + */ +#define err_abort(code,text) do { \ + fprintf (stderr, "%s at \"%s\":%d: %s\n", \ + text, __FILE__, __LINE__, strerror (code)); \ + abort(); \ + } while (0) + +#define errno_abort(text) do { \ + fprintf(stderr, "%s at \"%s\":%d: %s\n", \ + text, __FILE__, __LINE__, strerror (errno)); \ + abort(); \ + } while (0) + + +void *shmalloc (int, size_t); +void do_nanosleep (time_t, long); +void xchange (void *, void *, int); +void time_diff (struct timeval *, struct timeval *); +int ctoreal(char *, char *); +void save_write(FILE *, char *, unsigned char *, int); +int isprintdata(char *, int); +int dat2hexstr(unsigned char *, unsigned int, unsigned char *, unsigned int); +int dat2strip(unsigned char *, unsigned int, unsigned char *, unsigned int); + 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 @@ +/* + * tty support functions + */ + +void tty_done (); +void tty_init (); +int 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 @@ +#define VER_MAJOR 0 +#define VER_MINOR 7 +#define VER_SUFFIX d +#define VER_EMAIL "anonymous@segfault.net" +#define VERSION "bscan v0.7-dev, anonymous@segfault.net" -- cgit v1.3