| die letzten Änderungen * Seitenstruktur * Stichwortsuche :


logo_puschin.jpg

Startseite

Knowledge base



Kontakt

Impressum

Knowledge base - Allgemeine Hilfen

Knowledge base

7 Benutzer online Druckversion




zurück



Allgemeine Hilfen
WS Ftp Kennwörter entschlüsseln

Hier der C-Source :

/* ws_unmunge.c - version 1.0
* shade@wastelands.gen.nz - 5-Feb-2001
*/
#include <ctype.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>

/* extract_old lifted from wsftp-crack.c which contains the following comment:
*
*      -- Snip --
*      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
*      -- /Snip --
*/
char *extract_old(char *password) {
        int             h,i,k,l;
        char            m[2],n[2];
        char            ch;
        static char     result[1024];

        i=0;h=0;
        m[1]=0;
        n[1]=0;
        bzero(&result,sizeof(result));

        if (password[i]=='V') i=1;

        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; break;
                        }
                }

                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; break;
                        }
                }
                k = (k*16)+l-h;
                h++;
                result[strlen(result)] = k;
        }
        return(&result[0]);
}

/* extract_new borrowed from http://www.hispasec.com/wsftp.asp
*/
char *extract_new(char *password) {
        static char     result[1024];
        int             i, c, s;

        password[strlen(password)-1] = '';
        bzero(&result,sizeof(result));

        for (i = 0; i < (strlen(password)-33)/2; i++) {
                sscanf(&password[33+(i*2)],"%2x",&c);
                sscanf(&password[i+1],"%1x",&s);
                result[strlen(result)] =  c - i - 1 - ((47+s)%57);
        }

        return(&result[0]);
}

void display (char *host, char *uid, char *pwd) {
        char            *r;

        if (host[0] == 0 || uid[0] == 0 || pwd[0] == 0) return;
        if (strcmp(uid,"ftp") == 0 || strcmp(uid,"anonymous") == 0) {
                r = pwd;
        } else {
                if (pwd[0] == 'V') r = extract_new(pwd);
                        else r = extract_old(pwd);
        }
        printf("%s: %s/%sn",host,uid,r);
}

void process_file (char *filename) {
        FILE            *ini;
        char            buffer[1024];
        char            host[1024]="", uid[1024]="", pwd[1024]="";
        char            *item, *value;

        if ((ini = fopen(filename,"r")) == NULL)
                err(EX_NOINPUT,"fopen");

        while(fgets(buffer,1023,ini)) {
                if (buffer == NULL) continue;
                if (buffer[0] == '[') {
                        display(host,uid,pwd);
                        host[0] = '';
                        uid[0] = '';
                        pwd[0] = '';
                        continue;
                }

                item = strtok(buffer,"rn=");
                if (item == NULL) continue;
                value = strtok(NULL,"rn");
                if (value == NULL) continue;

                if (strcmp("HOST",item) == 0) {
                        strcpy(host,value);
                } else if (strcmp("UID",item) == 0) {
                        strcpy(uid,value);
                } else if (strcmp("PWD",item) == 0) {
                        strcpy(pwd,value);
                        strcat(pwd,"r");
                }
        }
        display(host,uid,pwd);

        if (fclose(ini) == EOF)
                err(EX_IOERR,"fclose");
}

int main (int argc, char *argv[]) {
        int             i;

        if (argc == 1)
                errx(EX_USAGE,"No files specified!");

        for (i = 1; i < argc; i++) {
                process_file(argv[i]);
        }
        return(EX_OK);
}


zurück



Knowledge base wurde zuletzt bearbeitet am 12.07.13 durch Frank

www.puschin.de
login

<body bgcolor='#FFFFFF' link='#000000' vlink='#000000' alink='#000000' text='#000000'><font face='Verdana' size='2'><strong>www.puschin.de</strong><br>Die Webseite http://www.puschin.de bietet eine interessante Webseite zu vielen Themen aus dem Bereich Linux und Windows. Man findet hier Tipps und Tricks zu cms php apache postfix openxchange tomcat windows linux firewall <br><br><font face='Verdana' size='2'><li><a href='cms.php?print=&aktion=thema_anzeigen&menue_id=191'>Startseite</a><font face='Verdana' size='2'><li><a href='cms.php?print=&aktion=thema_anzeigen&menue_id=63'>Knowledge base</a><font face='Verdana' size='2'><li><a href='cms.php?print=&aktion=thema_anzeigen&menue_id=57'>Kontakt</a><font face='Verdana' size='2'><li><a href='cms.php?print=&aktion=thema_anzeigen&menue_id=9'>Impressum</a></body>