紧急求一软件(有源码更是高分)

weasea 2005-05-30 08:05:01
希望是mfc的,要能设置我需要侦听的端口。
有edit控件能显示 这个端口发来的数据。。

有此软件独送一百分,
提供源码三百分。。。。
...全文
157 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
aiyue2010 2005-05-31
  • 打赏
  • 举报
回复
已经发送,请查收
summer54 2005-05-31
  • 打赏
  • 举报
回复
up uper
qrlvls 2005-05-31
  • 打赏
  • 举报
回复
上面是用 RawSocket 来监听的,你可以通过分析 IP 首部和 TCP/UDP 首部格式来取得端口号和协议类型
当然你也可以用winpcap设置过滤器来完成
qrlvls 2005-05-31
  • 打赏
  • 举报
回复


/* create the raw socket */

if( ( raw_sock = socket( PF_PACKET, SOCK_DGRAM,
htons( ETH_P_ALL ) ) ) < 0 )
{
perror( "socket" );
return( 1 );
}

/* find the interface index */

memset( &ifr, 0, sizeof( ifr ) );
strncpy( ifr.ifr_name, argv[1], sizeof( ifr.ifr_name ) );

if( ioctl( raw_sock, SIOCGIFINDEX, &ifr ) < 0 )
{
perror( "ioctl(SIOCGIFINDEX)" );
return( 1 );
}

/* bind the raw socket to the interface */

memset( &sll, 0, sizeof( sll ) );
sll.sll_family = AF_PACKET;
sll.sll_ifindex = ifr.ifr_ifindex;
sll.sll_protocol = htons( ETH_P_ALL );

if( bind( raw_sock, (struct sockaddr *) &sll,
sizeof( sll ) ) < 0 )
{
perror( "bind" );
return( 1 );
}

/* enable promiscuous mode */

memset( &mr, 0, sizeof( mr ) );
mr.mr_ifindex = ifr.ifr_ifindex;
mr.mr_type = PACKET_MR_PROMISC;

if( setsockopt( raw_sock, SOL_PACKET, PACKET_ADD_MEMBERSHIP,
&mr, sizeof( mr ) ) < 0 )
{
perror( "setsockopt" );
return( 1 );
}

while( 1 )
{
/* wait for packets */

fromlen = sizeof( from );

if( ( n = recvfrom( raw_sock, buffer, 4096, 0,
(struct sockaddr *) &from, &fromlen ) ) < 0 )
{
if( errno == ENETDOWN )
{
sleep( 30 );
continue;
}
else
{
perror( "recvfrom" );
return( 1 );
}
}

/* skip duplicate packets on the loopback interface */

if( from.sll_pkttype == PACKET_OUTGOING &&
! strcmp( argv[1], "lo" ) )
{
continue;
}

/* we're only interested in standard IPv4 packets */

if( ntohs( from.sll_protocol ) != ETH_P_IP )
{
continue;
}

#endif

/* have a look inside the IP header */

ip = (struct ip_hdr *) buffer;

src.s_addr = ip->saddr;
dst.s_addr = ip->daddr;

/* print the local time */

tt = time( 0 );
lt = localtime( &tt );
printf( "%02d-%02d %02d:%02d:%02d ", lt->tm_mon, lt->tm_mday,
lt->tm_hour, lt->tm_min, lt->tm_sec );

switch( ip->protocol )
{
case 6: /* SOL_TCP */

printf( " TCP: " );

tcp = (struct tcp_hdr *)
( ip + sizeof( struct ip_hdr ) );

/* grab source and destination port */

sport = htons( tcp->source );
dport = htons( tcp->dest );

common:

/* and print the most interesting informations */

printf( "%15s : %-5d", inet_ntoa( src ), sport );
printf( " -> " );
printf( "%15s : %-5d", inet_ntoa( dst ), dport );
printf( " %4d\n", n );
break;

case 7: /* SOL_UDP */

udp = (struct udp_hdr *)
( ip + sizeof( struct ip_hdr ) );

printf( " UDP: " );

sport = htons( udp->source );
dport = htons( udp->dest );

goto common;

case 1: /* SOL_ICMP */

icmp = (struct icmp_hdr *) \
( ip + sizeof( struct ip_hdr ) );

printf( "ICMP: " );

sport = icmp->type;
dport = icmp->code;

goto common;

default :

printf( " unsupported IP protocol %d\n", ip->protocol );
break;
}
}

