资源简介
linux入侵检测源代码基于libnids的非常简单的功能,实现了端口扫描,tcp,udp异常数据包的检测要两台linux系统联网,用nmap扫描
代码片段和文件信息
#include “stdio.h“
#include “string.h“
#include “nids.h“
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
struct scan
{
u_int addr;
unsigned short port;
u_char flags;
};
/*�����Ǽ���ɨ��ʱ�õ���ɨ���������ݽṹ*/
struct host
{
struct host* next; /*��һ����������*/
struct host* prev; /*ǰһ����������*/
u_int addr; /*��ַ*/
int modtime; /*ʱ��*/
int n_packets; /*����*/
struct scan* packets; /*ɨ����Ϣ*/
};
/*������IPЭ���ײ������ݽṹ*/
struct ip_header
{
#if defined (WORDS_BIGENDIAN)
unsigned char ip_version:4
ip_header_length:4;
#else
unsigned char ip_header_length:4
ip_version:4;
#endif
unsigned char ip_tos;
unsigned short ip_length;
unsigned short ip_id;
unsigned short ip_off;
unsigned char ip_ttl;
unsigned char ip_protocol;
unsigned short ip_checksum;
struct in_addr ip_source_address;
struct in_addr ip_destination_address;
};
struct tcp_header
{
unsigned char th_sport; /*Դ�˿ں�*/
unsigned char th_dport; /*Ŀ�Ķ˿ں�*/
unsigned short th_seq; /*���к�*/
unsigned short th_ack; /*ȷ�Ϻ�*/
#ifdef WORDS_BIGENDIAN
unsigned int th_off : 4 /*����ƫ��*/
th_x2 : 4; /*����*/
#else
unsigned int th_x2 : 4 /*����*/
th_off : 4; /*����ƫ��*/
#endif
unsigned int th_flags;
unsigned char th_win; /*���ڴ�С*/
unsigned char th_sum; /*����*/
unsigned char th_urp; /*����ָ��*/
};
struct udp_header
{
unsigned short udp_source_port;
unsigned short udp_destination_port;
unsigned short udp_length;
unsigned short udp_checksum;
};
char ascii_string[10000];
void sound_alarm()
{
int fd = open(“/dev/tty10“ O_RDONLY);
char *ch1=“100“;
char *ch2=“2000“;
ioctl(fd KDMKTONE (atoi(ch1)<<16)+(1193180/atoi(ch2)));
}
char* char_to_ascii(char ch)
{
char*string;
ascii_string[0]=0;
string=ascii_string;
if(isgraph(ch))
{
*string++=ch;
}
else if(ch==‘\n‘ || ch==‘\r‘)
{
*string++=ch;
}
else
{
*string++=‘.‘;
}
*string=0;
return ascii_string;
}
void udp_protocol_packet_callback ( u_char * packet_content)
{
struct udp_header* udp_protocol;
unsigned short source_port;
u_short destination_port;
u_short length;
udp_proto
相关资源
- 蓝牙源代码应用于LINUX
- uboot到linux logo显示不间断 补丁
- UNIX/LINUX编程实践教程的源码
- Linux任务管理器
- linux应用层的华容道游戏源代码
- ubuntu9.10 可加载内核模块和字符设备驱
- MP3文件ID3v2ID3v2APEv2标签读取
- 操作系统实验——虚存管理实验
- linux下的发包工具sendip
- 尚观培训linux许巍关于c 的笔记和讲义
- 尚观培训linux董亮老师关于数据结构的
- linux 线程池源码 c 版
- linux C 电梯程序练习
- linux下用多进程同步方法解决生产者
- Linux 操作系统实验(全)
- Linux From Scratch 中文手册
- linux 网络实验 ftp程序
- Linux命令大全离线版&在线版
- 操作系统共享内存实验
- dos 下运行Linux 命令--gnu_utils
- linux 0.12内核源代码
- linux简易shell C实现
- linux实验报告及心得体会
- 基于GTK的Linux环境下的简易任务管理器
- linux扫雷游戏代码
- CAN Linux驱动代码
- Linux系统教材
- intel 82579LM 网卡驱动Linux系统版 v1.9.
- SA1110处理器掌上电脑液晶显示器设计
- 基于Linux的串口服务器设计
评论
共有 条评论