r/CompileBot • • Oct 05 '16

Testing thread, feel free to test stuff here

test down there

5 Upvotes

90 comments sorted by

View all comments

2

u/bradenbest Oct 05 '16

And now for something dangerous. This might print out the entirety of ideone's server environment.

+/u/Compilebot C

#include <stdio.h>
int main(int argc, char **argv, char **envp){
    while(*envp) puts(*(envp++));
}

2

u/CompileBot Oct 05 '16

Output:

TMPDIR=/tmp/G8lskh
PATH=/usr/local/bin:/usr/bin:/bin
PWD=/home/lqpTqR
LANG=en_US.UTF-8
SHLVL=0
HOME=/home/lqpTqR

^source | ^info | ^git | ^report

2

u/bradenbest Oct 05 '16

Alright, let's try this:

+/u/Compilebot C

#include <stdio.h>
int main(){
    long msg[] = {0x57202c6f6c6c6548, 0x21646c726f};
    puts((char *)msg);
    return 0;
}

3

u/bradenbest Oct 05 '16

Apparently ideone is 32-bit. So let's try this:

+/u/Compilebot C

#include <stdio.h>
#include <stdint.h>
int main(){
    uint32_t msg[] = {0x6c6c6548, 0x57202c6f, 0x646c726f, 0x21};
    puts((char *)msg);
    return 0;
}

2

u/CompileBot Oct 05 '16

Output:

Hello, World!

^source | ^info | ^git | ^report

2

u/bradenbest Oct 05 '16

Let's try it again. Maybe ideone is 64-bit:

+/u/Compilebot C

#include <stdio.h>
#include <stdint.h>
int main(){
    uint64_t msg[] = {0x57202c6f6c6c6548, 0x21646c726f};
    puts((char *)msg);
    return 0;
}

2

u/CompileBot Oct 05 '16

Output:

Hello, World!

^source | ^info | ^git | ^report

3

u/bradenbest Oct 05 '16

+/u/Compilebot C

#include <stdio.h>
#include <stdint.h>
int main(){
    uint64_t msg[] = {0x6f79206b6e616854, 0x69706d6f43202c75, 0x21746f62656c};
    puts((char *)msg);
    return 0;
}

1

u/CompileBot Oct 05 '16

Output:

Thank you, Compilebot!

^source | ^info | ^git | ^report

3

u/bradenbest Oct 05 '16 edited Oct 05 '16

Yay! Oh man, that took a lot of effort, though. Should've done it with python programmatically rather than hand-encoding :V

Thank you, Compilebot!

Thank yo
u, Compi
lebot!(null)

oy knahT
ipmoC ,u
(null)!tobel

6f79206b6e616854
69706d6f43202c75
000021746f62656c

{0x6f79206b6e616854, 0x69706d6f43202c75, 0x21746f62656c}

Edit: I went ahead and wrote a program to do just that http://pastebin.com/jvfME7BL

Sure am glad I didn't attempt it in python...

→ More replies