Gerador de senhas

Publicado por Lord Arthas Menethil 06/04/2006

[ Hits: 16.408 ]

Download kg-0.2.tar.bz2




Um gerador de senhas que pode usar numeros, caracteres, ou os dois juntos, além de caracteres especiais.

  



Esconder código-fonte

/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int generate(int type);
int save_key();
void about(void);

int key_num[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };

char key_lchar[52] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
   
char key_espec[17] = { '_', '.', '-', '$', '%', '/', '&', '(', ')', '[', ']', '?', '!', '@', '=', '+', '*' };
   
int main()
{
   int opc;
   int op1;
   int to1 = 1;
   int to2 = 2;
   int to3 = 3;
   int to4 = 4;
   
   printf("Key Generator 0.9, by morte137\n");
   printf("Escolha a opção...\n");
   printf("[1]Gerar senha\n");
   printf("[2]Sobre o Key Generator.\n");
   printf("[3]Sair\n");
   scanf("%d", &opc);
   
   if(opc == 1)
   {
      printf("Escolha a opção.\n");
      printf("[1]Senha com letras somente\n");
      printf("[2]Senha com numeros somente\n");
      printf("[3]Senha com Letras e numeros\n");
      printf("[4]Senhas com tudo, inclusive caracteres especiais\n");
      scanf("%d", &op1);
      
      if(op1 == 1)
         generate(to1);
      
      if(op1 == 2)
         generate(to2);
      
      if(op1 == 3)
         generate(to3);
      
      if(op1 == 4)
         generate(to4);
   }
   
   if(opc == 2)
      about();
   
   if(opc == 3)
      exit(0);
   
   return(0);
}
      
int generate(int type)
{
   char *pass;
   int quant; 
   int qtn;
   int n = 0;
   
   srand(time(NULL));
   pass = (char *) malloc(sizeof(char));
   
   if(type == 1)
   {
      printf("Digite a quantidade de caracteres que desenha.\n");
      scanf("%d", &quant);
      
      for(n = 0; n <= quant; n++)
      {
         printf("%c", key_lchar[rand()%57]);
         sleep(1);
      }
      printf("\n");
   }
   
   if(type == 2)
   {
      printf("Digite a quantidade de caracteres que desenha.\n");
      scanf("%d", &quant);
      
      for(n = 0; n <= quant; n++)
      {
         printf("%d", key_num[rand()%11]);
         sleep(1);
      }
      printf("\n");
   }
      
   if(type == 3)
   {
      printf("Digite a quantidade de caracteres que desenha.\n");
      scanf("%d", &quant);
      qtn = quant / 2;
      
      for(n = 0; n <= qtn; n++)
      {
         printf("%c", key_lchar[rand()%57]);
         printf("%d", key_num[rand()%11]);
         sleep(1);
      }
      printf("\n");
   }
   
   if(type == 4)
   {
      printf("Digite a quantidade de caracteres que desenha.\n");
      scanf("%d", &quant);
      qtn = quant / 2;
      
      for(n = 0; n <=qtn; n++)
      {
         printf("%c", key_lchar[rand()%57]);
         
         if(n % 2 == 0)
         {
            if((rand()%11) % 2 == 0)
               printf("%c", key_espec[rand()%18]);
            
            else
               printf("%d", key_num[rand()%11]);
         }
         
         else
            printf("%d", key_num[rand()%11]);
         
         sleep(1);
      }
      printf("\n");
   }
   
   free(pass);
   return(0);
}

void about(void)
{
   printf("Key Generator 0.9\n");
   printf("Autor: Morte137\n");
   printf("Contato: morte137@gmail.com\n");
   printf("Agradecimentos: GNU por seus ótimos manuais, além dos mesmos agradecimentos de sempre.\n");
   printf("Oque haverá no 1.0: Interface Grafica\n");
}

Scripts recomendados

DoS Syn flood

Criptografia

Validador de CPF e CNPJ

Cálculo da chave secreta do protocolo Diffie-Hellmann

Exploit para kernel 2.6.12-rc4


  

Comentários
[1] Comentário enviado por Dark_Avatar em 06/04/2006 - 15:02h

Desculpa pessoal, acabei mandando o projeto que eu tava editando ontem antes de dormir, do 0.9, ele faz o mesmo que o do download faz, mas mudei o rótulo, eu ia add mais coisas hoje, para fazer a 0.9 certinho. Não há diferenças de formas de uso entre o do download e o do de pré-visualização, somente o "rótulo de versão".

[2] Comentário enviado por m3ocs-d4rksun em 12/05/2006 - 17:51h

copioit a ideia de mim né?
uhauhahuah

[3] Comentário enviado por alaxricard em 29/04/2010 - 18:54h

Foi demais ai mano.


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts