Пример #1
0
        public static SocksController CreateSocksController(Uri serverUri, String commandChannelId, String HostHeader, String userAgent, SecureString key, List <String> urlPaths, String sessionCookieName, String payloadCookieName, IWebProxy wbProxy = null, short beaconTime = 5000, IImplantLog implantcomms = null, bool sslFullValidation = false)
        {
            IImplantLog icomms = implantcomms ?? new PoshDefaultImplantComms();
            var         config = new SocksClientConfiguration
            {
                CommandChannelSessionId = commandChannelId,
                BeaconTime        = beaconTime,
                UserAgent         = userAgent,
                CommandServerUI   = serverUri,
                UseProxy          = (null != wbProxy),
                URLPaths          = urlPaths,
                ImplantComms      = icomms,
                HostHeader        = HostHeader,
                PayloadCookieName = payloadCookieName,
                SessionCookieName = sessionCookieName,
                //By Default SSL Validation is disabled this is to aid intitial testing
                //of the deployed infrastructure before a Production Release.
                //It is reccomended that this is enabled before deploying to a full Scenario.
                SSLFullValidation = sslFullValidation
            };

            if (null == key)
            {
                throw new Exception("Encryption key is null");
            }

            var socks = new SocksController(config)
            {
                Encryptor    = new DebugSimpleEncryptor(key),
                ImplantComms = icomms
            };

            socks.Initialize();
            return(socks);
        }
Пример #2
0
        public SocksController(SocksClientConfiguration config)
        {
            List <string> mesg = new List <String>();

            if (config == null)
            {
                throw new Exception("Config object is null");
            }
            if (config.CommandServerUI == null)
            {
                mesg.Add("ProxyIP is null");
            }
            if (config.ImplantComms == null)
            {
                throw new Exception("Implant callback is null");
            }

            _config = config;

            if (mesg.Count > 0)
            {
                _error.LogError(mesg);
            }
        }
Пример #3
0
 public CommandCommunicationHandler(IEncryptionHelper encryption, SocksClientConfiguration config, InternalErrorHandler error)
 {
     _encryption  = encryption;
     this._config = config;
     _error       = error;
 }