Results 1 to 5 of 5

Thread: Help with compiling a C program for the SPIKE API.

  1. #1
    Just burned his ISO CharlesS's Avatar
    Join Date
    May 2011
    Location
    WA state USA
    Posts
    11

    Thumbs up Help with compiling a C program for the SPIKE API.

    *****environment Info******
    x64 AMD CPU running Vista
    Spike is version 2.9
    gcc is version 4.4.3.
    Backtrack 5 KDE in VMplayer3
    the ISO's MD5 checks out.
    ***********************

    Hello everyone and thanks for having me.

    I'm sorry in advance for asking a question for what is more than likely a basic Linux or gcc problem. I have read the forum rules and I know that general problems like this are not exactly welcome here because a person should have this knowledge before attempting to use backtrack. (I myself have actually found backtrack much easier to use than other Linux distros) The reason I have decided to ask for help here, even while knowing the above is because I can be sure a backtrack user knows how to use gcc and write c code for SPIKE, but the same can't necessarily be said for members of a general gcc/c/Linux forum. And even though I have no intention of doing any thing illegal. I can't be sure a general Linux or gcc forum is going to help me with an API that is really only used for hacking/pentesting. But then again, who knows. Either way I risk getting yelled at, so it might as well be by you here. You who are prolly not going to try to put me in jail or report me do to misunderstandings or suspicions.

    Anyway, what I am trying to do is compile a modified version of one of the supplied *.c files in the src directory of spike and I'm not exactly sure what I'm doing. I'm fairly sure my problem is actually not properly understanding gcc and c in general and not a problem with backtrack, SPIKE, or the way gcc is installed. So it's probably not a bug or misconfiguration.

    Basically, if I try to just copy+paste/rename any of the spike supplied .c files and then in Konsole run the command...

    Code:
    gcc <filename.c>
    I get errors saying the header files are not found. So, after much Googleing and reading and still not knowing how to tell gcc where the spike include folder is at. I opted to just move the .c file from the source folder into the include folder and run the above command again from there. This fixed the first problem, but this time I get new errors...

    Code:
    /tmp/ccPPBZjx.o: In function 'main':
    <file.c>:(.text+0xadb): undefined reference to '<function>'
    ...
    ...
    <file.c>:(.text+0xbc9): undefined reference to '<function>'
    Now <file.c> is the name of the copied+pasted or renamed file. And <function> is one of the prototypes in the header spike.h such as "new_spike" or "setspike" . And assuming I have all the terminology right, I believe this means they are not being “declared” properly, correct? Does this mean the header spike.h is not working? The offending lines have calls to <function> in the form of...

    Code:
    spike_clear();
    And after seeing this I did more Googleing and reading and decided to add the difference between what was in the spike.h header to the offending lines, so...

    Code:
    spike_clear();
    Now becomes...

    Code:
    int spike_clear();
    This has had limited success with the simple things like "spike_clear" or "s_fd_wait", but is not working out for the more complex ones like "setspike". This is when Googleing and reading completely fails me as I'm not exactly sure what I'm looking for. I'm thinking there is a command line switch for gcc that fixes this right? or maybe it has something to do with the make file in spike or something? IDK, but this is the point where I decided I need professional help. (errr, programing not psychiatric) Just to much info to sift through that I don't understand. I only need to know this one stupid little thing for now. And I don't feel I should have to read the entire gcc manual or millions of Linux books just to figure it out. So, I'm scared, confused, cold, and alone... any help would be much appreciated.

    Thank you for your time.
    -Charlie
    Last edited by CharlesS; 06-09-2011 at 02:03 PM. Reason: Spelling Error.

  2. #2
    Administrator sickness's Avatar
    Join Date
    Jan 2010
    Location
    Behind the screen.
    Posts
    2,921

    Default Re: Help with compiling a C program for the SPIKE API.

    Well this is really a general question not related to Backtrack.
    Don't mind me asking but:

    1. Why would you modify the original .c files from SPIKE (as they all work well) ?
    2. Do you have the necessary knowledge in C to modify them ?
    Back|track giving machine guns to monkeys since 2007 !

    Do not read the Wiki, most your questions will not be answered there !
    Do not take a look at the: Forum Rules !

  3. #3
    Just burned his ISO CharlesS's Avatar
    Join Date
    May 2011
    Location
    WA state USA
    Posts
    11

    Default Re: Help with compiling a C program for the SPIKE API.

    Hi sickness.

    Thanks for helping me proper and not just immediately biting my head off for asking a "n00bish nonbacktrack question". I really appreciate it.

    Well this is really a general question not related to Backtrack.
    Yup yup... I fully realized that this was a non-backtrack specific issue and I'm sorry for having put it on you here when there is possibly somewhere else I could have gone. And I'm not trying to be a smart ass here, but I feel this issue is highly backtrack related do to the fact that all backtrack really is (as I understand) is a customized linux distro with all the best pentest tools pre-installed... am I wrong? If not then honestly, what really is a "backtrack only issue"? I suppose it could be said that backtrack is "greater than the sum of it's parts" but I rarely read about problems with backtrack that are not in fact, a problem with either just linux, or just one of the pentesting tools. But then again, I do fully understand that you guys get over 9000 posts a day asking what "file or directory not found" means. And that there are way better places to ask for help with those sort of errors then to do so here. On a scale of 0-10, I think at the very least the relation to backtrack of my question is a 2... not a 0.

    Don't mind me asking but:

    1. Why would you modify the original .c files from SPIKE (as they all work well) ?
    2. Do you have the necessary knowledge in C to modify them ?
    I don't mind you asking, your trying to understand my problem so you can best help me. And I appreciate the help very much. And there are no wrong questions as far as I'm concerned. So anyway... to initially answer both of these questions I would say it is mostly that I would like to learn how it all works. Both C and the SPIKE api. I currently have no other reason to learn C other than to learn SPIKE, so any thing that pertains to C that doesn't have to do with SPIKE is irrelevant to me IMO. It may be that this changes in the future. But that is not the case right now.

    Specifically what I had in mind with modifying the .c files is that there are certain obscure and complex network applications I would like to fuzz (I have already done some tutorials using whats already made to actually fuzz programs, so I know how to fuzz some what). And If I simply take one of the C files as an example, and modify it to work with something else, I feel I would gain a better insight into what precisely is going on and thus what is necessary to know to be able to use SPIKE for obscure applications by ones self. Right now I want to be able to handle encryption and CRC checksums on UDP data, Which is the one thing SPIKE can't do out of the box with out custom code (as far as I know).

    As for knowing C. you really got me there. I have almost no knowledge in that language (I do have the routines mentioned above though). That's not to say I don't know how to write any code, I know a bit about assembly for a few different architectures including x86. And I have played with Basic, perl, python, and in fact C,C++. And I'm also fairly smart, if not for a bit inexperienced. So I will learn fast. And I really only need to do this one thing for now. So I feel there is no real justification to go read a whole library of C books when all I may ever do is write SPIKE fuzzers with C. Not to say it is not a great language or a good skill to have. And as you said, you do require some C knowledge to use SPIKE. I just figured that I could be more efficient with my time if I only study C as far as it pertains to SPIKE and my particular project. Plus It should be less confusing with all the clutter out of the way. "Be a LASER beam, not a flash light" is the idea. But in order to learn the necessary C and only the necessary C, I need to figure out what necessary is. To do that, I probably am going to need to trial and error SPIKE, Right? Or get some one to hold my hand and point the way.

    Anyway, If I made an error or should in fact look else where for help on this, then I'm sorry for bothering you. Let me know what you think. Thanks
    -Charlie
    Last edited by CharlesS; 06-16-2011 at 03:07 PM. Reason: Fixed some errors, tried to make some things more clear.

  4. #4
    Just burned his ISO CharlesS's Avatar
    Join Date
    May 2011
    Location
    WA state USA
    Posts
    11

    Default Re: Help with compiling a C program for the SPIKE API.

    So it's been a while... Any help on this? Anyone? Anything at all?

    Seriously I have tried things every different way I can think of and I am still getting no where. Should I ask the creators of spike for help? Should I go to some other forum? This should be a simple problem to fix if I just knew more about where to start. I have read every thing I could get my hands on regarding gcc and the answer to this slips threw the cracks some where. I need better documentation. Or help.

    Also, I didn't choose to start doing this lightly so I'm not going to give up easily. But I'm also not trying to make things difficult for anyone either. There is just some info I need and Google + reading is not providing it. And even though this is not necessarily a spike or back|track issue, other forums don't have the pentesting specialists knowledge to best help me. Id prefer some one who did. Plus that cuts out all the questions and answers regarding "hacking" and gets right to business. If it weren't spike we were talking about, id most likely have started with a different forum.

    So if some one could hit me back with just a few lines, links, thoughts, Id really appreciate it.
    Thanks.
    -Charlie

  5. #5
    Good friend of the forums scottm99's Avatar
    Join Date
    Feb 2010
    Location
    underwater
    Posts
    371

    Default Re: Help with compiling a C program for the SPIKE API.

    I, too, recently had a need to recompile spike. This blog posting did the trick for me. However, I'm not sure that this will apply for your instance. I needed to change spike.c to return a non-zero return code when trying to send data to a closed socket. This helped me when using wrapper scripts with spike.
    If I could figure out how to scuba dive & hack at the same time, there would be nothing I couldn't do...

Similar Threads

  1. Replies: 2
    Last Post: 10-22-2011, 01:37 AM
  2. Spike
    By deStan in forum BackTrack 5 Beginners Section
    Replies: 4
    Last Post: 05-25-2011, 11:23 AM
  3. can anyone give a spike fuzzing example ?
    By bluerratiq in forum OLD Tutorials and Guides
    Replies: 0
    Last Post: 04-03-2009, 03:38 PM
  4. need help compiling raw sniffer
    By viljokid in forum OLD Newbie Area
    Replies: 8
    Last Post: 02-19-2009, 02:12 PM
  5. Compiling airpwn 1.3 help
    By mcwizard in forum OLD Newbie Area
    Replies: 3
    Last Post: 04-29-2008, 06:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •