summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBertrand Jacquin (Beber) <beber@meleeweb.net>2006-08-23 20:51:20 +0200
committerbeber <beber@meathook.melee>2006-08-23 20:51:20 +0200
commit649ed84d2b2117f7407a689945f4479002983035 (patch)
treeab75b76177480724a84f23b0ed800c45580755fb
parentpassgen: change mail and some output .. (diff)
downloadperso-649ed84d2b2117f7407a689945f4479002983035.tar.gz
fuck c'est moche, mais ca marche
http://test.meleeweb.net/
-rw-r--r--passgen/Makefile8
-rw-r--r--passgen/passgen.c29
-rwxr-xr-xpassgen/passgen.cgi18
3 files changed, 45 insertions, 10 deletions
diff --git a/passgen/Makefile b/passgen/Makefile
index 375fac5..8bf2290 100644
--- a/passgen/Makefile
+++ b/passgen/Makefile
@@ -1,13 +1,19 @@
-SRC = passgen.c
+SRC = passgen.c
NAME = passgen
CFLAGS += -W -Wall
OBJ = $(SRC:c=o)
+OBJW = $(SRC:c=o.web)
RM = rm -f
CC = gcc
$(NAME): $(OBJ)
$(CC) -o $(NAME) $(OBJ) $(CFLAGS)
cp $(NAME) ~/bin
+
+web:
+ gcc -W -Wall -c -o $(OBJW) $(SRC)
+ $(CC) -o $(NAME).web $(OBJW) $(CFLAGS) -D_WEB=1
+ cp $(NAME) ~/bin
clean:
$(RM) *.swp
diff --git a/passgen/passgen.c b/passgen/passgen.c
index 93a29b4..a142117 100644
--- a/passgen/passgen.c
+++ b/passgen/passgen.c
@@ -12,7 +12,7 @@
#define TAILLE_MAX 9
#define TAILLE_MIN 6
-#define CARTOUSE "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+#define CARTOUSE "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz:@;^$*()[]{}<>&~#'\"_-+=%!§:/,?0123456789"
void gene_from_scratch(int nb_char, char pass[])
{
@@ -41,7 +41,8 @@ void gene_from_cartouse(int nb_char, char pass[])
void ecr(char pass[], int i)
{
- printf(">%*d (%ld)\t: \'%s\'\n", 2, i+1, strlen(pass), pass);
+ printf(">%*d (%d)\t: \'%s\'\n", 2, i+1, strlen(pass), pass);
+ printf("<BR/>");
}
int main (int argc, char** argv)
@@ -49,25 +50,35 @@ int main (int argc, char** argv)
int nb_char;
int i;
char *pass;
- int mode_choice;
-
+ int mode_choice = 0;
+ int nb_pass;
+
+ nb_pass = 10;
+
+#if 0
if (argc <= 1)
{
fprintf (stderr, "Veuillez donnez le nombre de pass a générer\n");
- exit (1);
+ exit (-1);
}
+ nb_pass = atoi (argv[1]);
+#endif
+
pass = malloc (sizeof(char)*TAILLE_MAX);
- srand (time (NULL));
- for (i=0 ; i < atoi (argv[1]) ; i++)
+ srand (time (NULL));
+ for (i=0 ; i < nb_pass ; i++)
{
nb_char=rand()%(TAILLE_MAX-TAILLE_MIN)+TAILLE_MIN;
- if ( mode_choice == 1)
+ if (mode_choice == 1)
gene_from_scratch(nb_char,pass);
else
gene_from_cartouse(nb_char,pass);
- ecr(pass,i);
+ if (strlen (pass) < TAILLE_MIN)
+ i--;
+ else
+ ecr(pass,i);
}
free (pass);
return 0;
diff --git a/passgen/passgen.cgi b/passgen/passgen.cgi
new file mode 100755
index 0000000..b0013fe
--- /dev/null
+++ b/passgen/passgen.cgi
@@ -0,0 +1,18 @@
+#!/usr/bin/perl
+
+use CGI ;
+$html= new CGI ;
+print $html->header ;
+
+my $pass = `./passgen.web`;
+
+print "<HTML>\n";
+print " <HEAD>\n";
+print " <TITLE>passgen</TITLE>\n";
+print " </HEAD>\n";
+print " <BODY>\n";
+print " <H1>10 pass</H1>";
+print " <P>$pass</P>";
+print " </BODY>\n";
+print "</HTML>\n";
+