Пример #1
0
        public void Run(string[] args, string work, FileSystem fs, IConsole console, IRedTeamContext ctx, bool disposeConsole = true)
        {
            if (_running)
            {
                throw new InvalidOperationException("Command has already been run.");
            }

            _disposeConsole   = disposeConsole;
            _userContext      = ctx ?? throw new ArgumentNullException(nameof(ctx));
            _args             = args ?? throw new ArgumentNullException(nameof(args));
            _workingDirectory = work ?? throw new ArgumentNullException(nameof(work));
            _fs      = fs ?? throw new ArgumentNullException(nameof(fs));
            _console = console ?? throw new ArgumentNullException(nameof(console));
            _network = new NetworkManager(_userContext);
            _home    = _userContext.HomeDirectory;

            try
            {
                Main(args);
            }
            catch (Exception ex)
            {
                console.WriteLine("{0}: error: {1}", Name, ex.Message);
                EntryPoint.CurrentApp.Logger.LogException(ex, LogLevel.Warning);
                Complete();
            }
        }
Пример #2
0
        public void OpenFile(Scene hackerScene, IRedTeamContext ctx, string filePath)
        {
            _scene    = hackerScene ?? throw new ArgumentNullException(nameof(hackerScene));
            _ctx      = ctx ?? throw new ArgumentNullException(nameof(ctx));
            _filePath = filePath;

            // Create the app window pane.
            _window = _scene.GetSystem <WindowManager>().CreateFloatingPane(Name);

            Main();
        }
Пример #3
0
 public NetworkManager(IRedTeamContext ctx)
 {
     _ctx = ctx;
 }
Пример #4
0
 public DisplayRequestedEventArgs(IRedTeamContext ctx, string file)
 {
     Context       = ctx;
     FilePath      = file;
     DisplayWindow = DisplayWindow;
 }