Пример #1
0
        public BruteSharkCli()
        {
            _tcpPacketsCount  = 0;
            _tcpSessionsCount = 0;
            _printingLock     = new object();
            _passwords        = new HashSet <PcapAnalyzer.NetworkPassword>();
            _hashes           = new HashSet <NetworkHash>();
            _files            = new List <string>();

            _processor = new PcapProcessor.Processor();
            _analyzer  = new PcapAnalyzer.Analyzer();
            _shell     = new CliShell(seperator: "Brute-Shark > ");

            // TODO: create command for this.
            _processor.BuildTcpSessions = true;

            // Contract the events.
            _processor.UdpPacketArived   += (s, e) => _analyzer.Analyze(CastProcessorUdpPacketToAnalyzerUdpPacket(e.Packet));
            _processor.TcpPacketArived   += (s, e) => _analyzer.Analyze(CastProcessorTcpPacketToAnalyzerTcpPacket(e.Packet));
            _processor.TcpPacketArived   += (s, e) => this.UpdateTcpPacketsCount();
            _processor.TcpSessionArived  += (s, e) => this.UpdateTcpSessionsCount();
            _processor.TcpSessionArived  += (s, e) => _analyzer.Analyze(CastProcessorTcpSessionToAnalyzerTcpSession(e.TcpSession));
            _analyzer.ParsedItemDetected += OnParsedItemDetected;

            // Add commands to the Cli Shell.
            _shell.AddCommand(new CliShellCommand("add-file", p => _files.Add(p), "Add file to analyze. Usage: add-file <FILE-PATH>"));
            _shell.AddCommand(new CliShellCommand("start", p => StartAnalyzing(), "Start analyzing"));
            _shell.AddCommand(new CliShellCommand("show-passwords", p => PrintPasswords(), "Print passwords."));
            _shell.AddCommand(new CliShellCommand("show-hashes", p => PrintHashes(), "Print Hashes"));
            _shell.AddCommand(new CliShellCommand("export-hashes", p => ExportHashes(p), "Export all Hashes to Hascat format input files. Usage: export-hashes <OUTPUT-DIRECTORY>"));
        }
Пример #2
0
        private void RunShellMode()
        {
            var shell = new CliShell(_analyzer, _processor, seperator: "Brute-Shark > ");

            shell.Start();
        }