Jump to content

z0n1n0z

Members
  • Posts

    12
  • Joined

  • Last visited

Posts posted by z0n1n0z

  1. I'm writing you another note that might be useful. I modified the bash script again like this and it works perfectly:

    #!/bin/bash
    
    exec 2>&1
    echo -e "Content-type: text/plain\n"
    /usr/bin/g++ test.cpp -o test.cgi

    so, to compile a c++ program

    • it's better to use `/usr/bin/g++`
    • it is not necessary to use the "absolute" path, the "relative" one is sufficient, which is simpler and safer, because it does not reveal to the users their chroot in the server system

    Greetings

  2. I tried your suggestion literally and got this response in the browser:

    /tmp/ccKDTXpt.o: In function `main':
    test.cpp:(.text+0xa): undefined reference to `std::cout'
    test.cpp:(.text+0xf): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
    test.cpp:(.text+0x19): undefined reference to `std::cout'
    test.cpp:(.text+0x1e): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
    test.cpp:(.text+0x28): undefined reference to `std::cout'
    test.cpp:(.text+0x2d): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
    test.cpp:(.text+0x37): undefined reference to `std::cout'
    test.cpp:(.text+0x3c): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
    test.cpp:(.text+0x46): undefined reference to `std::cout'
    test.cpp:(.text+0x4b): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
    test.cpp:(.text+0x55): undefined reference to `std::cout'
    test.cpp:(.text+0x5a): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
    test.cpp:(.text+0x64): undefined reference to `std::cout'
    test.cpp:(.text+0x69): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
    test.cpp:(.text+0x73): undefined reference to `std::cout'
    test.cpp:(.text+0x78): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
    test.cpp:(.text+0x82): undefined reference to `std::cout'
    test.cpp:(.text+0x87): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
    /tmp/ccKDTXpt.o: In function `__static_initialization_and_destruction_0(int, int)':
    test.cpp:(.text+0xb5): undefined reference to `std::ios_base::Init::Init()'
    test.cpp:(.text+0xc4): undefined reference to `std::ios_base::Init::~Init()'
    collect2: error: ld returned 1 exit status

    then i tried to use `/usr/bin/g++` and it worked great!

    thank you for everything (to quote the dolphins=aliens from the "hitchhiker's guide to the galaxy", «thanks for all the fish!») I insisted a little because I had intuition that something was wrong and that it would be useful for you so we have the solution :)

     

  3. Not yet: as I already said, in fact

    Quote

    the files in /bin/ and /usr/bin/ are the same

     

    which means that

    /usr/bin/gcc

    also doesn't exist, like all the files that should be in `/usr/bin/`, because instead of `/usr/bin/` I still have `/bin/`

    you probably thought I hadn't checked yet and thought everything was fine...

     

  4. I compiled test.cgi (c++) on my system: Linux/Devuan amd64

    I also wanted to try with a perl script, but it doesn't work.

    I set the rights to 755 and wrote the .htaccess file, which didn't exist.

    In my system everything works fine

    thank you all for your attention, you are very kind

  5. as i wrote, the error_log says:

    [Tue May 30 22:19:44.533866 2023] [cgid:error] [pid 22217:tid 139805337741056] [client 151.21.204.48:59042] End of script output before headers: test.cgi

     

    the "test.cgi" file works on my machine: Linux/Devuan + Apache2

  6. dear administrator,
    i can't get cgi-bin programs to work.
    The link https://z0n1n0z.helioho.st/cgi-bin/test.cgi is a compiled c++ test program. The source code is at https://z0n1n0z.helioho.st/cgi-bin/test.cpp.
    https://z0n1n0z.helioho.st/cgi-bin/test.pl doesn't work either. In cgi-bin/ there is also an .htaccess file which contains this:

    Options +ExecCGI
    AddHandler cgi-script .cgi .pl .py
    LimitRequestBody 2147483647

    the "error_log" file says:
    [Tue May 30 22:19:44.533866 2023] [cgid:error] [pid 22217:tid 139805337741056] [client 151.21.204.48:59042] End of script output before headers: test.cgi

    What can I do to activate cgi-bins?
    Thanks for the attention
    Best regards

×
×
  • Create New...