Ejemplo n.º 1
0
        public MainForm()
        {
            InitializeComponent();

            _files = new HashSet <string>();

            // Create the DAL and BLL objects.
            _processor = new PcapProcessor.Processor();
            _analyzer  = new PcapAnalyzer.Analyzer();
            _processor.BuildTcpSessions = true;

            // Create the user controls.
            _networkMapUserControl            = new NetworkMapUserControl();
            _networkMapUserControl.Dock       = DockStyle.Fill;
            _sessionsExplorerUserControl      = new SessionsExplorerUserControl();
            _sessionsExplorerUserControl.Dock = DockStyle.Fill;
            _hashesUserControl         = new HashesUserControl();
            _hashesUserControl.Dock    = DockStyle.Fill;
            _passwordsUserControl      = new GenericTableUserControl();
            _passwordsUserControl.Dock = DockStyle.Fill;

            // Contract the events.
            _processor.TcpPacketArived           += (s, e) => _analyzer.Analyze(Casting.CastProcessorTcpPacketToAnalyzerTcpPacket(e.Packet));
            _processor.TcpSessionArived          += (s, e) => _analyzer.Analyze(Casting.CastProcessorTcpSessionToAnalyzerTcpSession(e.TcpSession));
            _processor.FileProcessingStarted     += (s, e) => SwitchToMainThreadContext(() => OnFileProcessStart(s, e));
            _processor.FileProcessingEnded       += (s, e) => SwitchToMainThreadContext(() => OnFileProcessEnd(s, e));
            _processor.ProcessingPrecentsChanged += (s, e) => SwitchToMainThreadContext(() => OnProcessingPrecentsChanged(s, e));
            _analyzer.ParsedItemDetected         += (s, e) => SwitchToMainThreadContext(() => OnParsedItemDetected(s, e));
            _processor.TcpSessionArived          += (s, e) => SwitchToMainThreadContext(() => OnSessionArived(Casting.CastProcessorTcpSessionToBruteSharkDesktopTcpSession(e.TcpSession)));
            _processor.ProcessingFinished        += (s, e) => SwitchToMainThreadContext(() => OnProcessingFinished(s, e));

            InitilizeFilesIconsList();
            this.modulesTreeView.ExpandAll();
        }
Ejemplo n.º 2
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>"));
        }
Ejemplo n.º 3
0
        public CliShell(PcapAnalyzer.Analyzer analyzer, PcapProcessor.Processor processor, string seperator = ">")
        {
            _tcpPacketsCount  = 0;
            _udpPacketsCount  = 0;
            _udpStreamsCount  = 0;
            _tcpSessionsCount = 0;

            this.Seperator = seperator;
            _printingLock  = new object();
            _files         = new List <string>();

            _processor = processor;
            _analyzer  = analyzer;

            _analyzer.ParsedItemDetected += OnParsedItemDetected;
            _processor.TcpPacketArived   += (s, e) => this.UpdateTcpPacketsCount();
            _processor.UdpPacketArived   += (s, e) => this.UpdateUdpPacketsCount();
            _processor.TcpSessionArrived += (s, e) => this.UpdateTcpSessionsCount();
            _processor.UdpSessionArrived += (s, e) => this.UpdateUdpStreamsCount();

            _hashes      = new HashSet <PcapAnalyzer.NetworkHash>();
            _passwords   = new HashSet <PcapAnalyzer.NetworkPassword>();
            _connections = new HashSet <PcapAnalyzer.NetworkConnection>();

            this._commands = new List <CliShellCommand>();
            AddCommand(new CliShellCommand("add-file", p => AddFile(p), "Add file to analyze. Usage: add-file <FILE-PATH>"));
            AddCommand(new CliShellCommand("start", p => StartAnalyzing(), "Start analyzing"));
            AddCommand(new CliShellCommand("show-passwords", p => PrintPasswords(), "Print passwords."));
            AddCommand(new CliShellCommand("show-modules", p => PrintModules(), "Print modules."));
            AddCommand(new CliShellCommand("show-hashes", p => PrintHashes(), "Print Hashes"));
            AddCommand(new CliShellCommand("show-networkmap", p => PrintNetworkMap(), "Prints the network map as a json string. Usage: show-networkmap"));
            AddCommand(new CliShellCommand("export-hashes", p => Utilities.ExportHashes(p, _hashes), "Export all Hashes to Hascat format input files. Usage: export-hashes <OUTPUT-DIRECTORY>"));
            AddCommand(new CliShellCommand("export-networkmap", p => CommonUi.Exporting.ExportNetworkMap(p, _connections), "Export network map to a json file for neo4j. Usage: export-networkmap <OUTPUT-file>"));

            // Add the help command
            this.AddCommand(new CliShellCommand(
                                "help",
                                param => this.PrintCommandsWithDescription(),
                                "Print help menu"));

            // Add the exit command
            this.AddCommand(new CliShellCommand(
                                "exit",
                                param => this._exit = true,
                                "Exit CLI"));

            LoadModules(_analyzer.AvailableModulesNames);
        }
Ejemplo n.º 4
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;
        }