Compile Ettercap-NG-0.7.3 natively on Leopard Fix

UPDATE 2:
njstaticuser mentioned he would like to know where to get this file below: I believe the file should be in /opt/local/var/macports/build/ – there should be a folder called _opt_local_var_macports_sources_rsync.macports.org_release_ports_<ettercap-ng> where <ettercap-ng> will be something like “net_ettercap-ng” (I don’t know the exact name because it has been cleaned from that directory). Under this directory there will be another directory called “work” and under the work directory will be another directory named after the ettercap dist file. Inside this directory you’ll want to look under src/interfaces/curses/widgets/ for the wdg.h and wdg.c files.

If all else fails, run “sudo find /opt/local/var/macports/build -name "wdg.*" -print” and it should print the locations of the files. NOTE: These files will only exist *after* attempting the build with macports, so attempt to build first (sudo port install ettercap-ng), and then look for the files. Hope this helps!

UPDATE:
After talking to people in IRC, I found the real root of this problem, wdg.h and wdc.h need to have #include <sys/types.h> included at the top of the file. At this time, I recommend you attempt the install using MacPorts by doing sudo port install ettercap-ng, let it fail, then go into the directory containing the macports build source, add the include into the 2 files, then run sudo port install ettercap-ng again, it will succeed and your copy of ettercap should work!

Thanks @ Raim in #macports and dmacks in #fink for helping track this down. You can see the bug here.

Original message below:

This is a continuation of the pthread error that I mentioned in a previous post

I finally got it working natively; you might be familiar with the following error when trying to compile ettercap-ng using either fink or natively:

gcc -DHAVE_CONFIG_H -I. -I. -I../../../../include -I/sw/include -O2 -funroll-loops -fomit-frame-pointer -Wall -I/sw/include -I/sw/include -I/sw/include -I/sw/include -g -O2 -c -o libwdg_a-wdg.o `test -f 'wdg.c' || echo './'`wdg.c
In file included from wdg.c:23:
./wdg.h:189: error: syntax error before 'u_char'
./wdg.h:189: warning: no semicolon at end of struct or union
./wdg.h:190: warning: type defaults to 'int' in declaration of 'border_color'
./wdg.h:190: warning: data definition has no type or storage class
./wdg.h:191: error: syntax error before 'focus_color'
./wdg.h:191: warning: type defaults to 'int' in declaration of 'focus_color'
etc etc, errors go on forever...

Well, after poking around in the code I was able to find where to fix the code so that it would compile. Open the directory src/interfaces/curses/widgets/ and edit the files wdg.c and wdg.h

Change all of the occurrences of “u_char” to “int” in these two files, you should now be able to compile without errors.

DISCLAIMER: I don’t know what kind of effect this will have on the curses interface, it will probably break the curses interface permanently, personally I use the text interface the entire time (so I run configure with --disable-gtk so I don’t have to deal with the hassle of installing the gtk/glib libraries), but at least you are able to compile, right? :P

I’ve tar’d up a patched version of the code and configure script (so you don’t get the pthread error). I am planning on hosting on navi.eight7.org, I will put it up and link to it when I’m able to access the machine (work firewall prevents it).

I’m still getting errors when ettercap tries to forward the packets, but I’m positive they are caused by linking to the wrong version of libnet, that has a different number of arguments to the libnet_write_raw_ipv4() function. If I get a fix I’ll post it here.

About these ads

23 Comments

Filed under apple, arp, compile, ettercap, fix, hacking, leopard, osx, security, sniffing

