示例#1
0
 /// <summary>
 /// Creates a connection that will forward the request to the specified host and port
 /// </summary>
 /// <param name="fwHost"></param>
 /// <param name="fwPort"></param>
 /// <param name="client"></param>
 /// <param name="isSecure"></param>
 /// <param name="dataStore"></param>
 /// <param name="networkSettings"></param>
 /// <param name="parentProxy"></param>
 public TrackingReverseProxyConnection(TcpClient client, bool isSecure, ITrafficDataAccessor dataStore, INetworkSettings networkSettings, IHttpProxy parentProxy)
     : base(client, isSecure, dataStore, Resources.TrackingReverseProxyDescription, networkSettings, false)
 {
     _dataStore       = dataStore;
     _parentProxy     = parentProxy;
     _networkSettings = networkSettings;
 }
示例#2
0
        public NetworkClient(INetworkSettings settings, IUriSource uriSource,
                             ISpeedMeasurer speedMeasurer,
                             ILogger logger)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (uriSource == null)
            {
                throw new ArgumentNullException("uriSource");
            }
            if (speedMeasurer == null)
            {
                throw new ArgumentNullException("speedMeasurer");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            this.networkSettings    = settings;
            this.uriSource          = uriSource;
            this.speedMeasurer      = speedMeasurer;
            this.logger             = logger;
            this.defaultTaskFactory = new TaskFactory(TaskScheduler.Default);
        }
示例#3
0
 public SetupForm(ITestRunner testRunner, string workingDir, INetworkSettings networkSettings, bool enableAppScanFeatures = false)
 {
     _testRunner                 = testRunner;
     _networkSettings            = networkSettings;
     _defaultCustomTestsFilePath = GetDefaultCustomTestsFile(workingDir);
     InitializeComponent();
 }
示例#4
0
 public ProxyForm(ITestRunner testRunner, INetworkSettings netSettings, bool isSequential)
 {
     InitializeComponent();
     _testRunner                  = testRunner;
     _isSequentialProxy           = isSequential;
     _networkSettings             = netSettings;
     _proxy                       = _testRunner.GetTestProxy(_networkSettings, _isSequentialProxy);
     Application.ApplicationExit += OnApplicationExit;
 }
示例#5
0
        /// <summary>
        /// Sets proxy settings specifically
        /// </summary>
        /// <param name="proxyHost"></param>
        /// <param name="proxyPort"></param>
        /// <param name="credentials"></param>
        public void SetProxySettings(string proxyHost, int proxyPort, ICredentials credentials)
        {
            if (NetworkSettings == null)
            {
                NetworkSettings = new DefaultNetworkSettings();
            }

            NetworkSettings.WebProxy             = new WebProxy(proxyHost, proxyPort);
            NetworkSettings.WebProxy.Credentials = credentials;
        }
示例#6
0
 /// <summary>
 /// Constructor for the manual proxy connection
 /// </summary>
 /// <param name="tcpClient">TCP client being used</param>
 /// <param name="isSecure">Whether the connection is secure or not</param>
 /// <param name="dataStore">The data store being used</param>
 /// <param name="description">Description to add to the data store for each request</param>
 /// <param name="networkSettings">Network settings to be used for the connection</param>
 public ManualExploreProxyConnection(TcpClient tcpClient,
                                     bool isSecure,
                                     ITrafficDataAccessor dataStore,
                                     string description,
                                     INetworkSettings networkSettings)
     : base(tcpClient, isSecure, dataStore, description)
 {
     _httpClient = new WebRequestClient();
     _httpClient.SetNetworkSettings(networkSettings);
 }
示例#7
0
 /// <summary>
 /// Network settings
 /// </summary>
 /// <param name="netSettings"></param>
 public RequestSender(INetworkSettings netSettings)
 {
     _httpClient = new WebRequestClient();
     if (netSettings == null)
     {
         netSettings = new DefaultNetworkSettings();
         netSettings.CertificateValidationCallback = _certificateValidationCallback;
     }
     _httpClient.SetNetworkSettings(netSettings);
     _httpClient.ShouldHandleCookies = true;
 }
示例#8
0
        public NetworkClientFactory(INetworkSettings networkSettings,
            ISpeedMeasurerFactory speedMeasurerFactory,
            ILogger logger)
        {
            if (networkSettings == null)
                throw new ArgumentNullException("networkSettings");
            if (speedMeasurerFactory == null)
                throw new ArgumentNullException("speedMeasurerFactory");
            if (logger == null)
                throw new ArgumentNullException("logger");

            this.networkSettings = networkSettings;
            this.speedMeasurerFactory = speedMeasurerFactory;
            this.logger = logger;
        }
        public NetworkClient Settings(INetworkSettings settings)
        {
            _urlBase       = settings.UrlBase;
            _urlController = settings.UrlController;
            ClientWeb.DefaultRequestHeaders.Accept.Add(settings.ContentType);
            _contentType          = settings.ContentType;
            ClientWeb.Timeout     = TimeSpan.FromSeconds(3000);
            ClientWeb.BaseAddress = new Uri(_urlBase);

            if (settings.HeaderColletion != null && settings.HeaderColletion.Count != 0)
            {
                SetHeader(settings.HeaderColletion);
            }

            return(this);
        }
