Пример #1
0
 internal Socks5Client(Socket clientSocket, DestroyDelegate destroy, AuthenticationList authList, ref LogMain log)
 {
     _ClientSocket = clientSocket;
     _Destroyer    = destroy;
     _AuthList     = authList;
     Log           = log;
 }
Пример #2
0
 public HttpClient(Socket clientSocket, DestroyDelegate destroyer)
 {
     ClientSocket  = clientSocket;
     _destroyer    = destroyer;
     RequestedPath = null;
     HeaderFields  = null;
 }
Пример #3
0
 protected Client(Socket clientSocket, DestroyDelegate destroyer)
 {
     _mBuffer = new byte[0x1000];
     _mRemoteBuffer = new byte[0x400];
     ClientSocket = clientSocket;
     _destroyer = destroyer;
 }
Пример #4
0
 public RelayThread(SocketConnection ClientConnection, SocketConnection RemoteConnection, DestroyDelegate Destroyer, Client client)
 {
     this.ClientConnection = ClientConnection;
     this.RemoteConnection = RemoteConnection;
     this.Destroyer        = Destroyer;
     this.client           = client;
 }
Пример #5
0
 protected Client()
 {
     _mBuffer       = new byte[0x1000];
     _mRemoteBuffer = new byte[0x400];
     ClientSocket   = null;
     _destroyer     = null;
 }
Пример #6
0
 protected Client()
 {
     _mBuffer = new byte[0x1000];
     _mRemoteBuffer = new byte[0x400];
     ClientSocket = null;
     _destroyer = null;
 }
Пример #7
0
 protected Client(Socket clientSocket, DestroyDelegate destroyer)
 {
     _mBuffer       = new byte[0x1000];
     _mRemoteBuffer = new byte[0x400];
     ClientSocket   = clientSocket;
     _destroyer     = destroyer;
 }
Пример #8
0
 public HttpClient(Socket clientSocket, DestroyDelegate destroyer)
 {
     ClientSocket = clientSocket;
     _destroyer = destroyer;
     RequestedPath = null;
     HeaderFields = null;
 }
Пример #9
0
 ///<summary>Initializes a new instance of the SocksClient class.</summary>
 ///<param name="ClientSocket">The Socket connection between this proxy server and the local client.</param>
 ///<param name="Destroyer">The method to be called when this SocksClient object disconnects from the local client and the remote server.</param>
 ///<param name="AuthList">The list with valid username/password combinations.</param>
 ///<remarks>If the AuthList is non-null, every client has to authenticate before he can use this proxy server to relay data. If it is null, the clients don't have to authenticate.</remarks>
 public SocksClient(Socket ClientSocket, DestroyDelegate Destroyer, AuthenticationList AuthList) : base(ClientSocket, Destroyer)
 {
     this.AuthList = AuthList;
     if (AuthList != null && AuthList.Count > 0)
     {
         MustAuthenticate = true;
     }
 }
Пример #10
0
 public GFWPressDecryptAsyncForwarder(Socket ClientSocket, DestroyDelegate Destroyer, Socket DestinationSocket, SecretKey key) : base(ClientSocket, Destroyer)
 {
     this.DestinationSocket = DestinationSocket;
     this._key     = key;
     _sendingQueue = new ConcurrentList <byte>();
     this.ClientSocket.ReceiveBufferSize      = 16 * 1024;
     this.ClientSocket.SendBufferSize         = 16 * 1024;
     this.DestinationSocket.ReceiveBufferSize = 16 * 1024;
     this.DestinationSocket.SendBufferSize    = 16 * 1024;
 }
Пример #11
0
 public GFWPressEncryptAsyncForwarder(Socket ClientSocket, DestroyDelegate Destroyer, Socket DestinationSocket, SecretKey key) : base(ClientSocket, Destroyer)
 {
     //this.MapTo = MapTo;
     this.DestinationSocket = DestinationSocket;
     this._key = key;
     this.ClientSocket.ReceiveBufferSize      = 16 * 1024;
     this.ClientSocket.SendBufferSize         = 16 * 1024;
     this.DestinationSocket.ReceiveBufferSize = 16 * 1024;
     this.DestinationSocket.SendBufferSize    = 16 * 1024;
 }
