you are here: Skip Navigation Linkshome > blog

HostingAbc Logo

Show all posts.
If you've ever wondered how could you list all your usernames and passwords that are set on the 'Directory Security' tab on each website's properties (in inetmgr) then this small C# code snippet would be for you ..
Just a note: so far it seems that this code snippet works only on Windows Server 2003 - i have no ideea why doesn't it work on XP / Vista as well (don't care actually :) - i needed it for win 2003)...

C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
static void Main(string{} args)
{
    DirectoryEntry iisBase = new DirectoryEntry("IIS://localhost/W3SVC");
    PrintUserNameAndPass(iisBase);
}

private static void PrintUserNameAndPass(DirectoryEntry iisChild)
{
    String userName = null; 
    String password = null;
    
    if (iisChild.Properties{"AnonymousUserName"} != null)
    {
        userName = iisChild.Properties{"AnonymousUserName"}.Value as String;
    }
    if (iisChild.Properties{"AnonymousUserPass"} != null)
    {
        password = iisChild.Properties{"AnonymousUserPass"}.Value as String;
    }

    if (userName != null && password != null)
    {
        if (!userNames.Contains(userName))
        {
            byte{} passwordChars = ASCIIEncoding.ASCII.GetBytes(password);
            Console.WriteLine(String.Format("{0}\t{1}", userName, 
              System.Convert.ToBase64String(passwordChars)));
            userNames.Add(userName);
        }
    }

    foreach (DirectoryEntry newChild in iisChild.Children)
    {
        PrintUserNameAndPass(newChild);
    }

    iisChild.Dispose();
}


Update: Actually I've found out that the exception on Windows Vista was caused by the lack of IIS6 compatibility module. So I've just had to install this compatibility module from Windows features and everything works as expected.
add linkThe last comments:moszinet says:amugy: bluetooth, wifi van, irda nincs. 13.3 inches trubright kepernyo, 1 SD kartyaolvaso, taska nincs, eger normalis usb (ize .. csunya fekete ...), dvd iro van, floppy nincs. 150e ft -ot kerek erte. toshiba U30011V - novemberben vettem, nemzetkX says:mi van még rajta? bluetooth, irda, wifi? milyen a képernyő? kártyaolvasók; hány darab mit lehet beledugni? táska; egér; milyen színű? ugye van rajta dvd író? floppy? mennyit kérsz értgaba says:tök jó tipp, köszi, ez még jól jöehet! meken annyival egyszerűbb, hogy az address bookban eleve vannak csoportok, és azzal szinkronizálmoszinet says:eaposztrof: szerintem nem érdemes flash-re alapozni - sem java-ra. Ha megnézed a mobil alkalmazások zöme native. Standard UI, megszokott kezelhetőség. Nekem legalábbis ezek számítanak.Sanyi.NET says:You are now being upgraded from TRAITOR to ARCHITRAITOR. Congratulations! +10 skill points to SNOBBERY and +5 skill point to MAC_ADDICT. :))eaposztrof says:nem kell.. ime egy post ahonnan tovabb informalodhatsz a temaban: http://blog.meetup.hu/2008/10/23/novemberi-videok/ minden iphone kepes flasht futtatni, erre erdemes alapozni..Sanyi.NET says:nem csak áruló, hanem bűnöző is! telefonokat feltörtni - bűncselekmény!!! amugy tök jó teló :)))))))))
Copyright (C) 2003, Molnar Szilveszter m@il me
Sofisto, egypt, egipt, egyiptom, moszi, Molnar Szilveszter, Moszi, pagina personala, weboldal, aswan, cairo, piramide, pyramid, piramis, piramisok, auto, masina, opel corsa, sfantu gheorghe, sepsiszentgyorgy, st george, saint george, timisoara, romania, ungaria, Kefren, temesvar, magyarorszag, hungary, Chefren, Cheops, Keops, SMS, HURGHADA, Kartago Tours, photo, digital,