Does anyone know how to delete passwords in Firefox, Chrome and IE with C#? I have tried doing this in a lot of ways but I have not been successful in that I cannot find the place they are stored to delete them. I looked in http://kyrionhackingtutorials.com/2012/03/all-saved-password-location but i cant seem to find and delete them.
public static void deleteHistory(string browser)
{
switch (browser)
{
case "explorer":
RegistryKey r = Registry.CurrentUser;
try
{
r.DeleteSubKey(@"Software\Microsoft\Internet Explorer\IntelliForms\Storage2");
}
catch(Exception e)
{
Console.WriteLine("no passwords deleted : " + e);
}
string Efilepath = System.Environment.GetEnvironmentVariable("USERPROFILE") + explorerPath;
string[] Edirctorys = Directory.GetFiles(Efilepath);
foreach (string dir in Edirctorys)
{
File.Delete(dir);
}
break;
case "chrome":
string[] filePaths;
if (File.Exists(chromePathXP))
{
filePaths = Directory.GetFiles(chromePathXP);
foreach (string file in filePaths)
File.Delete(file);
}
if (File.Exists(chromePathVista))
{
filePaths = Directory.GetFiles(chromePathVista);
foreach (string file in filePaths)
File.Delete(file);
}
break;
case "firefox":
string displayName = WindowsIdentity.GetCurrent().Name.Split('\\')[1];
string filepath = System.Environment.GetEnvironmentVariable("USERPROFILE") + firefoxPath+displayName;
//string[] dirctorys = Directory.GetDirectories(filepath);
// foreach (string dir in dirctorys)
foreach (string file in firefoxFiles)
{
if (File.Exists(filepath + "\\" + file))
{
Console.WriteLine(filepath + file);
File.Delete(filepath + "\\" + file);
}
}
break;
default:
break;
}
}
I'm not sure if the information on the website you linked is correct. I believe the passwords etc for Firefox moved into the profile folder some time ago....
For Firefox the profile folder is located in
%APPDATA%\Mozilla\Firefox\Profiles\xxxxxxxx.default.
%APPDATA% is shorthand for the C:\Users\\AppData\Roaming\Mozilla (Win 7/Vista) (or C:\Documents and Settings\\Application Data\Mozilla for Win XP)
key3.db etc should be in there
Can't help you out with the others I'm afraid as I don't use them
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With