New to compiling code. Need some insite.

Discussion in 'Mac Programming' started by MikeSantor, Feb 1, 2010.

  1. MikeSantor macrumors regular

    Joined:
    Jun 9, 2009
    Location:
    Chicago, Dirty South.
    #1
    So I have to admit, for years I have used small freeware programs and never understood why they gave the Binaries (which is obviously the one I would always download) and the source code.

    So fast forward to an hour ago. I set up a small network at my house with a few old machines. I have been messing around with different network options and have been playing with remote desktop. That let me to the subject of security. I decided to start messing with a program that I got semi interested in about a year ago but never did much with it call Hydra. Its basicly a brute force cracking program for all different kinds of platforms.

    *Side Note, I have been a Mac user for all of about 6 months. Im still learning a lot about the OS platform.

    So as I read through Hydra's webpage I noticed that it could run on OS X but I could not find the .dmg file. Thats where it got interesting. this is what I found in the readme for the program:

    For your pleasure, Hydra comes as source and binary release.

    1. The source code of Hydra: hydra-5.4-src.tar.gz
    (compiles on all UNIX based platforms - even MacOS X, Cygwin on Windows, ARM-Linux, etc.)


    2. The Win32/Cywin binary release: hydra-5.4-win.zip
    (everything you need to run hydra on win32 platforms is in this zip file)

    4. The ARM binary release: hydra-5.0-arm.tar.gz (soon updated)
    (created by tick (at) thc (dot) org - everything except SAP R/3 is supported,
    runs on all Handhelds with ARM processors running Linux, e.g. iPaq, Zaurus, etc.)

    3. The Palm binary release: hydra-4.6-palm.zip
    (created by snakebyte (at) gmx (dot) de - does not support all attack modules yet)
    [NOTE: the Palm release has got a different source tree. Therefore not all]
    [ modules are supported, and updates are not very often. ]


    So the more and more I read I finally started to realize what the point of all the source codes I saw over the years were for. So far this is what I got out of it.

    -I need a program called Xcode to run the script
    -I need a program called macports for I dont know what.

    I Downloaded the macports program and installed it. Im currently downloading the Xcode program from the apple dev site.

    I guess my question is a little vague. What should someone that dosnt have any background in programming expect once xcode is done downloading? does it take much knowlege to simply run a script with xcode? how does macports tie into xcode? I read the basics of what macports is, just a way to compile code across platforms. This really dosnt mean anything to someone with no background in coding.

    I guess any information on the specific subject of getting a program code to compile or the similar would be much appreciated. Thanks in advance.
     
  2. jpyc7 macrumors 6502

    Joined:
    Mar 8, 2009
    Location:
    Denver, CO
    #2
    Xcode is an application in the general category of "Integrated Development Environment" or IDE that provides a way to edit, compile, link, run, and debug programs. So it means you won't be "running a script with xcode" (but I'm not really sure what you mean by that phrase). I'll explain some of the other words later.

    I only have a vague idea that macports provides a way to download dependencies for your programs, but maybe someone else can say if I'm wrong. I don't know about its other capabilities.

    Basically, compiling is a way to transform source code written in a programming language that often uses English words and other symbols into another format understood by the machine (called machine language and generally represented as a sequence of integers).

    The process of building an application, e.g. Hydra, includes compiling but also the linking step. This is where dependencies come in. Linking means to attach some other software (called a library) to the compiled code so that they can work together. The program is said to be dependent on libraries and so the libraries are also called dependencies.

    Depending on the quality and completeness of the instructions included with Hydra, you might be able to make the application from its source code using Xcode. Otherwise, you can look into Xcode tutorials to better understand the steps.
     
  3. MikeSantor thread starter macrumors regular

    Joined:
    Jun 9, 2009
    Location:
    Chicago, Dirty South.
    #3
    Thanks for the info. That defiantly gives me a lot more incite on some key terms. the think i dont understand is it sounds like it takes a lot of steps to get a program running with just its source code but the instructions on how to run Hydra are a few small steps:

    http://hydra.darwinports.com/

    Its been a long day at work (7am monday to 12:35am tuesday and im still here...) So i have not gotten a chance to mess with xcode, macports, or hydra yet. After I get home and get some sleep Im going to try getting hydra to work on the Mac.
     
  4. adizam macrumors newbie

    Joined:
    Feb 2, 2010
    #4
    Sounds like someone wants to read the contents of their girlfriends email :p.

    You get it working? I've never compiled Hydra under MacOSX but I've compiled it plenty of times in normal Linux environments so I imagine it wouldn't be all that different.
     
  5. MikeSantor thread starter macrumors regular

    Joined:
    Jun 9, 2009
    Location:
    Chicago, Dirty South.
    #5
    Haha, Naw, my fiancee is the type of person that has ILOVEMIKE as ALL of her passwords.... Not to mention If she wanted to do something she wasn't supposed to that would be fine by me. That would be a lot more cash in my pocket!

    :D

    Anyways, like I said I worked a 20 hour day yesterday at work and im back again. Had to blast the whole server at work and reinstall everything. So now I get to sit here and try and get hydra to work with no real clue as to what im doing.

    adizam, shouldn't have told me you have done this before. You are destined to get n00b questions PMs now...

    Ill let everyone know how it goes in a bit.



    EDIT 1

    So this is the very short instructions on how to get this running on UNIX machines.

    "HOW TO USE
    ----------
    Type "./configure", followed by "make" to compile hydra and then
    "./hydra -h" to see the command line options.
    You make also type "make install" to install hydra to /usr/local/bin.
    Note that NO login/password file is included. Generate them yourself.
    For Linux users, a GTK gui is available, try "./xhydra"
    "

    Im doing this in the terminal with no results. What am I missing?
     
  6. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #6
    Exactly which step is giving no results?

    Do any messages appear in the Terminal window? If so, copy and post them (don't paraphrase).
     
  7. lloyddean macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #7
    Install "MacPorts" which has a working 'hydra' version 5.4.

    Installation of 'hydra' would then be done at the terminal with:

    Code:
    sudo port install hydra
    MacPort knows the dependancies and will fetch, compile and link each in turn to provide a runnable command line executable.
     
  8. MikeSantor thread starter macrumors regular

    Joined:
    Jun 9, 2009
    Location:
    Chicago, Dirty South.
    #8
    When I try the first thing, "./configure" I get:

    Mike-Santors-MacBook-Pro:~ Zion$ ./configure
    -bash: ./configure: No such file or directory
    Mike-Santors-MacBook-Pro:~ Zion$

    (Dont laugh, im a "MATRIX" geek...)

    When I try "./configure" fallowed by "make" I get :

    Mike-Santors-MacBook-Pro:~ Zion$ ./configure make
    -bash: ./configure: No such file or directory
    Mike-Santors-MacBook-Pro:~ Zion$

    So on and so forth...



    I did this code in terminal and got:

    Mike-Santors-MacBook-Pro:~ Zion$ sudo port install hydra
    Password:
    dlopen(/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib, 10): no suitable image found. Did find:
    /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib: no matching architecture in universal wrapper
    while executing
    "load /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib"
    ("package ifneeded Pextlib 1.0" script)
    invoked from within
    "package require Pextlib 1.0"
    (file "/opt/local/bin/port" line 40)


    *Note, I put in the administrator password when prompted.



    EDIT, Xcode and macports are installed on my SSD boot drive, the files for hydra are on my other HD. Im assuming I would have to change the code to tell it to look in the other HD?
     
  9. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #9
    Macports will handle everything. You won't use Xcode, and you don't need the Hydra source code, which Macports will fetch, configure, make and install. Is your Macports installation current?

    In Terminal, do

    sudo port selfupdate

    Then do

    port info hydra

    Code:
    I see this:
    
    hydra @5.4, Revision 2 (security, net)
    Variants:             universal, xhydra
    
    Description:          Hydra is a parallelized logon cracker utility. Hydra can
                          brute force attack on FTP, POP3, IMAP, Telnet, HTTP Auth,
                          NNTP, VNC, ICQ, Socks5, PCNFS and more services within SSL
                          support.
    Homepage:             http://www.thc.org/thc-hydra
    
    Library Dependencies: openssl, libssh01
    Platforms:            darwin
    License:              unknown
    Maintainers:          nomaintainer@macports.org
    
    
    Then try

    port clean --dist hydra

    followed by

    sudo port -v install hydra
     
  10. MikeSantor thread starter macrumors regular

    Joined:
    Jun 9, 2009
    Location:
    Chicago, Dirty South.
    #10
    Mike-Santors-MacBook-Pro:~ Zion$ sudo port selfupdate
    Password:
    dlopen(/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib, 10): no suitable image found. Did find:
    /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib: no matching architecture in universal wrapper
    while executing
    "load /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib"
    ("package ifneeded Pextlib 1.0" script)
    invoked from within
    "package require Pextlib 1.0"
    (file "/opt/local/bin/port" line 40)



    Mike-Santors-MacBook-Pro:~ Zion$ port info hydra
    dlopen(/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib, 10): no suitable image found. Did find:
    /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib: no matching architecture in universal wrapper
    while executing
    "load /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib"
    ("package ifneeded Pextlib 1.0" script)
    invoked from within
    "package require Pextlib 1.0"
    (file "/opt/local/bin/port" line 40)



    Mike-Santors-MacBook-Pro:~ Zion$ port clean --dist hydra
    dlopen(/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib, 10): no suitable image found. Did find:
    /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib: no matching architecture in universal wrapper
    while executing
    "load /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib"
    ("package ifneeded Pextlib 1.0" script)
    invoked from within
    "package require Pextlib 1.0"
    (file "/opt/local/bin/port" line 40)



    Mike-Santors-MacBook-Pro:~ Zion$ sudo port -v install hydra
    dlopen(/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib, 10): no suitable image found. Did find:
    /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib: no matching architecture in universal wrapper
    while executing
    "load /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib"
    ("package ifneeded Pextlib 1.0" script)
    invoked from within
    "package require Pextlib 1.0"
    (file "/opt/local/bin/port" line 40)



    Same thing came back on all the commands?


    Thanks for all the help so far guys:D
     
  11. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #11
    Did you download the right version of MacPorts for your system? What is your OS version? 10.5 or 10.6?

    If I were you I'd uninstall MacPorts (http://guide.macports.org/#installing.macports.uninstalling)

    and reinstall it using the .dmg . Once you get a working Macports installing Hydra should be mechanical.
     
  12. MikeSantor thread starter macrumors regular

    Joined:
    Jun 9, 2009
    Location:
    Chicago, Dirty South.
    #12
    To be honest I already deleted the dmg so i have no idea what version I got. Im on the latest version of 10.6 though. Im going to try unistalling as you suggested right now. Thanks again guys!

    EDIT

    NOW were getting somewhere. Well, Kinda...

    So I uninstalled macports, installed the newest one, 1.8.2 and ran the dmg. I used the "sudo port selfupdate" command and it came back that i was all updated and ready to go.

    I ran the "port info hydra" command and it came back what it was supposed to;

    hydra @5.4, Revision 2 (security, net)
    Variants: universal, xhydra

    Description: Hydra is a parallelized logon cracker utility. Hydra can
    brute force attack on FTP, POP3, IMAP, Telnet, HTTP Auth,
    NNTP, VNC, ICQ, Socks5, PCNFS and more services within SSL
    support.
    Homepage: http://www.thc.org/thc-hydra

    Library Dependencies: openssl, libssh01
    Platforms: darwin
    License: unknown
    Maintainers: nomaintainer@macports.org



    Thats when the luck ran out. when I run the "sudo port install hydra" command I get this:

    Mike-Santors-MacBook-Pro:~ Zion$ sudo port install hydra
    ---> Computing dependencies for hydra
    ---> Fetching zlib
    ---> Attempting to fetch zlib-1.2.3.tar.bz2 from http://www.zlib.net/
    ---> Attempting to fetch zlib-1.2.3.tar.bz2 from http://distfiles.macports.org/zlib
    ---> Verifying checksum(s) for zlib
    ---> Extracting zlib
    ---> Applying patches to zlib
    ---> Configuring zlib
    ---> Building zlib
    Error: Target org.macports.build returned: can't read "build.cmd": Failed to locate 'make' in path: '/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' or at its MacPorts configuration time location, did you move it?
    Error: The following dependencies failed to build: libssh01 openssl zlib
    Error: Status 1 encountered during processing.
    Before reporting a bug, first run the command again with the -d flag to get complete output.


    We are getting closer...

    Im thinking it has to do with where macports is at? being new to OS X as well as coding i dont even know how to find where macports is installed. The only reason I miss windows is because I actuall new how to run it...

    Thanks again guys!!!
     
  13. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #13
    OK. Macports is now OK. You need to reinstall the Developer Tools (the .dmg you got from Apple containing Xcode). At least that's what some Googling suggests:

     
  14. MikeSantor thread starter macrumors regular

    Joined:
    Jun 9, 2009
    Location:
    Chicago, Dirty South.
    #14
    That worked LPZ!

    Thanks so much to everyone that contributed. I learned a lot the last 24 hours. Now That I (kinda) know how to run these unix binaries im going to see what else I can get running on this. Thanks again!
     
  15. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #15
    You're welcome. Enjoy.
     
  16. Silverbird0000 macrumors 6502a

    Joined:
    Sep 19, 2006
    Location:
    Fort Myers, FL
    #16
    Bringing an old thread back to life. I ran macports and it installed Hydra. But how do I launch Hydra?
     
  17. Ri-dog macrumors newbie

    Joined:
    Jan 17, 2013
    Location:
    Healy, AK
    #17
    I would like to know as well :)
     
  18. robvas macrumors 68020

    Joined:
    Mar 29, 2009
    Location:
    USA
    #18
    It should put a command in /opt/ocal/bin

    If you are using homebrew it puts it in:

    /usr/local/Cellar/hydra/7.3/bin/hydra

    That said it appears homebrew has a much newer version than macports (7.3 vs 5.4)
     
  19. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #19
    Quote from the General usage and options :

    Info : http://www.aldeid.com/wiki/Thc-hydra
     
  20. TristanShakey macrumors newbie

    Joined:
    Aug 3, 2013
    #20
    So I am able to go as far as the command "sudo port -v install hydra" then this is what comes up... any suggestions?


    tristanearesmbp:~ mattwillems$ sudo port -v install hydra
    Password:
    ---> Computing dependencies for hydra..........
    ---> Dependencies to be installed: libssh01 openssl zlib xz gettext expat libiconv gperf ncurses
    ---> Extracting expat
    ---> Extracting expat-2.1.0.tar.gz
    sh: /usr/bin/gnutar: No such file or directory
    gzip: error writing to output: Broken pipe
    gzip: /opt/local/var/macports/distfiles/expat/expat-2.1.0.tar.gz: uncompress failed
    Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_textproc_expat/expat/work" && /usr/bin/gzip -dc '/opt/local/var/macports/distfiles/expat/expat-2.1.0.tar.gz' | /usr/bin/gnutar --no-same-owner -xf -
    Exit code: 127
    Error: org.macports.extract for port expat returned: command execution failed
    Warning: targets not executed for expat: org.macports.activate org.macports.extract org.macports.patch org.macports.configure org.macports.build org.macports.destroot org.macports.install
    Error: Failed to install expat
    Please see the log file for port expat for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_textproc_expat/expat/main.log
    Error: The following dependencies were not installed: libssh01 openssl zlib xz gettext expat libiconv gperf ncurses
    To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
    Error: Processing of port hydra failed
    tristanearesmbp:~ mattwillems$ sudo nano -w /System/Library/CoreServices/SystemVersion.plist
     
  21. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #21
    You need gnutar in /usr/bin so it would be best to install it. It might be in a different location on your system. You can check where it is with :

    Code:
    Aldebaran:~ test$ whereis gnutar
    /usr/bin/gnutar
     
  22. Masterace macrumors newbie

    Joined:
    Nov 5, 2013
    #22
    Help

    I know this thread is dead but help me please.

    Nicks-Mac:~ USERNAME$ port clean --dist hydra
    ---> Cleaning hydra
    Warning: Only cleaning in ~/.macports; insufficient privileges for standard locations
    Nicks-Mac:~ USERNAME$ sudo port -v install hydra
    Password:
    ---> Computing dependencies for hydra.............
    ---> Dependencies to be installed: libssh cmake pcre autoconf m4 perl5 perl5.12 gdbm automake bzip2 libedit libtool
    ---> Configuring cmake
    ---------------------------------------------
    CMake 2.8.12, Copyright 2000-2012 Kitware, Inc.
    C compiler on this system is: /usr/bin/clang -pipe -Os -arch x86_64
    C++ compiler on this system is: /usr/bin/clang++ -pipe -Os -arch x86_64
    Makefile processor on this system is: make
    /usr/bin/clang++ is GNU compiler
    /usr/bin/clang++ has setenv
    /usr/bin/clang++ has unsetenv
    /usr/bin/clang++ does not have environ in stdlib.h
    /usr/bin/clang++ has STL in std:: namespace
    /usr/bin/clang++ has ANSI streams
    /usr/bin/clang++ has streams in std:: namespace
    /usr/bin/clang++ has sstream
    /usr/bin/clang++ has operator!=(string, char*)
    /usr/bin/clang++ has stl iterator_traits
    /usr/bin/clang++ has standard template allocator
    /usr/bin/clang++ has allocator<>::rebind<>
    /usr/bin/clang++ does not have non-standard allocator<>::max_size argument
    /usr/bin/clang++ has stl containers supporting allocator objects
    /usr/bin/clang++ has header cstddef
    /usr/bin/clang++ requires template friends to use <>
    /usr/bin/clang++ supports member templates
    /usr/bin/clang++ has standard template specialization syntax
    /usr/bin/clang++ has argument dependent lookup
    /usr/bin/clang++ does not have struct stat with st_mtim member
    /usr/bin/clang++ has ios::binary openmode
    /usr/bin/clang++ has ANSI for scoping
    ---------------------------------------------
    make: `cmake' is up to date.
    loading initial cache file /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-2.8.12/Bootstrap.cmk/InitialCacheFlags.cmake
    -- The C compiler identification is Clang 5.0.0
    -- The CXX compiler identification is Clang 5.0.0
    CMake Error at Modules/Platform/Darwin.cmake:211 (message):
    CMAKE_OSX_DEPLOYMENT_TARGET is '10.9' but CMAKE_OSX_SYSROOT:

    ""

    is not set to a MacOSX SDK with a recognized version. Either set
    CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to
    empty.
    Call Stack (most recent call first):
    Modules/CMakeSystemSpecificInformation.cmake:36 (include)
    CMakeLists.txt:14 (project)


    -- Configuring incomplete, errors occurred!
    See also "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-2.8.12/CMakeFiles/CMakeOutput.log".
    ---------------------------------------------
    Error when bootstrapping CMake:
    Problem while running initial CMake
    ---------------------------------------------
    Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-2.8.12" && ./configure --prefix=/opt/local --mandir=/share/man --docdir=/share/doc/cmake --parallel=4 --init=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-2.8.12/macports.cmake
    Exit code: 11
    Error: org.macports.configure for port cmake returned: configure failure: command execution failed
    Warning: targets not executed for cmake: org.macports.activate org.macports.configure org.macports.build org.macports.destroot org.macports.install
    Error: Failed to install cmake
    Please see the log file for port cmake for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/main.log
    Error: The following dependencies were not installed: libssh cmake pcre autoconf m4 perl5 perl5.12 gdbm automake bzip2 libedit libtool
    To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
    Error: Processing of port hydra failed

    What can I do to fix this?
     
  23. robvas macrumors 68020

    Joined:
    Mar 29, 2009
    Location:
    USA
    #23
    Looks like that port may need updated for Mavericks.

    Why aren't you guys just running a Linux VM in VirtualBox and then using these types of programs from there? Much easier...
     

Share This Page