return( 0 );
}
qrlvls 2005-05-31
  • 打赏
  • 举报
回复
/*
* IPv4 packet sniffer using raw sockets
*
* Copyright (C) 2004 Christophe Devine
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#ifdef WIN32

#pragma comment( lib, "ws2_32.lib" )

#include <winsock2.h>
#include <windows.h>

#define SIO_RCVALL 0x98000001

#else

#include <netpacket/packet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <unistd.h>

#define ETH_P_ALL 0x0003
#define ETH_P_IP 0x0800

#endif

#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <time.h>

struct ip_hdr
{
unsigned char hlv; /* +00 - header len. & version */
unsigned char tos; /* +01 - type of service */
unsigned short tot_len; /* +02 - total packet length */
unsigned short id; /* +04 - identification */
unsigned short frag_off; /* +06 - fragment offset field */
unsigned char ttl; /* +08 - time to live */
unsigned char protocol; /* +09 - ip protocol */
unsigned short check; /* +10 - ip checksum */
unsigned long saddr; /* +12 - source address */
unsigned long daddr; /* +16 - destination address */
};

struct icmp_hdr
{
unsigned char type; /* +00 - message type */
unsigned char code; /* +01 - type sub-code */
unsigned short checksum; /* +02 - icmp checksum */
unsigned short id; /* +04 - identification */
unsigned short sequence; /* +06 - sequence number */
};

struct tcp_hdr
{
unsigned short source; /* +00 - source port */
unsigned short dest; /* +02 - destination port */
unsigned long seq; /* +04 - sequence number */
unsigned long ack_seq; /* +08 - ack seq. number */
unsigned char unused; /* +12 - unused field */
unsigned char flags; /* +13 - tcp flags */
unsigned short window; /* +14 - tcp window */
unsigned short check; /* +16 - tcp checksum */
unsigned short urp_ptr; /* +18 - urgent pointer */
};

struct udp_hdr
{
unsigned short source; /* +00 - source port */
unsigned short dest; /* +02 - destination port */
unsigned short len; /* +04 - message length */
unsigned short check; /* +06 - udp checksum */
};

