Gerador de senhas
Publicado por Lord Arthas Menethil 06/04/2006
[ Hits: 17.326 ]
Um gerador de senhas que pode usar numeros, caracteres, ou os dois juntos, além de caracteres especiais.
/*
* 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");
}
Script para fazer ataque DoS - use apenas como testes com sistemas de segurança
Esse código pode ser considerado um vírus?
Cirurgia para acelerar o openSUSE em HD externo via USB
Void Server como Domain Control
Modo Simples de Baixar e Usar o bash-completion
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
Atualizar Linux Mint 22.2 para 22.3 beta
Jogar games da Battle.net no Linux com Faugus Launcher
Como fazer a Instalação de aplicativos para acesso remoto ao Linux
Conky, alerta de temperatura alta (10)
Assisti Avatar 3: Fogo e Cinzas (3)
Duas Pasta Pessoal Aparecendo no Ubuntu 24.04.3 LTS (42)