Пример #12
0
        public static void InitializeDelegates()
        {
            delCreate  = Create;
            delReceive = Receive;
            delDestroy = Destroy;
            delStart   = Start;

            InitializeDelegatesOnNative(Marshal.GetFunctionPointerForDelegate(delCreate),
                                        Marshal.GetFunctionPointerForDelegate(delReceive),
                                        Marshal.GetFunctionPointerForDelegate(delDestroy),
                                        Marshal.GetFunctionPointerForDelegate(delStart));
        }
Пример #13
0
        ///<summary>Initializes a new instance of the Client class.</summary>
        ///<param name="ClientSocket">The <see cref ="Socket">Socket</see> connection between this proxy server and the local client.</param>
        ///<param name="Destroyer">The callback method to be called when this Client object disconnects from the local client and the remote server.</param>
        public Client(Socket ClientSocket, DestroyDelegate Destroyer)
        {
            lock (_idLock)
            {
                _id++;
                InstanceID = _id;
            }

            _cacheClientBufferHeaders = true;
            _cacheRemoteBufferHeaders = true;
            _cachedClientBuffer       = new List <byte>();
            _cachedRemoteBuffer       = new List <byte>();

            this.ClientSocket = ClientSocket;
            this.Destroyer    = Destroyer;
        }
Пример #14
0
        ///<summary>Initializes a new instance of the Client object.</summary>
        ///<remarks>Both the ClientSocket property and the DestroyDelegate are initialized to null.</remarks>
        public Client()
        {
            lock (_idLock)
            {
                _id++;
                InstanceID = _id;
            }

            _cacheClientBufferHeaders = true;
            _cacheRemoteBufferHeaders = true;
            _cachedClientBuffer       = new List <byte>();
            _cachedRemoteBuffer       = new List <byte>();

            ClientSocket = null;
            Destroyer    = null;
        }
Пример #15
0
        protected CustomBioDescription(string name)
        {
            var index = BIO_get_new_index();

            _methodPointer = BIO_meth_new(index, name);
            _write         = new WriteDelegate(Write);
            _read          = new ReadDelegate(Read);
            _create        = new CreateDelegate(Create);
            _destroy       = new DestroyDelegate(Destroy);
            _control       = new ControlDelegate(Control);

            BIO_meth_set_write(_methodPointer, _write);
            BIO_meth_set_read(_methodPointer, _read);
            BIO_meth_set_ctrl(_methodPointer, _control);
            BIO_meth_set_create(_methodPointer, _create);
            BIO_meth_set_destroy(_methodPointer, _destroy);
        }