示例#10
0
        public BaseAttackProxy GetTestProxy(INetworkSettings networkSettings, bool isSequential)
        {
            BaseAttackProxy testProxy;

            if (isSequential)
            {
                testProxy = new SequentialAttackProxy(this, _testFile, _trafficFile, TrafficViewerOptions.Instance.TrafficServerIp, TrafficViewerOptions.Instance.TrafficServerPort);
            }
            else
            {
                testProxy = new DriveByAttackProxy(this, _testFile, _trafficFile, TrafficViewerOptions.Instance.TrafficServerIp, TrafficViewerOptions.Instance.TrafficServerPort);
            }
            testProxy.NetworkSettings.WebProxy = networkSettings.WebProxy;
            testProxy.NetworkSettings.CertificateValidationCallback = networkSettings.CertificateValidationCallback;

            return(testProxy);
        }
示例#11
0
        public NetworkClientFactory(INetworkSettings networkSettings,
                                    ISpeedMeasurerFactory speedMeasurerFactory,
                                    ILogger logger)
        {
            if (networkSettings == null)
            {
                throw new ArgumentNullException("networkSettings");
            }
            if (speedMeasurerFactory == null)
            {
                throw new ArgumentNullException("speedMeasurerFactory");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            this.networkSettings      = networkSettings;
            this.speedMeasurerFactory = speedMeasurerFactory;
            this.logger = logger;
        }
 internal NetworkSettings(INetworkSettings iSettings)
 {
     _v2Settings = iSettings;
 }
示例#13
0
 /// <summary>
 /// Creates a connection that will forward the request to the specified host and port
 /// </summary>
 /// <param name="fwHost"></param>
 /// <param name="fwPort"></param>
 /// <param name="client"></param>
 /// <param name="isSecure"></param>
 /// <param name="dataStore"></param>
 /// <param name="networkSettings"></param>
 public ReverseProxyConnection(string fwHost, int fwPort, TcpClient client, bool isSecure, ITrafficDataAccessor dataStore, INetworkSettings networkSettings, Dictionary <string, string> replacements)
     : base(client, isSecure, dataStore, Resources.ReverseProxyDescription, networkSettings, false)
 {
     _fwHost = fwHost;
     _fwPort = fwPort;
 }
示例#14
0
        /// <summary>
        /// Constructor for an advanced proxy connection
        /// </summary>
        /// <param name="tcpClient"></param>
        /// <param name="isSecure"></param>
        /// <param name="dataStore"></param>
        /// <param name="description"></param>
        /// <param name="networkSettings">Settings used for the connection, proxy etc.</param>
        /// <param name="replacements">Strings to be replaced in the request</param>
        public AdvancedExploreProxyConnection(TcpClient tcpClient, bool isSecure, ITrafficDataAccessor dataStore, string description, INetworkSettings networkSettings, bool trackRequestContext)
            : base(tcpClient, isSecure, dataStore, description, networkSettings)
        {
            _requestReplacements  = dataStore.Profile.GetRequestReplacements();
            _responseReplacements = dataStore.Profile.GetResponseReplacements();
            _trackRequestContext  = trackRequestContext;

            _autoTrackingPatternList = new Dictionary <string, TrackingPattern>();

            _dynamicReplacements.Add(Constants.SEQUENCE_VAR_PATTERN, () => { return(DateTime.Now.Ticks.ToString()); });
            _dynamicReplacements.Add(Constants.GUID_VAR_PATTERN, () => { return(Guid.NewGuid().ToString()); });
            _dynamicReplacements.Add("__RSHORT__", () => { return(this._rng.Next(0, short.MaxValue).ToString()); });

            var trackingPatterns = dataStore.Profile.GetTrackingPatterns();

            foreach (var key in trackingPatterns.Keys)
            {
                TrackingPattern item = trackingPatterns[key];
                if (item.TrackingType == TrackingType.AutoDetect)
                {
                    _autoTrackingPatternList.Add(item.Name, item);
                }
            }
        }
示例#15
0
 public void SetNetworkSettings(INetworkSettings networkSettings)
 {
     throw new NotImplementedException();
 }
示例#16
0
 /// <summary>
 /// Sets various settings such as proxy, ssl callback and credentials for a spefic host
 /// </summary>
 /// <param name="networkSettings"></param>
 public void SetNetworkSettings(INetworkSettings networkSettings)
 {
     NetworkSettings = networkSettings;
 }
示例#17
0
        public NetworkClient(INetworkSettings settings, IUriSource uriSource,
            ISpeedMeasurer speedMeasurer,
            ILogger logger)
        {
            if (settings == null)
                throw new ArgumentNullException("settings");
            if (uriSource == null)
                throw new ArgumentNullException("uriSource");
            if (speedMeasurer == null)
                throw new ArgumentNullException("speedMeasurer");
            if (logger == null)
                throw new ArgumentNullException("logger");

            this.networkSettings = settings;
            this.uriSource = uriSource;
            this.speedMeasurer = speedMeasurer;
            this.logger = logger;
            this.defaultTaskFactory = new TaskFactory(TaskScheduler.Default);
        }
 /// <summary>
 /// Does nothing for this client
 /// </summary>
 /// <param name="networkSettings"></param>
 public void SetNetworkSettings(INetworkSettings networkSettings)
 {
     ;             //do nothing
 }
示例#19
0
 internal NetworkSettings(INetworkSettings iSettings)
 {
     _v2Settings = iSettings;
 }
示例#20
0
 public DriveByAttackProxyConnection(TcpClient tcpClient, bool isSecure, INetworkSettings networkSettings, DriveByAttackProxy parentProxy, ITrafficDataAccessor dataStore) :
     base(tcpClient, isSecure, dataStore, "Drive By Attack Proxy", networkSettings, false)
 {
     _parentProxy = parentProxy;
 }
示例#21
0
 public void SetNetworkSettings(INetworkSettings networkSettings)
 {
     ;             //doesn't do anything
 }