23 Responses to Compile Ettercap-NG-0.7.3 natively on Leopard Fix

  1. Pingback: How to compile ettercap NG 0.7.3 on Mac OSX when you get that annoying pthread error « :wq

  2. njstaticuser

    there is no wdc.h in the widgets directory. How about explaining where you can get this file?

  3. njstaticuser

    Well adding that #include into the wdg.c file doesnt make any sense, as it is referred ito n the wdg.h file. Now i downloaded the source from ettercap.sourceforge.net and all the dependancies required to run ettercap. I have compiled it before on linux and mac os x prior to leopard and this is the first time that curses breaks. The #include doesn’t solve the problem with running the curses interface. I ran gdb and i got this error:

    Program received signal EXC_BAD_ACCESS, Could not access memory.
    Reason: KERN_PROTECTION_FAILURE at address: 0×00000000
    0x901ecbb4 in memchr ()

    Then I got info of which library memchr() was declared:

    memchr + 54 in section LC_SEGMENT.__TEXT.__text of /usr/lib/libSystem.B.dylib

    Also memchr() is originally declared in /usr/include/string.h I also believe to suspect that pthread is the culprit here. Any suggestions on how to get this working? I would love to use the curses interface. Also get this: I compiled ettercap on Tiger awhile back and it continued on with my leopard installation and worked like a charm. The only original problem is leopard linking pthread to ettercap (you have to do some os variable change in the configure script) because almost every symbol is called dynamically.

  4. njstaticuser: The pthread error I addressed in this post: http://thnetos.wordpress.com/2007/08/10/how-to-compile-ettercap-ng-073-on-mac-osx-when-you-get-that-annoying-pthread-error/

    It *should* still apply to Leopard

    Yea, I do know about the curses interface, unfortunately I’m not hardcore enough to know how to fix it. ^_^

    Hopefully the macports guys come out with a fix soon, but hey, there’s always text mode, right? :)

  5. njstaticuser

    Well THAT error only shows up during compile time, i am referring to the error found in runtime. I will look into it and see if i can come up with a possible solution. In the meantime, i can put together a binary version with text and curses capabilities and distribute it. Let me know if I can do that, cuz it looks like a lot of people are getting frustrated over this silly ordeal. ;)

  6. Felix

    I’m still getting errors during runtime with leopard:

    Felle$ ettercap -T

    ettercap NG-0.7.3 copyright 2001-2004 ALoR & NaGA

    ERROR : 9, Bad file descriptor
    [ec_capture.c:capture_init:116]

    No suitable interface found…

    Any clues to this?

  7. Felix

    Doh…. I forgot about running ettercap as root. Disregard post above.

  8. evilfoo

    Anybody got the curses interface to work? What do i need to do to get the curses interface to work?

  9. ninil

    Hello!
    Please I need help to configure Ettercap NG 0.7.3!
    I have downloaded ettercap for both Windows XP and Unix and I don’t know how to use it!
    if you have any suggestion or links to learn about it, I will be thankfull!

  10. Luminiferous

    Hi, I installed ettercap-ng via Macports, it did not produced any error but i have some doubts,
    If i do this:
    “sudo find / -name “wdg.*” -print”
    it shows nothing, also when i do this:
    sudo ettercap -T -M arp // //
    it says: 0 plugins (disabled by configure…)
    is that normal?
    another thing is that it fails showing this error:
    FATAL: MITM attacks can’t be used on unconfigured interfaces
    thanks in advanced

  11. @Luminiferous,
    It looks like you’ll need to specify that macports build ettercap with plugins. I believe the syntax for this is: “port install ettercap-ng +plugins”

  12. Luminiferous

    Thank you very much it works!! :D :D
    Thanks thanks

  13. ken

    i cant get to make my ettercap work after usin the ettercap to find username and password, it brings out this error on the terminal (Perhaps iptables or your kernel needs to be upgraded.
    iptables v1.4.1.1: can’t initialize iptables table `nat’: Permission denied (you must be root)
    Perhaps iptables or your kernel needs to be upgraded.
    ettercap: ../../src/xcb_io.c:378: _XAllocID: Assertion `ret != inval_id’ failed.
    Aborted) pls how can i make it work and y does it bring out this error….thanks am gratefull expectin ur reply

  14. @ken,
    Are you running it as root, or with sudo? That seems to be what the problem is.

  15. 0pcode

    I’m a complete noob when it comes to compiling. I tried sudo ./configure and it went through a bunch of stuff, but I don’t know what to do after that. Any help? Thanks.

  16. @opcode,
    You’ll need to run ettercap as root, so should do “sudo ettercap ” to run it as root after it’s been installed.

  17. 0pcode

    Crap, now I have a libnet error… What do I do…?

  18. 0pcode

    Nevermind, got it. Thanks, Lee.

  19. ronin

    PLEASE!
    where do I should write this?
    ‘“port install ettercap-ng +plugins”’

    thank you

    • Namhar

      hi

      ronin you type that in the terminal you. and also dont forget to add sudo to get root privilege. so you should type

      ‘“sudo port install ettercap-ng +plugins”’

  20. Namhar

    hi]

    when i try ettercap -G i get GTK support not compiled in ettercap. i installed ettercap via macports can someone please help.

    thanks

  21. Dave

    you call these how to’s?

    Ive been trying to install this using these instructions too: http://ettercap-ng.darwinports.com/

    Also useless. I thought darwin ports was meant to download and compile for you? Well each time I follow the instructions it says ‘No such file or directory.’ People never give proper instructions with these command line apps.

    Anyway…
    I have the ettercap-NG-0.7.3.tar on my desktop… What do I do with it? I cant find any instructions in the folder or on the net.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s