• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Pimps getting creative

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Pimps getting creative

    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; 27 October 2015, 12:38.
    "Being nice costs nothing and sometimes gets you extra bacon" - Pondlife.

    #2
    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; 27 October 2015, 14:11.
    Knock first as I might be balancing my chakras.

    Comment


      #3
      I compiled it and the result is as below:

      F3CK 0FF P33-1-M-PEE

      Comment


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

        Comment


          #5
          Don't tell me, permie job at GCHQ, £30K p.a.
          First Law of Contracting: Only the strong survive

          Comment


            #6
            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.

            Comment


              #7
              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.

              Comment


                #8
                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

                Comment


                  #9
                  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.

                  Comment


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

                    Comment

                    Working...
                    X