public PersistentMetasploitModuleAuthor(MetasploitModuleAuthor author)
 {
     this.Email = author.Email;
     this.RemoteModuleDetailID = author.RemoteModuleDetailID;
     this.Name = author.Name;
     this.RemoteID = author.RemoteID;
 }
        public MetasploitModuleDetails(XmlNode deets)
        {
            foreach (XmlNode child in deets.ChildNodes)
            {
                if (child.Name == "id")
                {
                    this.RemoteID = string.IsNullOrEmpty(child.InnerText) ? -1 : int.Parse(child.InnerText);
                }
                else if (child.Name == "mtime")
                {
                }
                else if (child.Name == "file")
                {
                    this.File = child.InnerText;
                }
                else if (child.Name == "mtype")
                {
                    this.ModuleType = child.InnerText;
                }
                else if (child.Name == "refname")
                {
                    this.ReferenceName = child.InnerText;
                }
                else if (child.Name == "fullname")
                {
                    this.FullName = child.InnerText;
                }
                else if (child.Name == "rank")
                {
                    this.Rank = string.IsNullOrEmpty(child.InnerText) ? -1 : int.Parse(child.InnerText);
                }
                else if (child.Name == "description")
                {
                    this.Description = child.InnerText;
                }
                else if (child.Name == "license")
                {
                    this.License = child.InnerText;
                }
                else if (child.Name == "privileged")
                {
                }
                else if (child.Name == "disclosure-date")
                {
                    this.DisclosureDate = child.InnerText;
                }
                else if (child.Name == "default-target")
                {
                    this.DefaultTarget = string.IsNullOrEmpty(child.InnerText) ? -1 :  int.Parse(child.InnerText);
                }
                else if (child.Name == "default-action")
                {
                }
                else if (child.Name == "stance")
                {
                    this.Stance = child.InnerText;
                }
                else if (child.Name == "ready")
                {
                    this.Ready = Boolean.Parse(child.InnerText);
                }
                else if (child.Name == "module_authors")
                {
                    this.Authors = new List <MetasploitModuleAuthor>();
                    int i = 0;
                    MetasploitModuleAuthor author = new MetasploitModuleAuthor();
                    foreach (XmlNode info in child.ChildNodes)
                    {
                        if (info.Name == "id")
                        {
                            author.RemoteID = string.IsNullOrEmpty(child.InnerText) ? -1 : int.Parse(info.InnerText);
                        }
                        else if (info.Name == "module-detail-id")
                        {
                            author.RemoteModuleDetailID = string.IsNullOrEmpty(child.InnerText) ? -1 : int.Parse(info.InnerText);
                        }
                        else if (info.Name == "name")
                        {
                            author.Name = info.InnerText;
                        }
                        else if (info.Name == "email")
                        {
                            author.Email = info.InnerText;
                        }

                        i++;

                        if (i == 3)
                        {
                            this.Authors.Add(author);
                            author = new MetasploitModuleAuthor();
                            i      = 0;
                        }
                    }
                }
                else if (child.Name == "module_refs")
                {
                    this.References = new List <MetasploitModuleReference>();
                    int i = 0;
                    MetasploitModuleReference refr = new MetasploitModuleReference();
                    foreach (XmlNode reff in child.ChildNodes)
                    {
                        if (reff.Name == "id")
                        {
                            refr.RemoteID = string.IsNullOrEmpty(child.InnerText) ? -1 :  int.Parse(reff.InnerText);
                        }
                        else if (reff.Name == "module-detail-id")
                        {
                            refr.RemoteModuleDetailID = string.IsNullOrEmpty(child.InnerText) ? -1 : int.Parse(reff.InnerText);
                        }
                        else if (reff.Name == "name")
                        {
                            refr.Name = child.InnerText;
                        }

                        i++;
                        if (i == 3)
                        {
                            this.References.Add(refr);
                            refr = new MetasploitModuleReference();
                            i    = 0;
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public MetasploitModuleDetails(XmlNode deets)
        {
            foreach (XmlNode child in deets.ChildNodes)
            {
                if (child.Name == "id")
                    this.RemoteID = string.IsNullOrEmpty(child.InnerText) ? -1 : int.Parse(child.InnerText);
                else if (child.Name == "mtime")
                {}
                else if (child.Name == "file")
                    this.File = child.InnerText;
                else if (child.Name == "mtype")
                    this.ModuleType = child.InnerText;
                else if (child.Name == "refname")
                    this.ReferenceName = child.InnerText;
                else if (child.Name == "fullname")
                    this.FullName = child.InnerText;
                else if (child.Name == "rank")
                    this.Rank =  string.IsNullOrEmpty(child.InnerText) ? -1 : int.Parse(child.InnerText);
                else if (child.Name == "description")
                    this.Description = child.InnerText;
                else if (child.Name == "license")
                    this.License = child.InnerText;
                else if (child.Name == "privileged")
                {}
                else if (child.Name == "disclosure-date")
                    this.DisclosureDate = child.InnerText;
                else if (child.Name == "default-target")
                    this.DefaultTarget = string.IsNullOrEmpty(child.InnerText) ? -1 :  int.Parse(child.InnerText);
                else if (child.Name == "default-action")
                {}
                else if (child.Name == "stance")
                    this.Stance = child.InnerText;
                else if (child.Name == "ready")
                    this.Ready = Boolean.Parse(child.InnerText);
                else if (child.Name == "module_authors")
                {
                    this.Authors = new List<MetasploitModuleAuthor>();
                    int i = 0;
                    MetasploitModuleAuthor author = new MetasploitModuleAuthor();
                    foreach (XmlNode info in child.ChildNodes)
                    {
                        if (info.Name == "id")
                            author.RemoteID =  string.IsNullOrEmpty(child.InnerText) ? -1 : int.Parse(info.InnerText);
                        else if (info.Name == "module-detail-id")
                            author.RemoteModuleDetailID =  string.IsNullOrEmpty(child.InnerText) ? -1 : int.Parse(info.InnerText);
                        else if (info.Name == "name")
                            author.Name = info.InnerText;
                        else if (info.Name == "email")
                            author.Email = info.InnerText;

                        i++;

                        if (i == 3)
                        {
                            this.Authors.Add(author);
                            author = new MetasploitModuleAuthor();
                            i = 0;
                        }
                    }
                }
                else if (child.Name == "module_refs")
                {
                    this.References = new List<MetasploitModuleReference>();
                    int i = 0;
                    MetasploitModuleReference refr = new MetasploitModuleReference();
                    foreach (XmlNode reff in child.ChildNodes)
                    {
                        if (reff.Name == "id")
                            refr.RemoteID = string.IsNullOrEmpty(child.InnerText) ? -1 :  int.Parse(reff.InnerText);
                        else if (reff.Name == "module-detail-id")
                            refr.RemoteModuleDetailID =  string.IsNullOrEmpty(child.InnerText) ? -1 : int.Parse(reff.InnerText);
                        else if (reff.Name == "name")
                            refr.Name = child.InnerText;

                        i++;
                        if (i == 3)
                        {
                            this.References.Add(refr);
                            refr = new MetasploitModuleReference();
                            i = 0;
                        }
                    }
                }

            }
        }