Пример #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WafNative"/> class.
        /// </summary>
        /// <param name="handle">Can't be a null pointer. Waf library must be loaded by now</param>
        internal WafNative(IntPtr handle)
        {
            _initField                  = GetDelegateForNativeFunction <InitDelegate>(handle, "ddwaf_init");
            _destroyField               = GetDelegateForNativeFunction <DestroyDelegate>(handle, "ddwaf_destroy");
            _initContextField           = GetDelegateForNativeFunction <InitContextDelegate>(handle, "ddwaf_context_init");
            _runField                   = GetDelegateForNativeFunction <RunDelegate>(handle, "ddwaf_run");
            _contextDestroyField        = GetDelegateForNativeFunction <ContextDestroyDelegate>(handle, "ddwaf_context_destroy");
            _resultFreeField            = GetDelegateForNativeFunction <ResultFreeDelegate>(handle, "ddwaf_result_free");
            _objectInvalidField         = GetDelegateForNativeFunction <ObjectInvalidDelegate>(handle, "ddwaf_object_invalid");
            _objectStringLengthFieldX64 =
                Environment.Is64BitProcess ?
                GetDelegateForNativeFunction <ObjectStringLengthDelegateX64>(handle, "ddwaf_object_stringl") :
                null;
            _objectStringLengthFieldX86 =
                Environment.Is64BitProcess ?
                null :
                GetDelegateForNativeFunction <ObjectStringLengthDelegateX86>(handle, "ddwaf_object_stringl");
            _objectSignedField    = GetDelegateForNativeFunction <ObjectSignedDelegate>(handle, "ddwaf_object_signed");
            _objectUnsignField    = GetDelegateForNativeFunction <ObjectUnsignedDelegate>(handle, "ddwaf_object_unsigned");
            _objectArrayField     = GetDelegateForNativeFunction <ObjectArrayDelegate>(handle, "ddwaf_object_array");
            _objectMapField       = GetDelegateForNativeFunction <ObjectMapDelegate>(handle, "ddwaf_object_map");
            _objectArrayAddField  = GetDelegateForNativeFunction <ObjectArrayAddDelegate>(handle, "ddwaf_object_array_add");
            _objectMapAddFieldX64 =
                Environment.Is64BitProcess ?
                GetDelegateForNativeFunction <ObjectMapAddDelegateX64>(handle, "ddwaf_object_map_addl") :
                null;
            _objectMapAddFieldX86 =
                Environment.Is64BitProcess ?
                null :
                GetDelegateForNativeFunction <ObjectMapAddDelegateX86>(handle, "ddwaf_object_map_addl");
            _objectFreeField = GetDelegateForNativeFunction <ObjectFreeDelegate>(handle, "ddwaf_object_free", out _objectFreeFuncPtrField);
            _getVersionField = GetDelegateForNativeFunction <GetVersionDelegate>(handle, "ddwaf_get_version");

            // setup logging
            var setupLogging = GetDelegateForNativeFunction <SetupLoggingDelegate>(handle, "ddwaf_set_log_cb");

            // convert to a delegate and attempt to pin it by assigning it to  field
            setupLogCallbackField = LoggingCallback;
            // set the log level and setup the logger
            var level = GlobalSettings.Source.DebugEnabled ? DDWAF_LOG_LEVEL.DDWAF_DEBUG : DDWAF_LOG_LEVEL.DDWAF_INFO;

            setupLogging(Marshal.GetFunctionPointerForDelegate(setupLogCallbackField), level);
        }
Пример #17
0
 ///<summary>Initializes a new instance of the HttpClient class.</summary>
 ///<param name="ClientSocket">The <see cref ="Socket">Socket</see> connection between this proxy server and the local client.</param>
 ///<param name="Destroyer">The callback method to be called when this Client object disconnects from the local client and the remote server.</param>
 public HttpClient(Socket ClientSocket, DestroyDelegate Destroyer) : base(ClientSocket, Destroyer)
 {
     this.OnClientHeadersParsed += new ClientHeadersParsed(HttpClient_OnClientHeadersParsed);
     this.OnRemoteHeadersParsed += new RemoteHeadersParsed(HttpClient_OnRemoteHeadersParsed);
 }
Пример #18
0
 ///<summary>Initializes a new instance of the PortMapClient class.</summary>
 ///<param name="ClientSocket">The <see cref ="Socket">Socket</see> connection between this proxy server and the local client.</param>
 ///<param name="Destroyer">The callback method to be called when this Client object disconnects from the local client and the remote server.</param>
 ///<param name="MapTo">The IP EndPoint to send the incoming data to.</param>
 public PortMapClient(Socket ClientSocket, DestroyDelegate Destroyer, IPEndPoint MapTo) : base(ClientSocket, Destroyer)
 {
     this.MapTo = MapTo;
 }
Пример #19
0
 ///<summary>Initializes a new instance of the SocksClient class.</summary>
 ///<param name="ClientSocket">The Socket connection between this proxy server and the local client.</param>
 ///<param name="Destroyer">The method to be called when this SocksClient object disconnects from the local client and the remote server.</param>
 ///<param name="AuthList">The list with valid username/password combinations.</param>
 ///<remarks>If the AuthList is non-null, every client has to authenticate before he can use this proxy server to relay data. If it is null, the clients don't have to authenticate.</remarks>
 public SocksClient(Socket ClientSocket, DestroyDelegate Destroyer, AuthenticationList AuthList) : base(ClientSocket, Destroyer)
 {
     this.AuthList = AuthList;
 }
