Пример #1
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            ////if (IsInDesignMode)
            ////{
            ////    // Code runs in Blend --> create design time data.
            ////}
            ////else
            ////{
            ////    // Code runs "for real"
            ////}

            Log = new ObservableCollection<string>();
            Recognizers = SpeechEngineManager.Recognizers;
            SelectedRecognizer = Recognizers.Any() ? Recognizers.First() : null;

            Start = new RelayCommand(() =>
                {
                    if (listener != null && listener.Recognizer != SelectedRecognizer)
                    {
                        Stop.Execute(null);
                    }

                    listener = new CommandListener(SelectedRecognizer);
                    listener.LogEvent += listener_LogEvent;
                    listener.Start();

                    Log.Add("Started speech command listener " + SelectedRecognizer.Id);
                });

            Stop = new RelayCommand(() =>
                {
                    Log.Add("Stopping speech command listener " + listener.Recognizer.Id);

                    if (listener != null && listener.Recognizer != SelectedRecognizer)
                    {
                        listener.LogEvent -= listener_LogEvent;

                        listener.Dispose();
                        listener = null;
                    }
                    else
                    {
                        listener.Stop();
                    }
                });

            Speak = new RelayCommand(() =>
                {
                    SpeechSynthesizer synth = new SpeechSynthesizer();
                    synth.SetOutputToDefaultAudioDevice();
                    synth.Speak("Lorem ipsum dolor sit am.");
                });
        }
Пример #2
0
        // todo: сохранять логин/пароль юзеров в файле. Хватит текстового.
        // todo: хранить непрочитанные сообщения пользователя в файле. Пожалуй, с именем как имя пользователя. username@myServer

        private static void Main(string[] args)
        {
            Console.WriteLine("TcpServer Starting...");

            //MessageHandler.OnSaveUserCommand += CommandListener_OnSaveUserCommand;
            //
            //



            var commandListener = new CommandListener(HandleClientMessage);

            commandListener.Start();
            Console.WriteLine("TcpServer Started. Press any key to exit.");
            Console.ReadKey();
            commandListener.Stop();
        }
Пример #3
0
        static void Main(string[] args)
        {
            var scaleFactor = GetScaleFactor();
            var fps         = GetFPS();
            var recorder    = new Recorder(scaleFactor, fps);

            recorder.Start(3000);

            var commandListener = new CommandListener();

            commandListener.Start(3001);
            commandListener.OnMouseDown = OnMouseDown;
            commandListener.OnMouseUp   = OnMouseUp;
            commandListener.ListenForCommands();

            Console.WriteLine("Server started! Listening for connections...");
            Console.ReadLine();
        }
Пример #4
0
        public ImpostorHqPlugin(ILogger <ImpostorHqPlugin> logger, IEventManager eventManager, IGameManager gameManager, IMessageWriterProvider messageWriterProvider, IClientManager clientManager)
        {
            ImpostorHqR.Extension.Api.Registry.Impostor.ClientManager         = clientManager;
            ImpostorHqR.Extension.Api.Registry.Impostor.EventManager          = eventManager;
            ImpostorHqR.Extension.Api.Registry.Impostor.GameManager           = gameManager;
            ImpostorHqR.Extension.Api.Registry.Impostor.Logger                = logger;
            ImpostorHqR.Extension.Api.Registry.Impostor.MessageWriterProvider = messageWriterProvider;

            ReusableStringBuilderPool.Initialize();
            LoggingManager.Initialize();
            ConfigurationLoader.LoadConfigs(typeof(ImpostorHqPlugin).Assembly);
            ServiceManager.Init();
            ImpostorEventListenerCreator.Initialize();
            CommandProcessor.Start();
            CommandListener.Start();
            HelpCommandRegister.Register();
            WebBinder.Bind();
            WebApiListener.Start();
            HttpServer.Start();
            ExtensionLoader.Initialize();
            ExtensionLoader.Start();
        }