int main( int argc, char *argv[] )
{
unsigned short sport, dport;
unsigned char buffer[4096];
int raw_sock, n;

#ifdef WIN32

WSADATA wsaData;
SOCKET_ADDRESS_LIST *slist;
struct sockaddr_in iface;
int optval;

#else

struct sockaddr_ll sll;
struct sockaddr_ll from;
struct packet_mreq mr;
struct ifreq ifr;
int fromlen;

#endif

struct icmp_hdr *icmp;
struct udp_hdr *udp;
struct tcp_hdr *tcp;
struct ip_hdr *ip;
struct in_addr src;
struct in_addr dst;
struct tm *lt;
time_t tt;

/* check the arguments */

if( argc != 2 )
{
printf( "\n" );
printf( " usage: ipdump2 <interface>\n" );
printf( "\n" );
printf( " on Linux, interface can be eth0, ppp0, etc.\n" );
printf( " on Win32, interface is a number, usually 0.\n" );
printf( "\n" );

#ifdef WIN32
printf( " press Ctrl-C to continue" );
scanf( "\n" );
#endif

return( 1 );
}

#ifdef WIN32

if( WSAStartup( MAKEWORD(2,2), &wsaData ) != 0 )
{
printf( "WSAStartup() failed\n" );
return( 1 );
}

/* create the raw socket */

raw_sock = WSASocket( AF_INET, SOCK_RAW, IPPROTO_IP,
NULL, 0, WSA_FLAG_OVERLAPPED );

if( raw_sock == INVALID_SOCKET )
{
printf( "socket() failed\n" );
return( 1 );
}

/* find the interface index */

if( WSAIoctl( raw_sock, SIO_ADDRESS_LIST_QUERY,
NULL, 0, &buffer, sizeof( buffer ),
&n, NULL, NULL ) == SOCKET_ERROR )
{
printf( "WSAIoctl(SIO_ADDRESS_LIST_QUERY) failed\n" );
return( 1 );
}

slist = (SOCKET_ADDRESS_LIST *) buffer;

/* bind the raw socket to the interface */

n = atoi( argv[1] );

memset( &iface, 0, sizeof( iface ) );

iface.sin_family = AF_INET;
iface.sin_port = htons( 0 );
iface.sin_addr.s_addr = 0x0100007F;

if( n + 1 <= slist->iAddressCount )
{
iface.sin_addr.s_addr = ((struct sockaddr_in *)
slist->Address[n].lpSockaddr)->sin_addr.s_addr;
}
else
{
printf( "interface '%d' not in list\n", n );
return( 1 );
}

if( bind( raw_sock, (struct sockaddr *) &iface,
sizeof( iface ) ) != 0 )
{
printf( "bind(raw socket) failed\n" );
return( 1 );
}

/* enable promiscuous mode */

optval = 1;

if( WSAIoctl( raw_sock, SIO_RCVALL, &optval, sizeof( optval ),
NULL, 0, &n, NULL, NULL ) == SOCKET_ERROR )
{

printf( "WSAIoctl(SIO_RCVALL) failed\n" );
return( 1 );
}

while( 1 )
{
/* wait for packets */

n = recv( raw_sock, buffer, sizeof( buffer ), 0 );

if( n == SOCKET_ERROR )
{
printf( "recv() failed\n" );
return( 1 );
}

#else
weasea 2005-05-31
  • 打赏
  • 举报
回复
请楼上2位收信
aiyue2010 2005-05-31
  • 打赏
  • 举报
回复
我也有一个,需要的话联系我
superbishop@sina.com
weasea 2005-05-31
  • 打赏
  • 举报
回复
收到了~
谢谢楼上几位
halk 2005-05-31
  • 打赏
  • 举报
回复
就是sniffer嘛!
我有一个自己写的,基于winpcap3.0的,可设置监听过滤,可简单分析协议,可域名/ip互转,可查询IP地理位置(基于QQWry)。有些部分还没完全实现,但上述功能基本可行。需要的话mail我。

halk_xia@yahoo.com.cn
Hendy_So 2005-05-30
  • 打赏
  • 举报
回复
随便一个监听软件都可以做到,远高于你的需求。
淘宝客女包单页面源码,随着淘宝客程序的火热,淘宝客的程序也应运而生,各种程序的版本之多让人难以选择!而作者依据自己的经验发现各种版本的淘宝客程序不能有效的平衡用户和搜索引擎!因此作者依据自己的经验开发了一个程序,首次尝试手写代码。依据用户体验为基础,延伸到SEO,并针对性的做出了防封杀技术!真正意义上实现淘宝客程序的防封杀! 淘宝客女包单页面源码 1.5 升级说明: 1.0版本开发后受到大家的支持,当日下载次数超过1000人,感谢热心人士提供建议和批评。百度优化紧急修复V1.0版本的错误,推出V1.5版 1.1.5版修复了V1.0浏览器兼容的问题,测试了遨游 IE7.0 IE8.0 FF等主流浏览器,解决了兼容问题! 2.1.5版修复了高分辨率下,层错位的问题。定义了层的位置。 3.1.5版改进了“细节”,进一步的优化了代码,修复了背景出现“黑色线条”的问题 4.1.5版经磋商,把产品佣金提高到11% 5.1.5版经改进产品的细节,提高了用户的“点击概率” 6.1.5版增加了详细的代码注释,方便大家套用各种CMS程序! 程序特点: 一,结构优化,代码优化,更加符合“搜索引擎”。有效防止了被k和拔毛! 二,4年专注百度优化,更适合百度推广和优化。 三,良好“用户体验”设计,更加吸引用户。 四,独家技术支持,让你轻松优化。 五,工厂产品,品质更有保证。 六,单页面更容易维护。 七,一件修改“关键词”,笔者,已经做好了“结构”“关键词布局”“防百度封杀”技术。(此模板关键词 “时尚女包”) 八,独家使用“百度防封杀”技术,精准控制导向流量。 九,只要有空间和域名即可上线优化。 淘宝客女包单页面源码 1.5 有关问题说明: 1.页面一样会不会让蜘蛛判断作弊 1.5版采用了独家的“结构优化”。有效的控制了蜘蛛的访问深度。是大部分内容是无法抓取的。只抓取对排名有利的页面,增加权重 2.防封杀效果! 目前,淘宝客女包源码采用的技术,是国内蜘蛛无法判断的,百度优化舍弃了主流的“框架识别”漏洞和“脚本”引用。采用了“图片识别”漏洞,目前世界上主流的搜索引擎蜘蛛还是无法识别的,因此在防封杀效果明显。 3.关于代码问题 精简了绝大部分代码,由于单页面优化有一定的难度,因此,百度优化建议你加入QQ群:45041704,有技术支持,能解决你遇到的问题 ,如,不收录。快照退档等问题。 4.关于结构问题 什么是结构优化,结构优化是百度优化的核心技术,同时,百度优化立志搜索引擎设计师,在很多方面对搜索引擎有较为深刻的研究,对于主流的黑帽子技术也是比较了解的。 5.排名技术解析 百度优化采用了独家技术,源码本身就很好的平衡了用户和搜索引擎的关系,加上有针对性的对蜘蛛做了“引诱”,百度优化进4年的百度深度研究。立志开发更为智能的搜索引擎,源码本身并没有特殊的地方,只是在结构方面做了精深优化,百度优化利用“免费空间”“二级域名”测试。均达到了快速收录的效果的,大家注意到源码本身的官方网站使用的就是“中国8U的免费空间”和“二级域名”(垃圾空间和二级域名本身对搜因不友好。)同时,建议想玩淘宝客的朋友使用,顶级空间和顶级域名,收录排名更快更好! 6.技术支持问题 此版源码采用了独家技术,同类比的源码在市场上均售价50-200元不等,商业版由“兰若轩”买断。因此,你使用的源码均是商业版,提供技术支持主要针对推广兰若轩的产品,同时,没有技术的支持,此源码会出现,快照停档的问题,和排名不稳定的问题。市场上淘宝客的佣金都为10%-15%,出售的源码本身就经过了修改。而我们提供的不仅仅有高达11%的佣金 季度奖金,更有完善的技术支持。因此,我们建议你推广兰若轩的产品,并且加入我们,享受高比例佣金和技术支持。免费使用升级版。CMS2.0和V2.0版本不排除开发商业版!
淘宝客女包单页面源码V1.5版升级说明 V1.0版本开发后受到大家的支持,当日下载次数超过1000人,感谢热心人士提供建议和批评。百度优化紧急修复V1.0版本的错误,推出V1.5版 1.V1.5版修复了V1.0浏览器兼容的问题,测试了遨游 IE7.0 IE8.0 FF等主流浏览器,解决了兼容问题! 2.V1.5版修复了高分辨率下,层错位的问题。定义了层的位置。 3.V1.5版改进了“细节”,进一步的优化了代码,修复了背景出现“黑色线条”的问题 4.V1.5版经磋商,把产品佣金提高到11% 5.V1.5版经改进产品的细节,提高了用户的“点击概率” 6.V1.5版增加了详细的代码注释,方便大家套用各种CMS程序! 淘宝客女包单页面源码V1.5版有关问题说明 1.页面一样会不会让蜘蛛判断作弊   V1.5版采用了独家的“结构优化”。有效的控制了蜘蛛的访问深度。是大部分内容是无法抓取的。只抓取对排名有利的页面,增加权重 2.防封杀效果!   目前,淘宝客女包源码采用的技术,是国内蜘蛛无法判断的,百度优化舍弃了主流的“框架识别”漏洞和“脚本”引用。采用了“图片识别”漏洞,目前世界上主流的搜索引擎蜘蛛还是无法识别的,因此在防封杀效果明显。 3.关于代码问题   精简了绝大部分代码,由于单页面优化有一定的难度,因此,百度优化建议你加入QQ群:45041704,有技术支持,能解决你遇到的问题 ,如,不收录。快照退档等问题。 4.关于结构问题   什么是结构优化,结构优化是百度优化的核心技术,同时,百度优化立志搜索引擎设计师,在很多方面对搜索引擎有较为深刻的研究,对于主流的黑帽子技术也是比较了解的。 5.排名技术解析   百度优化采用了独家技术,源码本身就很好的平衡了用户和搜索引擎的关系,加上有针对性的对蜘蛛做了“引诱”,百度优化进4年的百度深度研究。立志开发更为智能的搜索引擎,源码本身并没有特殊的地方,只是在结构方面做了精深优化,百度优化利用“免费空间”“二级域名”测试。均达到了快速收录的效果的,大家注意到源码本身的官方网站使用的就是“中国8U的免费空间”和“二级域名”(垃圾空间和二级域名本身对搜因不友好。)同时,建议想玩淘宝客的朋友使用,顶级空间和顶级域名,收录排名更快更好! 6.技术支持问题   此版源码采用了独家技术,同类比的源码在市场上均售价50-200元不等,商业版由“兰若轩”买断。因此,你使用的源码均是商业版,提供技术支持主要针对推广兰若轩的产品,同时,没有技术的支持,此源码会出现,快照停档的问题,和排名不稳定的问题。市场上淘宝客的佣金都为10%-15%,出售的源码本身就经过了修改。而我们提供的不仅仅有高达11%的佣金 季度奖金,更有完善的技术支持。因此,我们建议你推广兰若轩的产品,并且加入我们,享受高比例佣金和技术支持。免费使用升级版。CMS2.0和V2.0版本不排除开发商业版! 淘宝客女包单页面源码V1.5版特点 一,结构优化,代码优化,更加符合“搜索引擎”。有效防止了被k和拔毛! 二,4年专注百度优化,更适合百度推广和优化。 三,良好“用户体验”设计,更加吸引用户。 四,独家技术支持,让你轻松优化。 五,工厂产品,品质更有保证。 六,一健修改“关键词”,笔者,已经做好了“结构”“关键词布局”“防百度封杀”技术。 七,独家使用“百度防封杀”技术,精准控制导向流量。 声明:V1.0版本上线不到几分钟就发现网络上有同步“倒卖”的情况,在此,程序优化:百度优化 页面设计:一亩半 发出声明,V1.0版和V1.5版本均为免费版本,请勿上当受骗。程序本身就是免费的,因此大家可以自由的传播。但是违背作者本意,尤其是“盗用源码”“修改源码”打包出售行为,并将受到同行的BS。同时,不少人建议我们结合CMS。百度优化V1.5版做了详细的代码注释!方便了大家可以自由套用CMS。关于CMS2.0版和单页面V2.0版我们正在努力。并表示CMS2.0和V2.0不排除将收取开发费用。如果你推广兰若轩的产品,均可免费享受到商业版并且获得高比例佣金和季度奖金。并且享受到独家的技术支持。!详情加入QQ群45041704                                          联系作者:qq交流群:45041704  BY:百度优化  一亩半

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