81 lines
2.2 KiB
C
81 lines
2.2 KiB
C
#ifndef RHOST_H
|
|
#define RHOST_H
|
|
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
#include <fcntl.h>
|
|
#include <string.h>
|
|
#include <time.h>
|
|
#include <signal.h>
|
|
#include <sys/wait.h>
|
|
#include <curl/curl.h>
|
|
#include <sys/types.h>
|
|
#include <arpa/inet.h>
|
|
#include <assert.h>
|
|
#include <limits.h>
|
|
|
|
|
|
#include "conf.h"
|
|
|
|
typedef struct now_next_time
|
|
{
|
|
int now_year;
|
|
int now_mon;
|
|
int now_day;
|
|
int now_hour;
|
|
int now_min;
|
|
int now_sec;
|
|
int now_week;
|
|
|
|
int next_year;
|
|
int next_mon;
|
|
int next_day;
|
|
int next_hour;
|
|
int next_min;
|
|
int next_sec;
|
|
int next_week;
|
|
} now_next_time;
|
|
|
|
|
|
|
|
|
|
|
|
#define COLOR_NONE "\033[0m" //表示清除前面设置的格式
|
|
#define RED "\033[1;31;40m" //40表示背景色为黑色, 1 表示高亮
|
|
#define BLUE "\033[1;34;40m"
|
|
#define GREEN "\033[1;32;40m"
|
|
#define YELLOW "\033[1;33;40m"
|
|
|
|
|
|
#define CENTOS_SYSTEM 1
|
|
#define DEBISN_SYSTEM 2
|
|
#define UNKNOWN_SYSTEM 3
|
|
|
|
#define BUFFER 1024
|
|
#define LONG_BUFFER 1024*1000
|
|
#define ARGS_NUM 20
|
|
#define WHITELIST_IP_NUM 1024
|
|
#define BUILD(fmt...) do { fprintf(stderr,"%s %s ",__DATE__,__TIME__); fprintf(stderr, ##fmt); } while(0)
|
|
|
|
#define AWK " | awk -v num=%d '{a[$1]+=1;} END {for(i in a){if (a[i] >= num) {print i;}}}' "
|
|
#define GE_10 "grep -E \"^$(LC_ALL=\"C\" date \"+%h\").$(LC_ALL=\"C\" date \"+%d\")\" /var/log/auth.log | grep failure | grep rhost"
|
|
#define LE_10 "grep -E \"^$(LC_ALL=\"C\" date \"+%h\")..$(LC_ALL=\"C\" date | awk '{print $3}')\" /var/log/auth.log | grep failure | grep rhost"
|
|
|
|
#define CENTOS_GE_10 "grep -E \"^$(LC_ALL=\"C\" date \"+%h\").$(LC_ALL=\"C\" date \"+%d\")\" /var/log/secure | grep failure | grep rhost"
|
|
#define CENTOS_LE_10 "grep -E \"^$(LC_ALL=\"C\" date \"+%h\")..$(LC_ALL=\"C\" date | awk '{print $3}')\" /var/log/secure | grep failure | grep rhost"
|
|
|
|
#define QQMAIL "gomail -r %s -s \"System ban IP\" -t \"%s\""
|
|
|
|
#define QQMAIL_Virus "gomail -r %s -s \"System Virus Infected\" -t \"%s\""
|
|
#define QQMAIL_DISK_USE "gomail -r %s -s \"System Disk Use\" -t \"%s\""
|
|
|
|
|
|
|
|
extern void read_conf(char *filename, conf * configure);
|
|
extern void free_conf(conf * conf);
|
|
extern void ptintf_conf(conf * conf);
|
|
extern int isregion(char *str, char (*region_list)[WHITELIST_IP_NUM]);
|
|
|
|
#endif
|