😂三十年前专门针对WPS

摘要:30年前用UCDOS和WPS,最讨厌有人给WPS文档加密码,只要遇到加密的WPS就想给它解掉,所以软盘里存着各种清除WPS密码的程序。

30年前用UCDOS和WPS,最讨厌有人给WPS文档加密码,只要遇到加密的WPS就想给它解掉,所以软盘里存着各种清除WPS密码的程序。

C程序:

//

/* 文件名: GETWPS.C */

/* 功 能: 获得WPS的密码 */

/* 语 言: TURBO C 2.0 */

/* 执 行: GETWPS wpsfilename */

//

#include

#include

main(int argc,char *argv)

{

int codee[8],i;

File *fp;

if(argc==1||argc>2)

{

puts("使用格式: GETWPS WPSFileNAME");

exit(1);

}

fp=(FILE *)malloc(sizeof(FILE));

fp=fopen(argv[1],"rb");

if(fp==NULL)

{

printf("%s%s\n",strupr(argv[1]),"文件没有找到!");

exit(1);

}

fSEEK(fp,0x02dd,0);

if(getc(fp)=='\0')

{

printf("%s%s\n",strupr(argv[1]),"文件没有被WPS加密.");

exit(1);

}

printf("%s%s",strupr(argv[1]),"的WPS密码是: ");

fseek(fp,0x02dd,0);

for(i=0;i

{

codee[i]=getc(fp);

codee[i]=((~codee[i]&0x0f)>4);

printf("%c",codee[i]);

}

fclose(fp);

}

BASIC程序:

REM clearwps

REM 清除WPS密码

REM 语 言:QuickBASIC

DIM MM(8)

COMM$ = "C:\AAA.WPS" '文件名

F$ = COMM$

REM F$=COMMAND$ '获得命令行文件名

OPEN F$ FOR BINARY AS #1 '打开文件

Filelen = LOF(1) '返回文件长度

IF Filelen = 0 THEN

PRINT "File not found !"

END '若长度为零则返回

END IF

IF Filelen

PRINT "The file isn't a WPS file !"

END '若长度小于等于1024字节则返回

END IF

FOR I = 734 TO 741

SEEK #1, I '定位到密码处

a$ = INPUT$(1, #1) '读出一字节

J = I - 733

MM(J) = ASC(a$) '密码保存

a$ = CHR$(0)

PUT #1, I, a$ '密码位写零

NEXT I

I = 1025 '从1025字节开始解密

DO WHILE I

J = 1

DO WHILE J

SEEK #1, I '定位文件指针

a$ = INPUT$(1, #I) '读一字节

ascn = ASC(a$) '将字符变为ASCII码

mscn = ascn XOR MM(J) '异或解密

a$ = CHR$(mscn) '将ASCII码变为字符

PUT #1, I, a$ '写回文件

J = J + 1

I = I + 1

LOOP

LOOP

CLOSE

END

查看WPS内容:

#include

#include

FILE *f1;

void error(char *p)

{

printf("%s file read error,or not exist !\n",p);

exit(0);

}

void help(void)

{

printf("%s\r\n","USAGE: lookwps ");

exit(1);

}

void type(int c)

{

switch(c)

{

case 0x0c:fscanf(f1,"%c",&c);printf("\n");break;

case 0x8d:fscanf(f1,"%c",&c);printf("\n");break;

case 0x0d:fscanf(f1,"%c",&c);printf("\n");break;

case 0x1a:break;

default:

if((c>=0x90)&&(c=0x80)&&(c

fscanf(f1,"%c",&c);

else

printf("%c",c);

break;

}

}

main(int argc,char *argv)

{

int a=0x2dd,b=0x400;

int c,c1,c2,i;

char buf[8];

if(argc!=2)

help;

if((f1=fopen(argv[1],"r"))==NULL)

error(argv[1]);

c1=fgetc(f1);

c2=fgetc(f1);

if(((c1!=0x03)||(c1!=0x01)||(c1!=0x02))&&(c2!=0xff))

{

printf("%s isn't a file of wps's format !",argv[1]);

exit(3);

}

fseek(f1,(long)a,0);

fread(buf,1,8,f1);

if(buf[0]!=0)

{

printf("File:%s was lock,can't read !\n",argv[1]);

printf("Please unlock,first.");

exit(4);

}

fseek(f1,(long)b,0);

while(!feof(f1))

{

fscanf(f1,"%c",&c);

type(c);

}

fclose(f1);

}

来源:东子科技

相关推荐