Delphi Quickly Identify The Windows Cached Network Credentials Through Code

FireWind

Свой
Регистрация
2 Дек 2005
Сообщения
1,957
Реакции
1,199
Credits
4,009
Quickly Identify The Windows Cached Network Credentials Through Code
By Anbarasan March 15, 2021

In Windows using Credentials Manager user can easily identify the cached network credentials. However, Sometimes Developers need to list down the cached windows network credentials from a Delphi App programmatically? Don’t know how to do. Don’t worry. Для просмотра ссылки Войди или Зарегистрируйся System Information Management Suite’s helps to enumerate the Network Credentials, we will learn how to use the MiTeC_NetCreds Component in this blog post.

Platforms: Windows.

Installation Steps:

You can easily install this Component Suite from GetIt Package Manager. The steps are as follows.
  1. Navigate In RAD Studio IDE->Tools->GetIt Package Manager->select Components in Categories->Components->Trail -MiTec system Information Component Suite 14.3 and click Install Button.
  2. Read the license and Click Agree All. An Information dialog saying ‘Requires a restart of RAD studio at the end of the process. Do you want to proceed? click yes and continue.
  3. It will download the plugin and installs it. Once installed Click Restart now.
How to run the Demo app:
  • Navigate to the System Information Management Suite trails setup, Demos folder which is installed during Get It installation e.g) C:UsersDocumentsEmbarcaderoStudio21.0CatalogRepositoryMiTeC-14.3DemosDelphi24
  • Open the NetCreds project in RAD studio 10.4.1 compile and Run the application.
  • This Demo App shows how to list down the Network credentials, enumerate among them and access its properties.
Components used in MSIC TS Demo App:
  • TListView to show the cached Network Credentials and its properties.
  • TButton to save the listed Network Credentials to a .sif file and close the application.
Implementation Details:
  • An Instance is created NC of TMiTeC_NetCreds. Loop through the NC Record count and add Network Credentials item to the list view. List down the properties such as Credentials Type, Target, Timestamp, Username and Password of each TCredRecord item to list view item. Credential Type can be Generic, Domain Password, Domain Certificate etc..
Код:
procedure TForm1.cmRefresh(Sender: TObject);
var
  i: Integer;
begin
  NC:=TMiTeC_NetCreds.Create(Self);
  NC.RefreshData;
  List.Items.Clear;
  for i:=0 to NC.RecordCount-1 do
    with List.Items.Add do begin
      case NC.Records[i].Typ of
        1: Caption:='Generic';
        2: Caption:='Domain Password';
        3: Caption:='Domain Certificate';
        4: Caption:='Domain Visible Password';
        5: Caption:='Generic Certificate';
        6: Caption:='Domain Extended';
        7: Caption:='Maximum';
        1007: Caption:='Maximum Extended';
        else Caption:=IntToStr(NC.Records[i].Typ);
      end;
      SubItems.Add(DateTimeToStr(NC.Records[i].Timestamp));
      SubItems.Add(NC.Records[i].Target);
      SubItems.Add(NC.Records[i].Username);
      SubItems.Add(NC.Records[i].Password);
    end;
 
  Caption:=Format('Network Credentials - %d items',[List.Items.Count]);
end;
  • Display the Network Credentials properties as shown below.
1615815192142.png
It’s that simple to enumerate cached network credentials and list its properties for your application. Use this MiTeC component suite and get the job done quickly.