荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: jjksam (暂别Windows), 信区: Linux
标  题: Re: flashfxp--gftp书签转换器
发信站: 荔园晨风BBS站 (Sun Jun 27 03:24:23 2004), 转信

对flashfxp-gftp转换的建议:
1. 在gftp处加上remote_encoding的选项。(不知有没有本地编码选项)
2. 加上flashfxp的密码加密的解密.
3. 对匿名登陆采用gftp本身的参数@EMAIL@
4. 加入对各种编码向UTF8的转换。(需要掌握编码知识),
   简单的可以用openoffice手工来做。

进一步:
1. 把这个功能加入gftp的代码中。
2. 测试成功后,提交到sourceforge. 希望能为gftp新增一些好的功能。

下面附上flashfxp Sites.dat中加密的密码的解密程序。
flashfxp的加密方法是 异或 和简单的magic number, magic number可以从反汇编代码
中获得. 下面代码适用于flashfxp 2.1和Flash深大共享书签版(3.0 build(998) RC2),
只在上面测试过.

TODO:
1. 改善存在的bug或不足:不能处理过长字符串,而flashfxp可以处理至少4000个字符
   长度的密码。
2. 改善程序效率。对时空的优化。

声明: 本代码只用于研究和学习, 对于使用此代码所造成的一切后果, 本人一概
不负责.

/* Flashfxp sites.dat decryption
 * By: jjksam_at_163_dot_com
 * 2004-6-26
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define TEST_CODE

#define VERSION 1.0

char b[]="C18BFC03014CC3CE3F1C09";
//other
//D17AED1270DF57BACA60D5
//56FE7090F252C93555EA5E
//63ED61A7ED59CE3252EF65
//FD56C9CF321D127D8DA297
//74DC4EB2D07CF31F6FCCB9
//FB54C7C9CB7BF01C6CC1B4


/**************************************************************************
 * decryption function
 * pay attention to the length of the password.
 * a very long password may cause buffer overflow
 * By: jjksam_at_163_dot_com
 * Date: 2004-6-26
 * Param: const unsigned char *EncryptedPass, unsigned char *DecryptedPass
 * return: char *
 **************************************************************************
 */

char *GetFlashfxpPass(const unsigned char *EncryptedPass, unsigned char
*DecryptedPass);

#ifdef TEST_CODE

int main(int argc, char **argv)
{
            unsigned char abc[]="922F4D2339"; /*密码*/
            unsigned char *buf;
                int len=sizeof(abc)/2;

                buf=malloc(len*sizeof(char));
                if(buf==NULL) exit(1);
                printf("Decrypted password is: %s\n",GetFlashfxpPass(abc,buf));
                printf("Size of buf: %d, buf = %s\n", len, buf);
                if(!buf) free(buf);

        return 0;
}
#endif

char *GetFlashfxpPass(const unsigned char *EncryptedPass, unsigned char
*DecryptedPass)
{
        unsigned int i;
        char temp[3]={0};
        unsigned char _byte;
        unsigned char magic_nb;
        unsigned char magicbuf[] = "yA36zA48dEhfrvghGRg57h5UlDv3";

        for(i=1; i <= (strlen(EncryptedPass)-2)/2; i++)
        {
                temp[0] = EncryptedPass[i*2-2];
                temp[1] = EncryptedPass[i*2-1];
                sscanf(temp, "%x", &magic_nb);

                temp[0] = EncryptedPass[i*2];
                temp[1] = EncryptedPass[i*2+1];

                sscanf(temp, "%x", &_byte);

                _byte ^= magicbuf[((i-1)%28)];

                if(_byte < magic_nb)
                {
                        _byte -= magic_nb +0xFFFFFF01;
                }
                else
                {
                        _byte -= magic_nb;
                }
                DecryptedPass[i-1] = _byte;
        }
        DecryptedPass[i-1]=0;
        return DecryptedPass;
}


--
     。.
      ."。
      █D

 Would you like to have a cup of cola with me?

※ 修改:·jjksam 於 Jun 27 03:24:31 修改本文·[FROM: 192.168.0.234]
※ 来源:·荔园晨风BBS站 bbs.szu.edu.cn·[FROM: 192.168.0.234]
--
※ 转载:·荔园晨风BBS站 bbs.szu.edu.cn·[FROM: 192.168.0.234]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店