Esempio n. 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.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>"));
        }
Esempio n. 2
0
        public BruteSharkCli(string[] args)
        {
            _args      = args;
            _processor = new PcapProcessor.Processor();
            _analyzer  = new PcapAnalyzer.Analyzer();

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

            // Contract the events.
            _processor.UdpPacketArived   += (s, e) => _analyzer.Analyze(CommonUi.Casting.CastProcessorUdpPacketToAnalyzerUdpPacket(e.Packet));
            _processor.TcpPacketArived   += (s, e) => _analyzer.Analyze(CommonUi.Casting.CastProcessorTcpPacketToAnalyzerTcpPacket(e.Packet));
            _processor.TcpSessionArrived += (s, e) => _analyzer.Analyze(CommonUi.Casting.CastProcessorTcpSessionToAnalyzerTcpSession(e.TcpSession));
            _processor.UdpSessionArrived += (s, e) => _analyzer.Analyze(CommonUi.Casting.CastProcessorUdpStreamToAnalyzerUdpStream(e.UdpSession));
        }
Esempio n. 3
0
        public Cli()
        {
            _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();

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

            // Contract the events.
            _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;
        }