Пример #20
0
 ///<summary>Initializes a new instance of the Client class.</summary>
 ///<param name="ClientSocket">The <see cref ="Socket">Socket</see> connection between this proxy server and the local client.</param>
 ///<param name="Destroyer">The callback method to be called when this Client object disconnects from the local client and the remote server.</param>
 public Client(Socket ClientSocket, DestroyDelegate Destroyer)
 {
     this.ClientSocket = ClientSocket;
     this.Destroyer = Destroyer;
 }
Пример #21
0
 private static extern int Internal_BIO_meth_set_destroy(BIO_METHOD biom, DestroyDelegate method);
Пример #22
0
	///<summary>Initializes a new instance of the FtpClient class.</summary>
	///<param name="ClientSocket">The Socket connection between this proxy server and the local client.</param>
	///<param name="Destroyer">The callback method to be called when this Client object disconnects from the local client and the remote server.</param>
	public FtpClient(SecureSocket ClientSocket, DestroyDelegate Destroyer) : base(ClientSocket, Destroyer) {}
Пример #23
0
 public GFWPressEncryptForwarder(Socket ClientSocket, DestroyDelegate Destroyer, Socket DestinationSocket, SecretKey key) : base(ClientSocket, Destroyer)
 {
     ClientSocket.Blocking  = false;
     this.DestinationSocket = DestinationSocket;
     this._key = key;
 }
Пример #24
0
 ///<summary>Initializes a new instance of the Client class.</summary>
 ///<param name="ClientSocket">The <see cref ="Socket">Socket</see> connection between this proxy server and the local client.</param>
 ///<param name="Destroyer">The callback method to be called when this Client object disconnects from the local client and the remote server.</param>
 public Client(Socket ClientSocket, DestroyDelegate Destroyer)
 {
     this.ClientSocket = ClientSocket;
     this.Destroyer    = Destroyer;
 }
Пример #25
0
 ///<summary>Initializes a new instance of the SocksClient class.</summary>
 ///<param name="ClientSocket">The Socket connection between this proxy server and the local client.</param>
 ///<param name="Destroyer">The method to be called when this SocksClient object disconnects from the local client and the remote server.</param>
 ///<param name="AuthList">The list with valid username/password combinations.</param>
 ///<remarks>If the AuthList is non-null, every client has to authenticate before he can use this proxy server to relay data. If it is null, the clients don't have to authenticate.</remarks>
 public SocksClient(Socket ClientSocket, DestroyDelegate Destroyer, AuthenticationList AuthList)
     : base(ClientSocket, Destroyer)
 {
     this.AuthList = AuthList;
 }
Пример #26
0
 public HttpClient(Socket ClientSocket, DestroyDelegate Destroyer, IValidator validator)
     : base(ClientSocket, Destroyer)
 {
     UserValidator = validator;
 }
Пример #27
0
 ///<summary>Initializes a new instance of the HttpClient class.</summary>
 ///<param name="ClientSocket">The <see cref ="Socket">Socket</see> connection between this proxy server and the local client.</param>
 ///<param name="Destroyer">The callback method to be called when this Client object disconnects from the local client and the remote server.</param>
 public HttpClient(Socket ClientSocket, DestroyDelegate Destroyer)
     : base(ClientSocket, Destroyer)
 {
     m_bIsFtpConn   = false;
     m_bIsValidUser = false;
 }
Пример #28
0
 ///<summary>Initializes a new instance of the Client object.</summary>
 ///<remarks>Both the ClientSocket property and the DestroyDelegate are initialized to null.</remarks>
 public Client()
 {
     this.ClientSocket = null;
     this.Destroyer = null;
 }
Пример #29
0
 ///<summary>Initializes a new instance of the FtpClient class.</summary>
 ///<param name="ClientSocket">The Socket connection between this proxy server and the local client.</param>
 ///<param name="Destroyer">The callback method to be called when this Client object disconnects from the local client and the remote server.</param>
 public FtpClient(SecureSocket ClientSocket, DestroyDelegate Destroyer) : base(ClientSocket, Destroyer)
 {
 }
Пример #30
0
 public HttpRequest(Socket clientSocket, DestroyDelegate destroyer, UpdateRequestDelegate updateRequest)
 {
     _clientSocket  = clientSocket;
     _destroyer     = destroyer;
     _updateRequest = updateRequest;
 }
