コード例 #1
0
        public override void SearchPackage(SimPe.Interfaces.Files.IPackageFile pkg, SimPe.Interfaces.Files.IPackedFileDescriptor pfd)
        {
            if (pfd.Type != Data.MetaData.NAME_MAP)
            {
                return;
            }
            SimPe.Plugin.Nmap nmap = new Nmap(FileTable.ProviderRegistry);
            nmap.ProcessData(pfd, pkg);

            //check all stored nMap entries for a match
            foreach (SimPe.Interfaces.Files.IPackedFileDescriptor mypfd in nmap.Items)
            {
                bool   found = false;
                string n     = mypfd.Filename.Trim().ToLower();
                if (compareType == CompareType.Equal)
                {
                    found = n == name;
                }
                else if (compareType == CompareType.Start)
                {
                    found = n.StartsWith(name);
                }
                else if (compareType == CompareType.End)
                {
                    found = n.EndsWith(name);
                }
                else if (compareType == CompareType.Contain)
                {
                    found = n.IndexOf(name) > -1;
                }
                else if (compareType == CompareType.RegExp && reg != null)
                {
                    found = reg.IsMatch(n);
                }

                //we have a match, so add the result item
                if (found)
                {
                    SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem[] rfiis =
                        FileTable.FileIndex.FindFileDiscardingHighInstance(
                            pfd.Instance,
                            mypfd.Group,
                            mypfd.Instance,
                            null);

                    foreach (SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem rfii in rfiis)
                    {
                        ResultGui.AddResult(rfii.Package, rfii.FileDescriptor);
                    }
                }
            }
        }
コード例 #2
0
ファイル: ReportTemplate.cs プロジェクト: shafe123/PenTester
        public void AddReport(Nmap.NmapReport nmap)
        {
            ReportTemplate report = this;

            foreach (Nmap.Host host in nmap.Hosts)
            {
                ReportTemplate.Host newHost = new ReportTemplate.Host()
                {
                    IPAddress = host.IPAddress
                };

                foreach (Nmap.Port p in host.PortsInformation.Ports)
                {
                    ReportTemplate.Port open = new ReportTemplate.Port()
                    {
                        Number = p.Number,
                        Protocol = p.Protocol,
                        Severity = 2,
                        ThreatLevel = "Medium",
                        Description = "Port " + p.Number + " open for " + p.Service.ServiceProduct ?? p.Service.ServiceName,
                        Tool = "nmap"
                    };

                    newHost.OpenPorts.Add(open);
                }

                newHost.OperatingSystem = (from p in host.PortsInformation.Ports
                                           where p.Service.OperatingSystem != null
                                           group p by p.Service.OperatingSystem into sp
                                           orderby sp.Count() descending
                                           select sp).First().Key;

                report.Hosts.Add(newHost);
            }
            FixAdd();
        }
コード例 #3
0
        public static void Parse(CommandToken token, TerminalGame game)
        {
            Console.WriteLine("Command: {0}", token.Command);
            switch (token.Command)
            {
            case "":
            {
                game.Terminal.Write("");
                break;
            }

            case "echo":
            {
                Echo.GetInstance().Init(game, null, token.Args);
                break;
            }

            case "sudo":
            {
                game.Terminal.WriteLine("user is not in the sudoers file.  This incidient will be reported.");
                break;
            }

            case "man":
            {
                break;
            }

            case "ip":
            {
                Ip.GetInstance().Init(game, null, token.Args);
                break;
            }

            case "ifconfig":
            case "ipconfig":
            {
                Ifconfig.GetInstance().Init(game, null, token.Args);
                break;
            }

            case "pwd":
            {
                game.Terminal.WriteLine($"{World.World.GetInstance().Player.ConnectedComp.FileSystem.CurrentDir.Name}");
                break;
            }

            case "cls":
            case "clear":
            {
                game.Terminal.Clear();
                break;
            }

            case "help":
            {
                game.Terminal.WriteLine(Utils.Help.GetHelp());
                break;
            }

            case "reboot":
            {
                break;
            }

            case "shutdown":
            {
                break;
            }

            case "quit":
            case "exit":
            {
                break;
            }

            case "login":
            {
                break;
            }

            case "disconnect":
            case "dc":
            {
                Disconnect.GetInstance().Init(game, null, token.Args);
                break;
            }

            case "connect":
            {
                Connect.GetInstance().Init(game, null, token.Args);
                break;
            }

            case "rm":
            {
                Rm.GetInstance().Init(game, null, token.Args);
                break;
            }

            case "rmdir":
            {
                break;
            }

            case "mkdir":
            {
                Mkdir.GetInstance().Init(game, null, token.Args);
                break;
            }

            case "touch":
            {
                Touch.GetInstance().Init(game, null, token.Args);
                break;
            }

            case "cat":
            {
                Cat.GetInstance().Init(game, null, token.Args);
                break;
            }

            case "ls":
            case "dir":
            {
                Ls.GetInstance().Init(game, null, token.Args);
                break;
            }

            case "cd":
            {
                Cd.GetInstance().Init(game, null, token.Args);
                break;
            }

            case "save":
            {
                World.World.GetInstance().Save();
                game.Terminal.WriteLine("Game saved.");
                break;
            }

            case "nmap":
            {
                Nmap.GetInstance().Init(game, null, token.Args);
                break;
            }

            case "sshnuke":
            {
                Sshnuke.GetIsntance().Init(game, null, token.Args);
                break;
            }

            default:
            {
                game.Terminal.WriteLine(token.Command + " is not a recognized command");
                break;
            }
            }
        }