I need some help porting EircomCrack from 1.x.x

Discussion in 'iOS Development' started by jtreanor, Mar 8, 2009.

  1. jtreanor

    jtreanor New Member

    Joined:
    May 17, 2008
    Messages:
    6
    Likes Received:
    0
    Device:
    iPhone
    Hi everyone,

    For the past few days I have been trying to port the "EircomCrack" application from 1.x.x.(the original source and application is available at; http://www.netsoc.tcd.ie/~eoinmcl/content/eircomapp.html).

    I hope this is not breaking any forum rules. I was led to believe it isnt when I spotted the aircrack thread.

    I am porting it using BigBoss's cydia toolchain 2.0. My problem is that after I have modified the source according to BigBoss's instructions(http://cydia.thebigboss.org/moreinfo/Toolchain2.php), it appears to compile without errors. However when I launch the app, it simply hangs on default.png for about 3 seconds and exits.

    I have tried everything I can think of, so I have attached my sourcecode.

    Thank you very much in advance.

    James

    Attached Files:

  2. jtreanor

    jtreanor New Member

    Joined:
    May 17, 2008
    Messages:
    6
    Likes Received:
    0
    Device:
    iPhone
    Update

    I think the problem lies with one of these three files:

    makefile:
    Code:
    CC=arm-apple-darwin9-gcc
    LD=$(CC)
    LDFLAGS=-lobjc -framework CoreFoundation -framework Foundation -framework UIKit -framework CoreGraphics -L"/usr/lib" -F"/System/Library/Frameworks" -F"/System/Library/PrivateFrameworks" -bind_at_load -multiply_defined suppress
    CFLAGS=-I/var/include -redefined_supress
    all:   Eircom  keyViewer
    
    install: Eircom
    	cp Eircom /Applications/EircomCrack.app/Eircom
    	cp keyViewer /Applications/EircomCrack.app/keyViewer
    
    package: all
    	cp Eircom EircomCrack.app/
    	cp keyViewer EircomCrack.app/
    
    keyViewer: ka.o KeyApp.o KeyLabel.o
    	$(LD) $(LDFLAGS) -o $@ $^
    
    Eircom:  eircom.o EircomApplication.o sha1.o eircomCrack.o ka.o KeyApp.o KeyLabel.o sha1.o
    	$(LD) $(LDFLAGS) -o $@ $^
    	/usr/bin/ldid -S Eircom
    
    sha1.o: sha1.c
    	$(CC) -c $(CFLAGS) $(CPPFLAGS) sha1.c -o sha1.o
    
    eircomCrack.o: eircomCrack.c
    	$(CC) -c $(CFLAGS) $(CPPFLAGS) eircomCrack.c -o eircomCrack.o
    
    %.o:    %.m
    	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
    
    
    clean:
    	rm -f *.o Eircom keyViewer

    ka.m:
    Code:
    #import "KeyApp.h"
    
    char *keyS;
    
    int main(int argc, char **argv)
    {
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    	keyS = (char *) malloc(sizeof(char) * 27);
    	FILE *fd = fopen("/tmp/lastEircomKey","r");
    	fscanf(fd,"%26s",keyS);
    	fclose(fd);
    
    	return UIApplicationMain(argc, argv, @"KeyApp", @"KeyApp");
    }
    
    
    eircom.m:
    Code:
    #import <UIKit/UIKit.h>
    
    #import "EircomApplication.h"
    
    int main(int argc, char **argv)
    {
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        return UIApplicationMain(argc, argv, @"EircomApplication", @"EircomApplication");
    }
    
    I have modified the makefile so that it should sign all the output files and I now receive the compile error:
    Code:
    /usr/bin/ld: multiple definitions of symbol _main
    eircom.o definition of _main in section (__TEXT,__text)
    ka.o definition of _main in section (__TEXT,__text)
    collect2: ld returned 1 exit status
    make: *** [Eircom] Error 1
    
    I would greatly appreciate any help you can offer
  3. NolesFans

    NolesFans New Member

    Joined:
    Sep 23, 2008
    Messages:
    404
    Likes Received:
    0
    Device:
    iPod touch
    holy cow!

    1) Why you have two main()?
    2) Check your memory pointers.
  4. jtreanor

    jtreanor New Member

    Joined:
    May 17, 2008
    Messages:
    6
    Likes Received:
    0
    Device:
    iPhone
    Thanks for your reply.
    I may have not made it clear earlier, but the vast majority of this is not my code.
    I'm not the best at obj-C and I just assumed that if the two main functions worked in 1.1.x that it would be fine in 2.x.x as long as I made BigBoss's changes.
    How do I check my memory pointers?
    Any ideas?
  5. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    Your problem is not your Objective-C. Although to be fair, I looked no further than your makefil, so there could still be issues.

    The problem here is that this makefile makes two executable binaries. My guess is that one applicaion runs and calls the other. You are combining the two into one executable.

    Now, if this were to actually finish, you would still have two binaries. Only, everything in the one would also he contained in the second. Hence the "two main functions" error.


    Take a look and you will see exacty what you are doing wrong too. In terminal, you type "make package." The first command of "make package" is "make all.". Also, just typing "make" runs "make all." "Make all" in turn issues two commands, "make Eircom," and make keyViewer."

    Look at the commands for each of those. Notice anything? Fix the mistake that you should now see, recompile, bug fix, and you're set like a sword in stone.
  6. jtreanor

    jtreanor New Member

    Joined:
    May 17, 2008
    Messages:
    6
    Likes Received:
    0
    Device:
    iPhone
    Ok. Thanks alot Skylar I greatly appreciate your help.
    I will try this out and let you know how I got on
    James
  7. NolesFans

    NolesFans New Member

    Joined:
    Sep 23, 2008
    Messages:
    404
    Likes Received:
    0
    Device:
    iPod touch
    Code:
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        keyS = (char *) malloc(sizeof(char) * 27);
        FILE *fd = fopen("/tmp/lastEircomKey","r");
        fscanf(fd,"%26s",keyS);
        fclose(fd);
        int retVal = UIApplicationMain(argc, argv, @"KeyApp", @"KeyApp");
        [pool release];
         return retVal;
    
    i did first one so you do else.
  8. jtreanor

    jtreanor New Member

    Joined:
    May 17, 2008
    Messages:
    6
    Likes Received:
    0
    Device:
    iPhone
    Almost there....I think

    Hi again,

    I have followed all of the above instructions and
    here is my new makefile:
    Code:
    CC=arm-apple-darwin9-gcc
    LD=$(CC)
    LDFLAGS=-lobjc -framework CoreFoundation -framework Foundation -framework UIKit -framework CoreGraphics -L"/usr/lib" -F"/System/Library/Frameworks" -F"/System/Library/PrivateFrameworks" -bind_at_load -multiply_defined suppress
    CFLAGS=-I/var/include -redefined_supress
    all:   Eircom  keyViewer
    
    install: Eircom
    	cp Eircom /Applications/EircomCrack.app/Eircom
    	cp keyViewer /Applications/EircomCrack.app/keyViewer
    
    package: all
    	cp Eircom EircomCrack.app/
    	cp keyViewer EircomCrack.app/
    
    keyViewer: ka.o KeyApp.o KeyLabel.o
    	$(LD) $(LDFLAGS) -o $@ $^
    	/usr/bin/ldid -S keyViewer
    
    Eircom:  eircom.o EircomApplication.o sha1.o eircomCrack.o
    	$(LD) $(LDFLAGS) -o $@ $^
    	/usr/bin/ldid -S Eircom
    
    sha1.o: sha1.c
    	$(CC) -c $(CFLAGS) $(CPPFLAGS) sha1.c -o sha1.o
    
    eircomCrack.o: eircomCrack.c
    	$(CC) -c $(CFLAGS) $(CPPFLAGS) eircomCrack.c -o eircomCrack.o
    
    %.o:    %.m
    	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
    
    
    clean:
    	rm -f *.o Eircom keyViewer
    
    Thanks to NolesFans and SkylarEC, my app now compiles without errors. However, it still hangs for 2-3 seconds on launch.
    Is there some way to detect what caused the crashing of an app.

    I have attached the EircomCrack.app and my updated source code.

    I now have no idea what is wrong, but I think I am very close.

    Thank you so much for your kind help.

    James

    Attached Files:

  9. gleesonger

    gleesonger New Member

    Joined:
    Nov 27, 2008
    Messages:
    40
    Likes Received:
    0
    Device:
    2G iPod touch
    Has there been progress made on this app?More over is it stable under 3.0?
  10. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    Bumps. We don't like them.

Share This Page