[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: md5 i proftpd



Witam..

Moze tym:

/*Crypt Password Program v0.1*/
#include <unistd.h>
#include <stdio.h>
#include <sys/time.h>
#define VERSION "0.1"

usage(char *progname)
{
printf("Usage: %s [OPTION]\nOPTIONS:\n",progname);
printf("     -d, --des           Crypt password using DES algorithm\n");
printf("     -m, --md5           Crypt password using MD5 algorithm\n");
printf("     -v, --version       Output version information and exit\n");
exit(0);
}

char *
make_salt(char opt)
{
       struct timeval tv;
       static char result[40];
       result[0] = '\0';
       if (opt==1) strcpy(result, "$1$");
       gettimeofday(&tv, (struct timezone *) 0);
       strcat(result, l64a(tv.tv_usec));
       strcat(result, l64a(tv.tv_sec + getpid() + clock()));
       if (strlen(result) > 3 + 8)
       result[11] = '\0';
       return result;
}

int main(int count, char *tablarg[])
{
char passwdent[128];
char *ver=VERSION;
int opt;
int n=1;
 if (count != 2) usage(tablarg[0]);
 if (strcmp(tablarg[1],"--md5") == 0 || strcmp(tablarg[1],"-m") ==0) opt=1;
else if (strcmp(tablarg[1],"--des") == 0 || strcmp(tablarg[1],"-d") == 0) opt=2; else if (strcmp(tablarg[1],"--version") == 0 || strcmp(tablarg[1],"-v") == 0)
{
       printf("CryptPWD v%s\n",ver);
       exit(0);
      }
 else usage(tablarg[0]);
 fgets(passwdent,sizeof passwdent,stdin);
 while (passwdent[n] != '\n') n++;
 passwdent[n] = '\0';
 printf("%s\n", crypt(passwdent,make_salt(opt)));
}


Ktosik to takie cus napisal... Zakodowane haselko wraca wyjsciem standardowym, wiec mozna sie pokusic o jakis skrypcik shella i bedzie pasowalo jak ulal..
np:

echo "USER":`crypt -m < PASSWORD`:UID:GID:Virtual User/home/USER:/no/shell >>virtual.passwd
:))

Mozna zmienic odpowiednio ten program by nie trzeba bylo dawac -m i < :)

Pozdrawiam
Basia

From: "Adrian Merda" <admer@virtualnet.dhs.org>
To: "Debian - User - Polish" <debian-user-polish@lists.debian.org>
Subject: md5 i proftpd
Date: Thu, 3 Jan 2002 18:49:43 +0100

Witam

Chcê u¿yæ osobnego pliku hast³ dla userów w proftpd i mam problem. Czym mam
kodowaæ has³a tak ¿eby proftpd je rozumia³. Rozumiem ¿e plik ten ma wygl±daæ
identycznie jak /etc/passwd.



_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


--
To UNSUBSCRIBE, email to debian-user-polish-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: