cuiao / mentohust

Automatically exported from code.google.com/p/mentohust
1 stars 0 forks source link

交叉编译 #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
[root@FriendlyARM plg]# ./mentohust                                       

��欢��迎��使��用MentoHUS��版��本: 0.3.1           

Copyright (C) 2009-2010 HustMoon Studio                                   

��人��到��华��中��大��,��有��甜����
���有��辣��。��明��德���学��地��,��
��求��
是��刖���家��。                                               

Bug report to http://code.google.com/p/mentohust/issues/list              

!! 
��打��开libpcap��失��败��,��请��检��查�
���是��否��已��安��装��该��库��文
��件��。                                                              

>> ��认��证��已��退��出��。                       

[root@FriendlyARM plg]# ls                                                

mentohust       mentohust.conf    
这个交叉编译了放到开发板中就是这样咯,按那个说明交叉��
�译的
******************************************************
对于交叉编译的用户,建议只保留ARP特性:

./configure --host=arm-linux --disable-encodepass --disable-notify

   1. 编译并安装
     make && make install
**********************************************************
编译后竟然把主机里面原来安装的覆盖了,我也不知道是不��
�不需要make instll这
个。所以主机ubuntu又重装了一遍mentohust。我只能看懂那种很��
�的又比较简单的
makefile文件,所以也弄不清安装到哪里去了,把源码目录src下
面的mentohust和
mentohust.conf拷贝进开发板,运行就提示上面的错误,开发板上
面预装了linux,想
在上面上网看看,帮帮咯。

Original issue reported on code.google.com by focus.on...@gmail.com on 29 Mar 2010 at 8:34

GoogleCodeExporter commented 9 years ago
建议全不保留
./configure --host=arm-linux --disable-encodepass --disable-notify --disable-arp
--with-pcap=dylib
我没编译过arm版的,不过mipsel版的不能动态载入libpcap,所以�
��个--with-pcap=dylib好
根据提示信息,是没有找到libpcap,你还没有编译它吧?
把它编译后放到交叉编译器的lib目录再编译mentohust

Original comment by www.eh...@gmail.com on 29 Mar 2010 at 12:05

GoogleCodeExporter commented 9 years ago
非常感谢抽空帮我,开始是没有编译libpcap,现在交叉编译了�
��个,我把libpcap.a放到我的交
叉编译器/usr/local/arm/4.3.2/lib目录下面似乎不行,我想问下可��
�可以直接指定这个库文
件,这个lib目录下还有好几个子目录,分不清到底该放哪里��
�或者是除了libpcap.a之外还有其
他文件?

