Gerador de senhas
Publicado por Lord Arthas Menethil 06/04/2006
[ Hits: 17.220 ]
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");
}
Código C para gerar hashes DES e MD5
Criptografar um Arquivo de Texto por cifra de Transposição
Esse código pode ser considerado um vírus?
Como extrair chaves TOTP 2FA a partir de QRCODE (Google Authenticator)
Linux em 2025: Segurança prática para o usuário
Desktop Linux em alta: novos apps, distros e privacidade marcam o sábado
IA chega ao desktop e impulsiona produtividade no mundo Linux
Novos apps de produtividade, avanços em IA e distros em ebulição agitam o universo Linux
Como instalar o repositório do DBeaver no Ubuntu
Como instalar o Plex Media Server no Ubuntu
Digitando underscore com "shift" + "barra de espaços"
Como ativar a lixeira e recuperar aquivos deletados em um servidor Linux
Como mudar o nome de dispositivos Bluetooth via linha de comando
PIP3 - erro ao instalar módulo do mariadb para o Python (9)
É normal não gostar de KDE? (8)
O programa assinador digital (0)
dpkg: erro: gatilho de arquivo duplicado chamado pelo arquivo de nome (6)