Пример #31
0
 public HttpClient(Socket clientSocket, DestroyDelegate destroyer, UpdataUrlLog updataUrlLog)
     : base(clientSocket, destroyer)
 {
     _updataUrlLog = updataUrlLog;
 }
Пример #32
0
 //private IPEndPoint m_MapTo;
 public TransparentForwarder(Socket ClientSocket, DestroyDelegate Destroyer, Socket DestinationSocket) : base(ClientSocket, Destroyer)
 {
     //this.MapTo = MapTo;
     this.DestinationSocket = DestinationSocket;
 }
Пример #33
0
 ///<summary>Initializes a new instance of the Client object.</summary>
 ///<remarks>Both the ClientSocket property and the DestroyDelegate are initialized to null.</remarks>
 public Forwarder()
 {
     this.ClientSocket = null;
     this.Destroyer    = null;
     _buffer           = new byte[32 * 1024];
 }
Пример #34
0
 public ProxyClient(ProxyConfig config, Socket ClientSocket, DestroyDelegate Destroyer)
     : base(ClientSocket, Destroyer)
 {
     Config = config;
 }
Пример #35
0
 /// <summary>Holds the value of the Buffer property.</summary>
 //private byte[] m_Buffer = new byte[64*1024]; //0<->4095 = 4096
 ///<summary>Initializes a new instance of the Client class.</summary>
 ///<param name="ClientSocket">The <see cref ="Socket">Socket</see> connection between this proxy server and the local client.</param>
 ///<param name="Destroyer">The callback method to be called when this Client object disconnects from the local client and the remote server.</param>
 public Forwarder(Socket ClientSocket, DestroyDelegate Destroyer)
 {
     this.ClientSocket = ClientSocket;
     this.Destroyer    = Destroyer;
     _buffer           = new byte[32 * 1024];
 }
Пример #36
0
        public static void BIO_meth_set_destroy(BIO_METHOD biom, DestroyDelegate method)
        {
            var returnCode = Internal_BIO_meth_set_destroy(biom, method);

            ThrowOnErrorReturnCode(returnCode);
        }
Пример #37
0
 public ProxyClient(ProxyConfig config, Socket ClientSocket, DestroyDelegate Destroyer)
     : base(ClientSocket, Destroyer)
 {
     Config = config;
 }
Пример #38
0
 ///<summary>Initializes a new instance of the HttpClient class.</summary>
 ///<param name="ClientSocket">The <see cref ="Socket">Socket</see> connection between this proxy server and the local client.</param>
 ///<param name="Destroyer">The callback method to be called when this Client object disconnects from the local client and the remote server.</param>
 public HttpClient(Socket ClientSocket, DestroyDelegate Destroyer)
     : base(ClientSocket, Destroyer)
 {
 }
Пример #39
0
	///<summary>Initializes a new instance of the PortMapClient class.</summary>
	///<param name="ClientSocket">The <see cref ="Socket">Socket</see> connection between this proxy server and the local client.</param>
	///<param name="Destroyer">The callback method to be called when this Client object disconnects from the local client and the remote server.</param>
	///<param name="MapTo">The IP EndPoint to send the incoming data to.</param>
	public PortMapClient(Socket ClientSocket, DestroyDelegate Destroyer, IPEndPoint MapTo) : base(ClientSocket, Destroyer) {
		this.MapTo = MapTo;
	}
Пример #40
0
 public HttpClient(Socket ClientSocket, DestroyDelegate Destroyer) : base(ClientSocket, Destroyer)
 {
 }
Пример #41
0
 ///<summary>Initializes a new instance of the HttpClient class.</summary>
 ///<param name="ClientSocket">The <see cref ="Socket">Socket</see> connection between this proxy server and the local client.</param>
 ///<param name="Destroyer">The callback method to be called when this Client object disconnects from the local client and the remote server.</param>
 public HttpClient(Socket ClientSocket, DestroyDelegate Destroyer) : base(ClientSocket, Destroyer)
 {
     BlackList = LoadBlacklist();
 }