c-需要帮助编译一些东西!(:

  • 本文关键字:帮助 编译 c linux gcc
  • 更新时间 :
  • 英文 :


我正在帮助IM的开发人员测试他们的安全性和问题,他们想要一个服务器上报告的tcp重置漏洞的例子。我在编译它时遇到问题,有人能帮忙吗?错误日志:http://pastie.org/4212921

C文件:http://www.exploit-db.com/download/291

从第一个报告的错误开始几乎总是一个好主意。

在您的情况下,第一个报告的错误是:

reset-tcp.c:51: error: ‘u_char’ undeclared (first use in this function)

CCD_ 1不是标准的C类型;它可能是CCD_ 2的typedef。

您的源文件具有以下#include指令:

#include <libnet.h>
#include <stdio.h>

<stdio.h>不能定义u_char,所以它必须在<libnet.h>中定义——特别是在源文件所依赖的<libnet.h>的任何版本中。

这是一个非标准的头(我的系统上没有安装),所以我的最佳猜测是,您使用的libnet版本与reset-tcp.c设计使用的版本不同。

我知道这不能解决你的问题,但它应该给你一个好的起点。

编辑:

我刚刚在Ubuntu 12.04系统(u_char2的1.1.4-2.1版本)上安装了libnet1libnet1-devlibnet1-doc软件包。您的源文件现在编译时(在连接第74行和第75行之后)出现了一些警告。类型u_char/usr/include/i386-linux-gnu/sys/types.h中定义,CCD_14由libnet.h间接包括。

我确实收到了一些警告:

291.c:95:1: warning: format ‘%X’ expects argument of type ‘unsigned int *’, but argument 3 has type ‘u_char *’ [-Wformat]
291.c:95:1: warning: format ‘%X’ expects argument of type ‘unsigned int *’, but argument 4 has type ‘u_char *’ [-Wformat]
291.c:95:1: warning: format ‘%X’ expects argument of type ‘unsigned int *’, but argument 5 has type ‘u_char *’ [-Wformat]
291.c:95:1: warning: format ‘%X’ expects argument of type ‘unsigned int *’, but argument 6 has type ‘u_char *’ [-Wformat]
291.c:95:1: warning: format ‘%X’ expects argument of type ‘unsigned int *’, but argument 7 has type ‘u_char *’ [-Wformat]
291.c:95:1: warning: format ‘%X’ expects argument of type ‘unsigned int *’, but argument 8 has type ‘u_char *’ [-Wformat]
291.c:116:1: warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat]

你一定要注意;代码当前尝试将CCD_ 16值存储在CCD_。

建议:

  1. 告诉我们您使用的是什么操作系统和libnet的哪个版本;如果我们掌握了这些信息,有人可能会提供更好的建议。

  2. 让我们知道源代码来自哪里,看看你是否能找到它应该使用的unsigned char0版本。

您需要安装libnet及其开发包。

在Debian下,您可以通过安装包libnet1libnet-dev来完成此操作。

最新更新