Beispiel #1
0
        static void ListSystemUsers(RegistryHive samHive)
        {
            NodeKey key  = GetNodeKey(samHive, "SAM\\Domains\\Account\\Users\\Names");
            string  sKey = "TEMP";

            foreach (NodeKey child in key.ChildNodes)
            {
                if (child.Name == sKey)
                {
                    continue;
                }
                else
                {
                    sKey = child.Name;
                    Console.WriteLine(child.Name);
                }
            }
        }
Beispiel #2
0
        private void ParseChildNodes(BinaryReader hive)
        {
            int  count     = hive.ReadInt16();
            long topOfList = hive.BaseStream.Position;

            for (int i = 0; i < count; i++)
            {
                hive.BaseStream.Position = topOfList + (i * 8);
                int newoffset = hive.ReadInt32();
                hive.BaseStream.Position += 4;
                hive.BaseStream.Position  = 4096 + newoffset + 4;

                NodeKey nk = new NodeKey(hive)
                {
                    ParentNodeKey = this
                };
                this.ChildNodes.Add(nk);
                this.ChildNodes.Add(nk);
            }
            hive.BaseStream.Position = topOfList + (count * 8);
        }
Beispiel #3
0
        static NodeKey GetNodeKey(RegistryHive hive, string path)
        {
            NodeKey node = null;

            string[] paths = path.Split('\\');

            foreach (string ch in paths)
            {
                if (node == null)
                {
                    node = hive.RootKey;
                }

                foreach (NodeKey child in node.ChildNodes)
                {
                    if (child.Name == ch)
                    {
                        node = child;
                        break;
                    }
                }
            }
            return(node);
        }