lcong@lcong-desktop:~/mentohust-0.3.1$ make
make  all-recursive
make[1]: 正在进入目录 `/home/lcong/mentohust-0.3.1'
Making all in src
make[2]: 正在进入目录 `/home/lcong/mentohust-0.3.1/src'
arm-linux-gcc  -Os -Wall   -o mentohust myini.o md5.o mycheck.o dlfunc.o 
myfunc.o
mystate.o myconfig.o mentohust.o  
mystate.o: In function `switchState':
mystate.c:(.text+0x780): undefined reference to `pcap_sendpacket'
myconfig.o: In function `getAdapter':
myconfig.c:(.text+0x10): undefined reference to `pcap_findalldevs'
myconfig.c:(.text+0x98): undefined reference to `pcap_freealldevs'
myconfig.c:(.text+0x128): undefined reference to `pcap_freealldevs'
myconfig.o: In function `openPcap':
myconfig.c:(.text+0x17c): undefined reference to `pcap_open_live'
myconfig.c:(.text+0x1e0): undefined reference to `pcap_compile'
myconfig.c:(.text+0x1f4): undefined reference to `pcap_setfilter'
myconfig.c:(.text+0x208): undefined reference to `pcap_geterr'
myconfig.c:(.text+0x224): undefined reference to `pcap_freecode'
mentohust.o: In function `main':
mentohust.c:(.text+0x94): undefined reference to `pcap_loop'
mentohust.o: In function `sig_handle':
mentohust.c:(.text+0x5c0): undefined reference to `pcap_breakloop'
mentohust.c:(.text+0x5dc): undefined reference to `pcap_breakloop'
mentohust.o: In function `exit_handle':
mentohust.c:(.text+0x620): undefined reference to `pcap_close'
collect2: ld returned 1 exit status
make[2]: *** [mentohust] 错误 1
make[2]:正在离开目录 `/home/lcong/mentohust-0.3.1/src'
make[1]: *** [all-recursive] 错误 1
make[1]:正在离开目录 `/home/lcong/mentohust-0.3.1'
make: *** [all] 错误 2

Original comment by focus.on...@gmail.com on 30 Mar 2010 at 3:12

GoogleCodeExporter commented 9 years ago
你应该编译libpcap的动态库版本make libpcap.so

Original comment by www.eh...@gmail.com on 30 Mar 2010 at 4:30

GoogleCodeExporter commented 9 years ago
只能留给其他人弄啦,我太菜了,编译了动态版本也链接不��
�去,编译不成功

Original comment by focus.on...@gmail.com on 30 Mar 2010 at 5:38

GoogleCodeExporter commented 9 years ago
呵呵,直接把libpacap.a作为其中一个目标文件编译也通过了,�
��次能够运行了,不过还是不正常
?? 
��请��选��择��组��播��地��址(0��标��
准 1��锐��捷��私��有 2��走�): 0
?? ��请��选��择D20071190�式(0��不��使��用 
1��二��次��认��证 2��认��证��后 ** 
��网��
卡: ): eth0
** ��认��证��超��时:    8��秒
** ��响��应��间��隔:    30��秒
** ��失��败��等��待:    15��秒
** ��允��许��失��败:    0��次
** ��组��播��地��址:    ��标��准
** DHCP��方��式:��不��使��用
** ��本��机MAC: 00:1d:7d:53:fc:96                                     

** ��使��用IP:  172.26.89.67                                          

** ��子��网���码:       255.255.255.0                          

!! ��打��开��网��卡eth0��失��败: socket: Address 
family not supported by protoc     
                                                              l
>> ��认��证��已��退��出��。                       

[root@FriendlyARM plg]# 

Original comment by focus.on...@gmail.com on 30 Mar 2010 at 7:15

GoogleCodeExporter commented 9 years ago
In order for libpcap to be able to capture packets on a Linux system,
the "packet" protocol must be supported by your kernel. If it is not,
you may get error messages such as

modprobe: can't locate module net-pf-17

in "/var/adm/messages", or may get messages such as

socket: Address family not supported by protocol

from applications using libpcap.

You must configure the kernel with the CONFIG_PACKET option for this
protocol; the following note is from the Linux "Configure.help" file for
the 2.0[.x] kernel:

Packet socket
CONFIG_PACKET
The Packet protocol is used by applications which communicate
directly with network devices without an intermediate network
protocol implemented in the kernel, e.g. tcpdump. If you want them
to work, choose Y.

This driver is also available as a module called af_packet.o ( =
code which can be inserted in and removed from the running kernel
whenever you want). If you want to compile it as a module, say M
here and read Documentation/modules.txt; if you use modprobe or
kmod, you may also want to add "alias net-pf-17 af_packet" to
/etc/modules.conf.

and the note for the 2.2[.x] kernel says:

Packet socket
CONFIG_PACKET
The Packet protocol is used by applications which communicate
directly with network devices without an intermediate network
protocol implemented in the kernel, e.g. tcpdump. If you want them
to work, choose Y. This driver is also available as a module called
af_packet.o ( = code which can be inserted in and removed from the
running kernel whenever you want). If you want to compile it as a
module, say M here and read Documentation/modules.txt. You will
need to add 'alias net-pf-17 af_packet' to your /etc/conf.modules
file for the module version to function automatically. If unsure,
say Y.

In addition, there is an option that, in 2.2 and later kernels, will
allow packet capture filters specified to programs such as tcpdump to be
executed in the kernel, so that packets that don't pass the filter won't
be copied from the kernel to the program, rather than having all packets
copied to the program and libpcap doing the filtering in user mode.

Copying packets from the kernel to the program consumes a significant
amount of CPU, so filtering in the kernel can reduce the overhead of
capturing packets if a filter has been specified that discards a
significant number of packets. (If no filter is specified, it makes no
difference whether the filtering isn't performed in the kernel or isn't
performed in user mode. :-))

The option for this is the CONFIG_FILTER option; the "Configure.help"
file says:

Socket filtering
CONFIG_FILTER
The Linux Socket Filter is derived from the Berkeley Packet Filter.
If you say Y here, user-space programs can attach a filter to any
socket and thereby tell the kernel that it should allow or disallow
certain types of data to get through the socket. Linux Socket
Filtering works on all socket types except TCP for now. See the text
file linux/Documentation/networking/filter.txt for more information.
If unsure, say N.

Note that, by default, libpcap will, if libnl is present, build with it;
it uses libnl to support monitor mode on mac80211 devices. There is a
configuration option to disable building with libnl, but, if that option
is chosen, the monitor-mode APIs (as used by tcpdump's "-I" flag, and as
will probably be used by other applications in the future) won't work
properly on mac80211 devices.

Linux's run-time linker allows shared libraries to be linked with other
shared libraries, which means that if an older version of a shared
library doesn't require routines from some other shared library, and a
later version of the shared library does require those routines, the
later version of the shared library can be linked with that other shared
library and, if it's otherwise binary-compatible with the older version,
can replace that older version without breaking applications built with
the older version, and without breaking configure scripts or the build
procedure for applications whose configure script doesn't use the
pcap-config script if they build with the shared library. (The build
procedure for applications whose configure scripts use the pcap-config
script if present will not break even if they build with the static
library.)

Statistics:
Statistics reported by pcap are platform specific. The statistics
reported by pcap_stats on Linux are as follows:

2.2.x
=====
ps_recv Number of packets that were accepted by the pcap filter
ps_drops Always 0, this statistic is not gatherd on this platform

2.4.x
=====
ps_rec Number of packets that were accepted by the pcap filter
ps_drops Number of packets that had passed filtering but were not
          passed on to pcap due to things like buffer shortage, etc.
This is useful because these are packets you are interested in
but won't be reported by, for example, tcpdump output.

Original comment by www.eh...@gmail.com on 30 Mar 2010 at 10:10

GoogleCodeExporter commented 9 years ago
呵呵,搞定了。
** ��用��户��名:20071190                                         

** ��网��卡:    eth0                                                  

** ��认��证��超��时:    8��秒                          

** ��响�device eth0 entered promiscuous mode                             

�应��间��隔:    30��秒                                        

** ��失��败��等��待:    15��秒                         

** ��允��许��失��败:    0��次                          

** ��组��播��地��址:    ��标��准                  

** DHCP��方��式:��不��使��用                           

** ��本��机MAC: 00:1d:7d:53:fc:96                                     

** ��使��用IP:  172.26.89.67                                          

** ��子��网���码:       255.255.255.0                          

** 
��认��证���数��已��成��功��保��存���
�到/etc/mentohust.conf.                    
>> ��寻��找��服��务��器...                             

** ��认��证MAC: 00:1a:a9:08:1b:d2                                     

>> ���送��用��户��名...                                   

>> ���送��密��码...                                            

>> ��认��证��成��功!                                        

>> 
���送��心��跳��包��以��保��持��在���
�线...                                     

Original comment by focus.on...@gmail.com on 30 Mar 2010 at 11:47

GoogleCodeExporter commented 9 years ago

Original comment by www.eh...@gmail.com on 13 May 2010 at 3:50