Closed GoogleCodeExporter closed 8 years ago
Latest libcrafter on the git repo should work fine on MAC OSX. Since is a
development environment you'll need to install automake on MAC OSX :
$ brew install automake
Then, to compile libcrafter :
$ git clone git@github.com:pellegre/libcrafter.git
$ cd libcrafter/libcrafter
$ ./autogen.sh
$ make -j8
$ make install
Original comment by pellegre...@gmail.com
on 17 Feb 2014 at 12:09
without BREW, sorry not use it.
I have downloaded google version, but now try with git version;
I have Mac OS X 10.6.8 and 10.9.1:
On 10.6.8:
git clone https://github.com/pellegre/libcrafter
cd libcrafter/libcrafter
./autogen.sh
---- ERROR ----
ld: symbol dyld_stub_binding_helper not defined (usually in
crt1.o/dylib1.o/bundle1.o)
collect2: ld returned 1 exit status
configure:2614: $? = 1
configure:2652: result:
configure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME "libcrafter"
| #define PACKAGE_TARNAME "crafter"
| #define PACKAGE_VERSION "0.2"
| #define PACKAGE_STRING "libcrafter 0.2"
| #define PACKAGE_BUGREPORT "pellegre.esteban@gmail.com"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:2659: error: C++ compiler cannot create executables
See `config.log' for more details.
---
autoconf (GNU Autoconf) 2.61
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
---
automake (GNU automake) 1.10
Written by Tom Tromey <tromey@redhat.com>
and Alexandre Duret-Lutz <adl@gnu.org>.
Copyright 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
---
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin10.0
---
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
On 10.9.1, test later...
Thanks.
Original comment by antwal
on 17 Feb 2014 at 4:27
On 10.9.1, not working:
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force ${ACLOCAL_FLAGS}
main::scan_file() called too early to check prototype at /usr/local/bin/aclocal
line 617.
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
main::scan_file() called too early to check prototype at /usr/local/bin/aclocal
line 617.
autoreconf: running: /usr/local/bin/autoconf --force
autoreconf: running: /usr/local/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
Useless use of /d modifier in transliteration operator at
/usr/local/share/automake-1.11/Automake/Wrap.pm line 58.
configure.ac:13: installing `./config.guess'
configure.ac:13: installing `./config.sub'
configure.ac:6: installing `./install-sh'
configure.ac:6: installing `./missing'
Makefile.am: installing `./INSTALL'
Makefile.am: installing `./depcomp'
autoreconf: Leaving directory `.'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking build system type... i386-apple-darwin13.0.0
checking host system type... i386-apple-darwin13.0.0
checking how to print strings... printf
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc...
/Developer/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xct
oolchain/usr/bin/ld
checking if the linker
(/Developer/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xc
toolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert i386-apple-darwin13.0.0 file names to
i386-apple-darwin13.0.0 format... func_convert_file_noop
checking how to convert i386-apple-darwin13.0.0 file names to toolchain
format... func_convert_file_noop
checking for
/Developer/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xct
oolchain/usr/bin/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker
(/Developer/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xc
toolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin13.0.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++...
/Developer/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xct
oolchain/usr/bin/ld
checking if the linker
(/Developer/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xc
toolchain/usr/bin/ld) is GNU ld... no
checking whether the g++ linker
(/Developer/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xc
toolchain/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common -DPIC
checking if g++ PIC flag -fno-common -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker
(/Developer/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xc
toolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin13.0.0 dyld
checking how to hardcode library paths into programs... immediate
checking for u_int32_t... yes
checking for u_int64_t... yes
checking for u_int16_t... yes
checking for u_int8_t... yes
checking for size_t... yes
checking for libpcap... no
configure: error: libpcap not found
I have libpcap installed:
/usr/local/lib/libpcap.1.5.3.dylib
/usr/local/lib/libpcap.a
/usr/local/lib/libpcap.A.dylib
/usr/local/lib/libpcap.dylib
Thanks.
Original comment by antwal
on 18 Feb 2014 at 10:02
On 10.9.1 Fixed:
use this command without brew: ./configure LDFLAGS=-L/usr/local/lib
--with-libpcap=yes
and it working.
Original comment by antwal
on 18 Feb 2014 at 10:12
Testing:
Example Arp Ping:
g++ arpping.cpp -o arpping -lcrafter -I/usr/local/include -L/usr/local/lib
./arpping
[@] My MAC address is : c4:2c:03:19:12:52
[@] My IP address is :
[!] WARNING : GetIPv4() -> Error while resolving : Undefined error: 0
[@] Sending the ARP Requests. Wait...
BindLinkSocketToInterface(): Bad file descriptor
libc++abi.dylib: terminating with uncaught exception of type
std::runtime_error: Binding raw socket to interface
Abort trap: 6
Where is the problem?
Original comment by antwal
on 18 Feb 2014 at 10:19
Another test:
Example Ping:
I have changed only:
string iface = "en0";
./ping
[!] WARNING : GetIPv4() -> Error while resolving : Undefined error: 0
[@] Print before sending:
< IP (20 bytes) :: Version = 4 , HeaderLength = 5 , DiffServicesCP = 0 ,
ExpCongestionNot = 0 , TotalLength = 0 , Identification = 0x0 , Flags = 0 ,
FragmentOffset = 0 , TTL = 64 , Protocol = 0x6 , CheckSum = 0x0 , SourceIP =
255.255.255.255 , DestinationIP = 173.194.116.24 , >
< ICMP (8 bytes) :: Type = 8 , Code = 0 , CheckSum = 0x0 , Identifier = 0xb3e0
, SequenceNumber = 0x0 , >
< RawLayer (11 bytes) :: Payload = HelloPing!\n>
CreateRawSocket(): Operation not permitted
libc++abi.dylib: terminating with uncaught exception of type
std::runtime_error: Creating raw(PF_INET) socket
Abort trap: 6
Same problem.
Original comment by antwal
on 18 Feb 2014 at 10:21
make sure you change the interfaces on the examples to "en0" and also execute
the examples with root privileges :
$ sudo ./ping
Original comment by pellegre...@gmail.com
on 18 Feb 2014 at 10:30
Tested:
sudo ./arpping
[@] My MAC address is : c4:2c:03:19:12:52
[@] My IP address is :
[!] WARNING : GetIPv4() -> Error while resolving : Undefined error: 0
[@] Sending the ARP Requests. Wait...
dyld: lazy symbol binding failed: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: lazy symbol binding failed: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: lazy symbol binding failed: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: lazy symbol binding failed: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: lazy symbol binding failed: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: lazy symbol binding failed
------
sudo ./ping
[!] WARNING : GetIPv4() -> Error while resolving : Undefined error: 0
[@] Print before sending:
< IP (20 bytes) :: Version = 4 , HeaderLength = 5 , DiffServicesCP = 0 ,
ExpCongestionNot = 0 , TotalLength = 0 , Identification = 0x0 , Flags = 0 ,
FragmentOffset = 0 , TTL = 64 , Protocol = 0x6 , CheckSum = 0x0 , SourceIP =
255.255.255.255 , DestinationIP = 173.194.116.24 , >
< ICMP (8 bytes) :: Type = 8 , Code = 0 , CheckSum = 0x0 , Identifier = 0x47db
, SequenceNumber = 0x0 , >
< RawLayer (11 bytes) :: Payload = HelloPing!\n>
[@] Print after sending:
< IP (20 bytes) :: Version = 4 , HeaderLength = 5 , DiffServicesCP = 0 ,
ExpCongestionNot = 0 , TotalLength = 39 , Identification = 0x0 , Flags = 0 ,
FragmentOffset = 0 , TTL = 64 , Protocol = 0x1 , CheckSum = 0x3223 , SourceIP =
255.255.255.255 , DestinationIP = 173.194.116.24 , >
< ICMP (8 bytes) :: Type = 8 , Code = 0 , CheckSum = 0xb172 , Identifier =
0x47db , SequenceNumber = 0x0 , >
< RawLayer (11 bytes) :: Payload = HelloPing!\n>
Original comment by antwal
on 18 Feb 2014 at 3:25
I want use only the example ping scan, but I have the same problem with en0
"ethernet", if I use en1 "wireless" it working, but I receive the errors:
1. nano netping.cpp
2. g++ netping.cpp -o netping -lcrafter -I/usr/local/include -L/usr/local/lib
3. time sudo ./netping
[@] My IP address is : 192.168.200.106
[@] Sending the ICMP echoes. Wait...
dyld: lazy symbol binding faileddyld: lazy symbol binding failed: Symbol not
found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: lazy symbol binding failed: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: lazy symbol binding failed: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: lazy symbol binding failed: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: lazy symbol binding failed: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: lazy symbol binding failed: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
dyld: Symbol not found: _pcap_open_live
Referenced from: /usr/local/lib/libcrafter.0.dylib
Expected in: flat namespace
real 0m0.551s
user 0m0.015s
sys 0m0.015s
Not working.
Thanks.
Original comment by antwal
on 18 Feb 2014 at 3:36
Looks like there is problem with the pcap linking on libcrafter. Can you try
linking pcap with the application also?
$ g++ netping.cpp -o netping -lcrafter -lpcap -I/usr/local/include
-L/usr/local/lib
Original comment by pellegre...@gmail.com
on 18 Feb 2014 at 3:40
Hi,
yes working all.
Another question, how can build the application with static library, without
shared or dynamic?
Thanks.
Original comment by antwal
on 18 Feb 2014 at 5:36
sure, on the configure step you just need to add the enable-static flag:
$ ./configure --enable-static
Original comment by pellegre...@gmail.com
on 18 Feb 2014 at 5:40
Hi,
i have build static but not working:
./configure LDFLAGS=-L/usr/local/lib --with-libpcap=yes --enable-static
I have problems when try compile application:
g++ netping.cpp -o netping.static -I/usr/local/include -L/usr/local/lib
-Bstatic /usr/local/lib/libpcap.a /usr/local/lib/libcrafter.a
Undefined symbols for architecture x86_64:
"_res_9_ns_initparse", referenced from:
Crafter::DNS::FromRaw(Crafter::RawLayer const&) in libcrafter.a(DNSCraft.o)
Crafter::DNS::ParseLayerData(Crafter::Layer::ParseInfo*) in libcrafter.a(DNSCraft.o)
"_res_9_ns_name_compress", referenced from:
Crafter::DNS::DNSQuery::Compress() in libcrafter.a(DNSQuery.o)
Crafter::DNS::DNSAnswer::CompressName() in libcrafter.a(DNSAnswer.o)
Crafter::DNS::DNSAnswer::CompressRData() in libcrafter.a(DNSAnswer.o)
"_res_9_ns_name_uncompress", referenced from:
SetContainerSection(std::__1::vector<Crafter::DNS::DNSAnswer, std::__1::allocator<Crafter::DNS::DNSAnswer> >&, __ns_sect, __ns_msg*) in libcrafter.a(DNSCraft.o)
"_res_9_ns_parserr", referenced from:
SetContainerSection(std::__1::vector<Crafter::DNS::DNSAnswer, std::__1::allocator<Crafter::DNS::DNSAnswer> >&, __ns_sect, __ns_msg*) in libcrafter.a(DNSCraft.o)
Crafter::DNS::FromRaw(Crafter::RawLayer const&) in libcrafter.a(DNSCraft.o)
Crafter::DNS::ParseLayerData(Crafter::Layer::ParseInfo*) in libcrafter.a(DNSCraft.o)
"_res_9_ns_put16", referenced from:
Crafter::DNS::DNSQuery::Write(unsigned char*) const in libcrafter.a(DNSQuery.o)
Crafter::DNS::DNSAnswer::Write(unsigned char*) const in libcrafter.a(DNSAnswer.o)
"_res_9_ns_put32", referenced from:
Crafter::DNS::DNSAnswer::CompressRData() in libcrafter.a(DNSAnswer.o)
Crafter::DNS::DNSAnswer::Write(unsigned char*) const in libcrafter.a(DNSAnswer.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
All libraries need:
file /usr/local/lib/libpcap.dylib
/usr/local/lib/libpcap.dylib: Mach-O universal binary with 2 architectures
/usr/local/lib/libpcap.dylib (for architecture x86_64): Mach-O 64-bit
dynamically linked shared library x86_64
/usr/local/lib/libpcap.dylib (for architecture i386): Mach-O dynamically linked
shared library i386
file /usr/local/lib/libpcap.a
/usr/local/lib/libpcap.a: Mach-O universal binary with 2 architectures
/usr/local/lib/libpcap.a (for architecture x86_64): current ar archive random
library
/usr/local/lib/libpcap.a (for architecture i386): current ar archive random
library
file /usr/local/lib/libcrafter.dylib
/usr/local/lib/libcrafter.dylib: Mach-O 64-bit dynamically linked shared
library x86_64
file /usr/local/lib/libcrafter.a
/usr/local/lib/libcrafter.a: current ar archive random library
file /usr/local/lib/libcrafter.la
/usr/local/lib/libcrafter.la: libtool library file
Thanks for help.
Original comment by antwal
on 18 Feb 2014 at 6:55
you also need to link it with libresolv (if you want to use the static version):
g++ netping.cpp -o netping.static -I/usr/local/include -L/usr/local/lib
-Bstatic /usr/local/lib/libpcap.a /usr/local/lib/libcrafter.a -lresolv
Original comment by pellegre...@gmail.com
on 18 Feb 2014 at 8:22
nice working. thanks.
Original comment by antwal
on 18 Feb 2014 at 9:40
Original issue reported on code.google.com by
antwal
on 16 Feb 2014 at 10:17