Пример #5
0
        static int Main(string[] args)
        {
            // hacer load, reload, probar el global con payload, hacer el listen general con un handler, no cargar exploits sin el load

            // Linq to library assembly
            BuildLink.Dummy();

            // Configure
            //Console.InputEncoding = Encoding.UTF8;
            //Console.OutputEncoding = Encoding.UTF8;
            ConsoleCommand command = new ConsoleCommand();

            command.AddInput("banner");
            //command.AddInput("load \"XPloit.Modules.dll\"");

            //command.AddInput("use Auxiliary/Local/System");
            //command.AddInput("version");

            Console.CursorSize    = 100;
            Console.CursorVisible = false;

            command.SetBackgroundColor(ConsoleColor.White);
            command.SetBackgroundColor(ConsoleColor.Black);

            // TODO: Fix \"CryptKey=#Crypt0 M3#\" -> broken line whith white space
            // \"CryptKey=#Crypt0M3#\"
            Config cfg = ArgumentHelper.Parse <Config>(args);// ("\"Resource=d:\\temp\\console.txt\" \"Listen={Port=23 CryptKey=#Test# IPFilter={OnlyAllowed=127.0.0.1,172.22.32.51}}\" \"User={UserName=root Password=toor}\"");

            // Run file
            if (!string.IsNullOrEmpty(cfg.Resource))
            {
                try
                {
                    command.SetForeColor(ConsoleColor.Gray);
                    command.Write(Lang.Get("Reading_File", cfg.Resource));

                    foreach (string line in File.ReadAllLines(cfg.Resource))
                    {
                        string ap = line.Trim();
                        if (string.IsNullOrEmpty(ap))
                        {
                            continue;
                        }
                        command.AddInput(ap);
                    }

                    command.SetForeColor(ConsoleColor.Green);
                    command.WriteLine(Lang.Get("Ok").ToUpperInvariant());
                }
                catch
                {
                    command.SetForeColor(ConsoleColor.Red);
                    command.WriteLine(Lang.Get("Error").ToUpperInvariant());
                }
            }

            if (cfg.Connect != null)
            {
                // Connect to server
                SocketListener client = new SocketListener(cfg.Connect);

                command.SetForeColor(ConsoleColor.Gray);
                command.Write(Lang.Get("Connecting_To", client.ToString()));
                if (client.Start())
                {
                    command.SetForeColor(ConsoleColor.Green);
                    command.WriteLine(Lang.Get("Ok").ToUpperInvariant());
                }
                else
                {
                    command.SetForeColor(ConsoleColor.Red);
                    command.WriteLine(Lang.Get("Error").ToUpperInvariant());
                }

                command.SetForeColor(ConsoleColor.DarkGray);
                command.WriteLine(Lang.Get("Press_Any_Key"));

                Console.ReadKey();
            }
            else
            {
                List <IListener> listeners = new List <IListener>();

                // Launch socket listener
                if (cfg.Listen != null)
                {
                    listeners.Add(new SocketListener(cfg.Listen));
                }

                // Run listeners
                foreach (IListener listener in listeners)
                {
                    command.SetForeColor(ConsoleColor.Gray);
                    command.Write(Lang.Get("Starting_Listener", listener.ToString()));

                    if (listener.Start())
                    {
                        command.SetForeColor(ConsoleColor.Green);
                        command.WriteLine(Lang.Get("Ok").ToUpperInvariant());
                    }
                    else
                    {
                        command.SetForeColor(ConsoleColor.Red);
                        command.WriteLine(Lang.Get("Error").ToUpperInvariant());
                    }
                }

                // Console listener
                CommandListener cmd = new CommandListener(command);
                cmd.Start();
            }

            // Wait exit signal
            JobCollection.Current.KillAll();
            return(0);
        }
