Pimps getting creative Pimps getting creative
Page 1 of 4 123 ... LastLast
Posts 1 to 10 of 32
  1. #1

    Nice But Dim

    DaveB is a fount of knowledge

    DaveB's Avatar
    Join Date
    Oct 2005
    Posts
    20,510

    Default Pimps getting creative with code test

    Before you can even apply.

    Solve the code problem and provide the answer or your CV gets binned!

    /*
    If you would like to view this email in your browser please click
    here

    Are you ready for a challenging and
    highly rewarding career in cyber security?

    We have several vacancies that are currently advertised on CyberSecurityJobSite.com.

    1. Call the 'goal' function by providing the correct value of index as a
    parameter
    to the program and note the output.
    2. The missing piece to get the answer is 0xC0D1F1ED. You'll know it's
    right when you see it.
    3. For immediate consideration, apply through CyberSecurityJobSite.com
    with the answer
    in your covering note.
    */
    Code:
    //You may need to install gcc-multilib or similar package for your Linux
    distribution.
    //gcc -m32 chall-stack.c
    #include <stdio.h>
    #include <stdlib.h>
    #define FTBL_LEN 5
    typedef void func_t(int);
    
    void goal(int i) {
        printf("%08x\n", ((i|0x40000000) * 0x31337)^0x2c10c413);
    }
    void try(int i) {
        printf("Incorrect index %d. Keep trying!\n");
    }
    int main (int argc, const char**argv) {
        int i, index;
        func_t *tbl[FTBL_LEN + 1];
        for (i=0;i<FTBL_LEN;++i)
            tbl[i] = try;
        tbl[i] = goal;
        index = strtol(argv[1], NULL, 10);
        if (index >= FTBL_LEN)
            printf("Index too high.\n");
        else
            (*tbl[index])(index);
        return 0;
    }
    Last edited by DaveB; 27th October 2015 at 12:38.
    "Being nice costs nothing and sometimes gets you extra bacon" - Pondlife.

  2. #2

    Potty-trained

    suityou01 is NOT a disguised employee

    suityou01's Avatar
    Join Date
    Jan 2009
    Location
    Skid row
    Posts
    21,071

    Default

    I'm not even sure that would compile. The function try takes one argument.

    Edit: Unless tbl is an array of function pointers to try.

    In any case, then the try function will always say the same thing as the printf has a placeholder and no variable so will always print 0?
    Last edited by suityou01; 27th October 2015 at 14:11.
    Knock first as I might be balancing my chakras.

  3. #3

    Banned

    FatLazyContractor is NOT a disguised employee


    Join Date
    Sep 2014
    Location
    In NLyUK's knickers
    Posts
    7,799

    Default

    I compiled it and the result is as below:

    F3CK 0FF P33-1-M-PEE

  4. #4

    Potty-trained

    suityou01 is NOT a disguised employee

    suityou01's Avatar
    Join Date
    Jan 2009
    Location
    Skid row
    Posts
    21,071

    Default

    Quote Originally Posted by FatLazyContractor View Post
    I compiled it and the result is as below:
    Knock first as I might be balancing my chakras.

  5. #5

    Contractor Among Contractors

    _V_ is NOT a disguised employee

    _V_'s Avatar
    Join Date
    Aug 2006
    Posts
    1,479

    Default

    Don't tell me, permie job at GCHQ, £30K p.a.
    We're all Crypto Millionaire's, now Dave...

  6. #6

    Nice But Dim

    DaveB is a fount of knowledge

    DaveB's Avatar
    Join Date
    Oct 2005
    Posts
    20,510

    Default

    Quote Originally Posted by _V_ View Post
    Don't tell me, permie job at GCHQ, £30K p.a.
    Nope,

    The European tentacle of a a large Chinese tech corporation.
    "Being nice costs nothing and sometimes gets you extra bacon" - Pondlife.

  7. #7

    Potty-trained

    suityou01 is NOT a disguised employee

    suityou01's Avatar
    Join Date
    Jan 2009
    Location
    Skid row
    Posts
    21,071

    Default

    Quote Originally Posted by DaveB View Post
    Nope,

    The European tentacle of a a large Chinese tech corporation.
    So he got the salary bit right then
    Knock first as I might be balancing my chakras.

  8. #8

    Fingers like lightning

    NibblyPig is a permanent contractor

    NibblyPig's Avatar
    Join Date
    Apr 2013
    Posts
    666

    Default

    Quote Originally Posted by suityou01 View Post
    That site checks the referrer url to display images, which made your post unintentionally more funny

    Unless you're the lead dog, the scenery never changes.

    Currently 10+ contracts available in your area

  9. #9

    Potty-trained

    suityou01 is NOT a disguised employee

    suityou01's Avatar
    Join Date
    Jan 2009
    Location
    Skid row
    Posts
    21,071

    Default

    Quote Originally Posted by NibblyPig View Post
    That site checks the referrer url to display images, which made your post unintentionally more funny

    It works fine for everyone else which makes your post funnier still.
    Knock first as I might be balancing my chakras.

  10. #10

    My post count is Majestic

    NickFitz has reached the peak. Play again?

    NickFitz's Avatar
    Join Date
    Jun 2007
    Location
    Your local branch
    Posts
    49,606

    Default

    Quote Originally Posted by suityou01 View Post
    It works fine for everyone else which makes your post funnier still.
    Broken for me

Posting Permissions

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