;xcalc

On Sun, Jun 19, 2011 at 2:07 AM, DK <divyekap...@gmail.com> wrote:
> Hi Guys/Girls,
>    I've created an interesting question. It's not strictly algorithmic, but
> it's fun:
> Given the following code, hack it to run calc.exe (on windows) or xcalc (on
> linux) or prove that such exploitation is not possible.
> It might or it might not be a simple challenge... but give it a try. :)
> #include <cstring>
> #include <iostream>
> #include <cstdlib>
> #include <cstdio>
> using namespace std;
> class X {
>    public:
>    void run(const char *str) {
>        system(str);
>    }
> };
> int main() {
>    char buf[1024];
>    char newCommand[2048] = "echo ";
>    X* mySystem = new X();
>
>    mySystem->run("echo The DK HackMe Challenge");
>    mySystem->run("echo Please enter a string: ");
>    scanf("%s", buf);
>    mySystem->run("echo You have entered:");
>    strcat(newCommand, buf);
>    mySystem->run(newCommand);
>    return 0;
> }
> Happy hacking!
> (Note: This is the simple version, a tougher version will be coming soon!)
> :)
> --
> DK
> http://twitter.com/divyekapoor
> http://www.divye.in
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/rovyZ8nRJRUJ.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Sanjay Ahuja,
Analyst, Financing Prime Brokerage
Nomura Securities India Pvt. Ltd

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to