Пример #6
0
        static int Main(string[] args)
        {
            // hacer load, reload, probar el global con payload, hacer el listen general con un handler, no cargar exploits sin el load

            // Linq to library assembly
            BuildLink.Dummy();

            // Configure
            //Console.InputEncoding = Encoding.UTF8;
            //Console.OutputEncoding = Encoding.UTF8;
            using (CommandLayer command = new CommandLayer(new ConsoleIO()))
            {
                command.SetBackgroundColor(ConsoleColor.White);
                command.SetBackgroundColor(ConsoleColor.Black);

                command.AddInput("banner");
#if DEBUG
                if (Debugger.IsAttached)
                {
                    command.AddInput("Play Debug.txt");
                }
#endif

                if (GeoLite2LocationProvider.Current == null)
                {
                    /// TODO: Config the default GeoIp
                    if (GeoLite2LocationProvider.LoadCurrent(
                            Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"GeoLite2", "GeoLite2-Blocks-IP.csv.gz"),
                            Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"GeoLite2", "GeoLite2-City-Locations-es.csv.gz")))
                    {
                        command.WriteInfo("Loaded GeoIp", GeoLite2LocationProvider.Current.Count.ToString(), ConsoleColor.Green);
                    }
                }

                // TODO: Fix \"CryptKey=#Crypt0 M3#\" -> broken line whith white space
                // \"CryptKey=#Crypt0M3#\"
                Config cfg = ArgumentHelper.Parse <Config>(args);// ("\"Replay=d:\\temp\\console.txt\" \"Listen={Port=23 CryptKey=#Test# IPFilter={OnlyAllowed=127.0.0.1,172.22.32.51}}\" \"User={UserName=root Password=toor}\"");

                // Run file
                if (!string.IsNullOrEmpty(cfg.Play))
                {
                    try
                    {
                        command.SetForeColor(ConsoleColor.Gray);
                        command.Write(Lang.Get("Reading_File", cfg.Play));

                        foreach (string line in File.ReadAllLines(cfg.Play, Encoding.UTF8))
                        {
                            string ap = line.Trim();
                            if (string.IsNullOrEmpty(ap) || ap.StartsWith("#") || ap.StartsWith("//"))
                            {
                                continue;
                            }
                            command.AddInput(ap);
                        }

                        command.SetForeColor(ConsoleColor.Green);
                        command.WriteLine(Lang.Get("Ok").ToUpperInvariant());
                    }
                    catch
                    {
                        command.SetForeColor(ConsoleColor.Red);
                        command.WriteLine(Lang.Get("Error").ToUpperInvariant());
                    }
                }

                if (cfg.Connect != null)
                {
                    // Connect to server
                    SocketListener client = new SocketListener(cfg.Connect);

                    command.SetForeColor(ConsoleColor.Gray);
                    command.Write(Lang.Get("Connecting_To", client.ToString()));
                    if (client.Start())
                    {
                        command.SetForeColor(ConsoleColor.Green);
                        command.WriteLine(Lang.Get("Ok").ToUpperInvariant());
                    }
                    else
                    {
                        command.SetForeColor(ConsoleColor.Red);
                        command.WriteLine(Lang.Get("Error").ToUpperInvariant());
                    }

                    command.SetForeColor(ConsoleColor.DarkGray);
                    command.WriteLine(Lang.Get("Press_Any_Key"));

                    Console.ReadKey();
                }
                else
                {
                    List <IListener> listeners = new List <IListener>();

                    // Launch socket listener
                    if (cfg.Listen != null)
                    {
                        listeners.Add(new SocketListener(cfg.Listen));
                    }

                    // Run listeners
                    foreach (IListener listener in listeners)
                    {
                        command.SetForeColor(ConsoleColor.Gray);
                        command.Write(Lang.Get("Starting_Listener", listener.ToString()));

                        if (listener.Start())
                        {
                            command.SetForeColor(ConsoleColor.Green);
                            command.WriteLine(Lang.Get("Ok").ToUpperInvariant());
                        }
                        else
                        {
                            command.SetForeColor(ConsoleColor.Red);
                            command.WriteLine(Lang.Get("Error").ToUpperInvariant());
                        }
                    }

                    // Console listener
                    CommandListener cmd = new CommandListener(command);
                    cmd.Start();
                }
            }

            // Wait exit signal
            JobCollection.Current.KillAll();
            return(0);
        }
Пример #7
0
 public Form Run()
 {
     _view.Show();
     _commandListener.Start();
     return(_view.GetForm());
 }