elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a la Factorización De Semiprimos (RSA)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  ubuntu problem detected [Apache2 CGI C++]
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: ubuntu problem detected [Apache2 CGI C++]  (Leído 2,146 veces)
xkiz ™


Desconectado Desconectado

Mensajes: 1.252


Ver Perfil WWW
ubuntu problem detected [Apache2 CGI C++]
« en: 18 Octubre 2014, 19:01 pm »

No se donde poner este post, por que no se de donde viene el problema, si es de ubuntu, de apache2 o de algun error en CGI C++, asi que muévanlo a donde crean que vaya.


estoy intentando hacer algo en CGI C++, y como no se ni J, estoy investigando, googleando tutoriales y demsas cosas...
me tope con este tutorial; http://www.yolinux.com/TUTORIALS/LinuxTutorialC++CGI.html (Example, no llegue a Debugging)
compile las librerias cgi y funciona como tendria que, al reiniciar la pc hoy, me aparecio un popup de ubuntu problem detected, al ir a info tiro que lo que lo que ocaciono el problema estaba en /usr/lib/cgi-bin/testcgi, el cgi que habia creado con el tutorial,  lo que me pareció raro por que todo funcionaba bien, hasta que vi que si llamo aal cgi directamente: "localhost/cgi-bin/testcgi" aparece esto:



lo cual apunta al cgi, pero no logro darme cuenta donde esta el error.
tampoco se porque aparece ese error al iniciar el sistema.


OS: ubuntu 14.04 x64
Apache2: Apache/2.4.7 (Ubuntu)
CGI Librerias ver:  3.2.9


Edito:
si ejecuto el cgi desde terminal me devuelve esto:

Código:
root@ubuntu:/usr/lib/cgi-bin# ./testcgi
Content-Type: text/html


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html lang="EN" dir="LTR" >
</html><head><title>Cgicc example</title></head>
<body bgcolor="#cccccc" text="#000000" link="#0000ff" vlink="#000080" >
<h1>This is a demonstration of the GNU CgiCC library</h1>
Violación de segmento (`core' generado)


« Última modificación: 18 Octubre 2014, 20:37 pm por xkiz ™ » En línea

Eternal Idol
Kernel coder
Moderador
***
Desconectado Desconectado

Mensajes: 5.935


Israel nunca torturó niños, ni lo volverá a hacer.


Ver Perfil WWW
Re: ubuntu problem detected [Apache2 CGI C++]
« Respuesta #1 en: 18 Octubre 2014, 20:55 pm »

El programa testcgi tiene un bug, deberias depurarlo.


En línea

La economía nunca ha sido libre: o la controla el Estado en beneficio del Pueblo o lo hacen los grandes consorcios en perjuicio de éste.
Juan Domingo Perón
xkiz ™


Desconectado Desconectado

Mensajes: 1.252


Ver Perfil WWW
Re: ubuntu problem detected [Apache2 CGI C++]
« Respuesta #2 en: 19 Octubre 2014, 00:23 am »

nunca le agarre la mano a C++, es mas C++ se aleja cada vez que quiero...

despues de prueba y errores, lgre hacer que no crashee mas al ejecutarlo directamente, sin provenir desde el html que enviaba el POST, ahora no se si esta bien o mal, o si me va a joder por otro lado:

Código
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4.  
  5. #include "cgicc/CgiDefs.h"
  6. #include "cgicc/Cgicc.h"
  7. #include "cgicc/HTTPHTMLHeader.h"
  8. #include "cgicc/HTMLClasses.h"
  9.  
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12.  
  13. using namespace std;
  14. using namespace cgicc;     // Or reference as cgicc::Cgicc formData; below in object instantiation.
  15.  
  16. int main(int argc, char *argv[])
  17. {
  18. try {
  19. Cgicc formData;
  20.  
  21. // Send HTTP header: Content-type: text/html
  22. cout << HTTPHTMLHeader() << endl;
  23. // Print: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
  24. cout << HTMLDoctype(HTMLDoctype::eStrict) << endl;
  25. // Print: <html lang="en" dir="LTR">
  26. cout << html().set("lang", "EN").set("dir", "LTR") << endl;
  27.  
  28. // Set up the HTML document
  29. cout << html() << head() << title("Cgicc example") << head() << endl;
  30. cout << body().set("bgcolor","#cccccc").set("text","#000000").set("link","#0000ff").set("vlink","#000080") << endl;
  31.  
  32. cout << h1("This is a demonstration of the GNU CgiCC library") << endl;
  33. char *str = getenv("QUERY_STRING");
  34.  
  35. if(str != NULL){
  36. free(str);
  37. form_iterator fvalue1 = formData.getElement("value1");
  38. if( !fvalue1->isEmpty() && fvalue1 != (*formData).end()) {
  39. cout << "Value1: " << **fvalue1 << endl;
  40. }else{
  41. cout << "No text entered for value1" << endl;
  42. }
  43.  
  44. cout << p();
  45.  
  46. form_iterator fvalue2 = formData.getElement("value2");
  47.  
  48. if( !fvalue2->isEmpty() && fvalue2 != (*formData).end()) {
  49. // Note this is just a different way to access the string class.
  50. // See the YoLinux GNU string class tutorial.
  51. cout << "Value2: " << (**fvalue2).c_str() << endl;
  52. }
  53.  
  54. cout << p();
  55.  
  56. form_iterator fvalue3 = formData.getElement("value3");
  57. if( !fvalue3->isEmpty() && fvalue3 != (*formData).end()) {
  58. cout << "Value3: " << **fvalue3 << endl;
  59.   }
  60.  
  61.   cout << p();
  62.  
  63.   form_iterator fvalue4 = formData.getElement("value4");
  64.   if( !fvalue4->isEmpty() && fvalue4 != (*formData).end()) {
  65.   cout << "Value4: " << **fvalue4 << endl;
  66.   }
  67.  
  68. }// mio
  69.  
  70.       // Close the HTML document
  71. cout << body() << endl;
  72. cout <<  html() << endl;
  73.    }
  74.    catch(exception& e) {
  75.       // handle any errors here.
  76. cout << "ERROR!!" << endl;
  77. return 0;
  78.  
  79.    }
  80.  
  81.    return 0;   // To avoid Apache errors.
  82. }
  83.  


hasta ahora solo es el mismo cpp del ejemplo.

con lo que hice que no tire mas errores fue con lo de getenv("QUERY_STRING") y el f(str != NULL), pero no se si es la forma correcta...
« Última modificación: 19 Octubre 2014, 00:36 am por xkiz ™ » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Ubuntu Problem
GNU/Linux
Pekentach 2 2,222 Último mensaje 24 Diciembre 2010, 13:41 pm
por Magius
Debugger Detected [304]
Windows
Kurolox 3 2,478 Último mensaje 4 Diciembre 2012, 22:30 pm
por Kurolox
ayuda AP rate limiting detected
Hacking Wireless
lapolla69 1 4,711 Último mensaje 13 Julio 2014, 04:44 am
por Sh4k4
Habilitar error_reporting en Apache2 (Ubuntu 12.04)
Desarrollo Web
[u]nsigned 5 3,074 Último mensaje 21 Junio 2015, 18:54 pm
por MinusFour
Ayuda: Configurar interfaz CGI en apache2 en Ubuntu
Desarrollo Web
erest0r 0 1,475 Último mensaje 3 Julio 2015, 10:01 am
por erest0r
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines