Как найти популярные имена учетных записей?
?? ??? ?????, ??? ??????? ?? ?????? Administrator. ??? ????????????? ? ??? Verwalter, Administrateur, Coordinatore, ??????t?? , ??? , ??? ? ? ??? ??????, Remote Desktop Users, ??? ??? Guest? ? ?????? ?????? ???????, ?????? ? ?????????. ???? ???????
? ?????? ???? ??? ???. ??-??????, ??? ??? ??????? ?????? ?????????? well-known ("?????? ?????????"), ?????? ????????? ?? ??? ?????? ????? ??? ??? ???, ? ? ??? ??????, ??? ???? ??????????? ?????????????? ????????, ??? ??? ??? ???????????. ? ??????, ??? ????? ? ??? ?????.
???? ???????, ??? ??? ?????????? SID?, ??????? ?? ?????????? ???????? ?????? ?? ????? ?? ??????. ??????, ?? ????, ?? ????? ????????? ? ??????. ???? ??? ???? ? ?? ?? ?? ????? ??????. ?? ? ????????? ????????? ???????????, ??? ?????? ? ???? ?????????: ????????? ? ????????. ????????? - ??? ??, ??? ????????? ? ?????????????????, ? ???????? - ??? ??, ??? ??? ?????. ?? ? ??? ?? ????????, ?? ?????????? ????? ?????????? ???? ? ?????.
????? ???????, ?????????????????? ??????: ????? ?????? ????????? SID ? ???? ??????, ????????, "LA" ??? ?????????? ?????????????? ??? "RD" ??? ????????? ?????????????, ????????? ??? ? ???????? ?????, ? ????? ?? ???????? ????? ???? ???. ???????? ??? ?? ?++ ??? ???:
#include <Windows.h>
#include <Sddl.h>
#define CHECK(api) if (!fRes) { printf("%s failed\n",api); goto exit; }
...
printf("Enter the sid to look up (string):");
WCHAR sidstr[100] = L"---";
_getws_s(sidstr,_countof(sidstr));
if (0 == sidstr[0]) break;
wprintf(L"Looking up name %s\n", sidstr);PSID psid;
BOOL fRes = ConvertStringSidToSidW(sidstr,&psid);
CHECK("ConvertStringSidToSidW");WCHAR wszName[256] = L"---", wszDomain[256] = L"---";
DWORD cName = _countof(wszName), cDomain = _countof(wszDomain);
_SID_NAME_USE eUse;
fRes = LookupAccountSidW(NULL,psid,wszName,&cName,wszDomain,&cDomain,&eUse);
CHECK("LookupAccountSidW");wprintf(L"Account name: %s\nDomain: %s\n",wszName,wszDomain);
...
exit:
? ? .Net ? C# ???????? ??? ???:
static String getName(String sidstr)
{
SecurityIdentifier sid = new SecurityIdentifier(sidstr);
Console.WriteLine("SID.toStr: " + sid.ToString() + " SID.value: " + sid.Value);
Type tp = typeof(NTAccount);
IdentityReference rnta = sid.Translate(tp);
Console.WriteLine("IdentityReference.value: " + rnta.Value);
return rnta.Value;
}
??? ??????, ?? ?? ??? ?? ????????? ???? ??????, ??? ??? ????? ???? ? MSDN, ? ?????? ???, ??????? ?? ?????? ???? ???? ???? ????????? ??????, ????? ?????.
[1] SID Strings: https://msdn2.microsoft.com/en-us/library/aa379602.aspx
[2] Well-knowns SIDs: https://msdn2.microsoft.com/en-us/library/aa379649.aspx