コード例 #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 SocksLoopController(IImplantLog icomms, CommandCommunicationHandler comms, Int16 beaconTime)
 {
     ImplantComms    = icomms;
     CmdCommshandler = comms;
     BeaconTime      = beaconTime;
     socketComms     = new SocksSocketComms()
     {
         ImplantComms = ImplantComms, CmdCommshandler = comms, BeaconTime = beaconTime
     };
     _socketCommsTasks.Add(Task.Factory.StartNew(() => socketComms.WriteToSocket(), TaskCreationOptions.LongRunning));
     _socketCommsTasks.Add(Task.Factory.StartNew(() => socketComms.ReadFromSocket(), TaskCreationOptions.LongRunning));
     _socketCommsTasks.Add(Task.Factory.StartNew(() => socketComms.SendToTarget(), TaskCreationOptions.LongRunning));
 }
コード例 #3
0
 public InternalErrorHandler(IImplantLog implantComms)
 {
     _implantComms = implantComms;
 }