Giter VIP home page Giter VIP logo

citadelcore.windows's People

Contributors

technikempire avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

citadelcore.windows's Issues

We restricted the thread count to always be one

When attempting to debug some issues, I overrode the number of threads processing packets and set it to one. Need to undo that and push a new release. Might as well fix the broken IDiverter interface while I'm at it, which should enforce the optional thread argument.

Can not block a website using AJAX

Hi there!
I used CitadelCore.Windows to block some url and it work very well. But if a website uses AJAX, it seems can't block the url.
I tried to block some url of Youtube but notthing happened.
Sorry for my bad English.
Regard!

Can't delete WinDivert64.sys

Hi Jesse!

I am trying to delete WinDivert64.sys file and the system complains it is still in use. CitadelCore is of course terminated. What is the reason for this behaviour?

Currently, the only way I found is to restart computer. What is the programmatic approach?

filter by SNI name

If I am understanding the code correctly, OnFirewallCheck(FirewallRequest request) in program.cs is meant to decide weather to filter or not. So far, I've used the ip addresses and compared them to the known ips that I'd like to filter. The problem is that domains stay the same and servers (along with IPs) change.

The approach I wanted to try out is to inspect SNI server names in TLS client hello packages. The problem is that HandleNewTcpConnection is called before client hello is sent, and you only get to decide based on ips. Am I missing something or is this the end of story with regard to SNI filtering?

Can’t use CitadelCore behind a proxy

I am testing CitadelCore and it works great. However, I found that it can’t filter traffic when system is connected to another proxy. I tried SSH tunneling (ssh -D port user@ip) and squid web proxy. Neither worked.

Is this a known limitation? What is the cause of it?

Can not access website after remove it out block list.

Hello,

I made an application read domains from file and block it, when file change the app read file again and block only domains in file. Example I have file domain.txt below:

phimmoi.net
vnexpress.net

First application work ok (it blocked domain phimmoi.net and vnexpress.net), then I delete phimmoi.net domain from file and hope can access phimmoi.net now but when I access phimmoi.net from browser it show below error in console and browser can not access phimmoi.net. I guest this proxy cache blocking this domain. Please help to check this issue.

ERRO: An error occurred while sending the request.   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.Http.HttpClient.<FinishSendAsyncUnbuffered>d__59.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at CitadelCore.Net.Handlers.FilterHttpResponseHandler.<Handle>d__6.MoveNext()The remote name could not be resolved: 'www.phimmoi.net'   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
         From FilterHttpResponseHandler.cs::Handle() #263

Note: I can access phimmoi.net when I turn off the application and then re-open it with after edit domains.txt

Thank you!

What files are actually needed to run?

Hi there,

Thanks for your project.
It runs fine when building, but I'm not sure what dlls are needed. When moving the executable+windivert dlls, it isn't working any more.

The build folder has like 50 Micoroft.net framework files.

Speed increase by preestablishing MITM-SERVER connection

I noticed that the initial connections to websites are very slow. This is only true for the very first one, all subsequent refreshes gain significant speed boost. I understand that in order for CitadelCore to work, it need to establish 2 SSL/TCP connections. One between client and mitm(Kestrel) and one with HttpClient and endpoint server. Moreover, delay for 3 roundtrips needed should be minimal between client and mitm, and very noticable between mitm and server. I expected that the website load(initial request) time should be decreased (or at least stay the same), if the connection between mitm and server is preestablished.

Untitled-1

I tested this idea and implemented a small piece of code in FilterResponseHandlerFactory.cs. On line 94, I added a request to desired website.

        _client = new HttpClient(configuration.CustomProxyHandler, true);
        HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, "https://motherfuckingwebsite.com/");
        requestMessage.Headers.Add("Host", "motherfuckingwebsite.com");
        requestMessage.Headers.Add("Connection", "keep-alive");
        requestMessage.Headers.Add("Pragma", "no-cache");
        requestMessage.Headers.Add("Cache-Control", "no-cache");
        requestMessage.Headers.Add("Upgrade-Insecure-Requests", "1");
        requestMessage.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.4044.155 Safari/537.36");
        requestMessage.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");

        try{
            HttpResponseMessage response = _client.SendAsync(requestMessage).GetAwaiter().GetResult();
            if (response.StatusCode == HttpStatusCode.OK){
                Console.WriteLine("prefetch done");
                byte[] buf = response.Content.ReadAsByteArrayAsync().GetAwaiter().GetResult();
                string content = Encoding.UTF8.GetString(buf);
            }
        }
        catch (Exception e){
            // handle error
        }

I got a 450ms speed increase on first page load compared to no prefetching and 150ms delay, compared to no mitm. I then changed the host and testes for different websites (such as 9gag.com), and got a large deviation from the expected. The speed increase was negligible. 20ms tops, and I am not even sure about that due to network randomness.

What is your take on this approach? The goal is to optimize first page load. Do you have any implementation recommendations?

NewHttpMessageHandler is keep getting invoked, even though connection is dropped.

Hello there!

I've made an example URL filtering application and it works so far so good. It blocks the connection and the specific element doesn't appears on the browser. I'm also trying to analyze to see which filters are being used more frequently than the others. It basically keeps count of blocked URLs into a text file. This also works okay but sometimes it starts to block an URL over and over and over again for literally no reason. Even if I close the browser, it'll keep blocking it.

Can not access FTP or SSH

Hello,
I run the test program and it worked good, but I can not connect FTP or SSH when the program running (I can connect when I turn off the program).
Please help to check this problem.
Thank you!

Websocket implementation fails for web.whatsapp.com

Trying to connect to https://web.whatsapp.com.:

Request Headers:
Host: w6.web.whatsapp.com
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Sec-WebSocket-Version: 13
Origin: https://web.whatsapp.com
Sec-WebSocket-Extensions: permessage-deflate
Sec-WebSocket-Key: FCmMBkUE8N/k0RW1hGSmfA==
Connection: keep-alive, Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket

Response Headers:
Status code: 101
Version:HTTP/1.1
Connection: Upgrade
Date: Thu, 16 Nov 2017 22:47:51 GMT
Server: Kestrel
Upgrade: websocket
Sec-WebSocket-Accept: enCxmjpawA1hLIBx0G5iVuX1WXA=

Request not using the proxy:

Request Headers:
Host: w6.web.whatsapp.com
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Sec-WebSocket-Version: 13
Origin: https://web.whatsapp.com
Sec-WebSocket-Extensions: permessage-deflate
Sec-WebSocket-Key: sSnN8MB4fUIVhhYROhqLUw==
Connection: keep-alive, Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket

Response Header:
Status code: 101
Version:HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: b0HllaSjeZvmTavnZhEwFFgJFg8=

I can only notice the difference in the Kestrel server Header.

@TechnikEmpire can you take a look ?

Handling of websocket connections close event

On websocket termination (triggered by browser tab closure), a number of catch blocks catch an exception. The relevant code and stack trace is appended. I normally just ignore these errors and I haven't noticed any problems because the thing you are doing is already done after the connection is closed. So apart from cluttering the error logs, they appear to be benign. But I wonder.. Do they cause any side effects and should they be prevented? The code is from FilterWebsocketHandler.cs and FilterHttpResponseHandler.cs .The below stack is generated by tab close event. Thank you.

//FilterWebsocketHandler.cs
0+249 // Spawn an async task that will poll the remote server for data in a loop, and then
1+249                // write any data it gets to the client websocket.
2+249                var serverTask = Task.Run(async () =>
3+249                {
4+249                    System.Net.WebSockets.WebSocketReceiveResult serverResult = null;
5+249                    var serverBuffer = new byte[1024 * 4];
6+249                    try
7+249                    {
8+249                        bool looping = true;
9+249
10+249                        serverResult = await wsServer.ReceiveAsync(new ArraySegment<byte>(serverBuffer), context.RequestAborted);
11+249
12+249                        while (looping && !serverResult.CloseStatus.HasValue && !context.RequestAborted.IsCancellationRequested)
13+249                        {
14+249
15+249                            if (inspect)
16+249                            {
17+249                                serverMessageInfo.Body = new Memory<byte>(serverBuffer, 0, serverResult.Count);
18+249
19+249                                switch (serverResult.MessageType)
20+249                                {
21+249                                    case System.Net.WebSockets.WebSocketMessageType.Binary:
22+249                                        {
23+249                                            serverMessageInfo.BodyContentType = s_octetStreamContentType;
24+249                                        }
25+249                                        break;
26+249
27+249                                    case System.Net.WebSockets.WebSocketMessageType.Text:
28+249                                        {
29+249                                            serverMessageInfo.BodyContentType = s_plainTextContentType;
30+249                                        }
31+249                                        break;
32+249                                }
33+249
34+249                                _configuration.HttpMessageWholeBodyInspectionHandler?.Invoke(serverMessageInfo, null);
35+249                            }
36+249
37+249                            switch (serverMessageInfo.ProxyNextAction)
38+249                            {
39+249                                case ProxyNextAction.DropConnection:
40+249                                    {
41+249                                        looping = false;
42+249                                    }
43+249                                    break;
44+249
45+249                                default:
46+249                                    {
47+249                                        await wsClient.SendAsync(new ArraySegment<byte>(serverBuffer, 0, serverResult.Count), serverResult.MessageType, serverResult.EndOfMessage, context.RequestAborted);
48+249
49+249                                        if (!wsClient.CloseStatus.HasValue)
50+249                                        {
51+249                                            serverResult = await wsServer.ReceiveAsync(new ArraySegment<byte>(serverBuffer), context.RequestAborted); // this triggers an exception #0
52+249                                            continue;
53+249                                        }
54+249                                    }
55+249                                    break;
56+249                            }
57+249
58+249                            looping = false;
59+249                        }
60+249
61+249                        await wsClient.CloseAsync(serverResult.CloseStatus.Value, serverResult.CloseStatusDescription, context.RequestAborted);// this triggers an exception #1
62+249                    }
63+249                    catch (Exception e)
64+249                    {
65+249                        LoggerProxy.Default.Error(e.ToString());
66+249                        try{
67+249                            var closeStatus = serverResult?.CloseStatus ??
68+249                                              System.Net.WebSockets.WebSocketCloseStatus.NormalClosure;
69+249                            var closeMessage = serverResult?.CloseStatusDescription ?? string.Empty;
70+249
71+249                            await wsClient.CloseAsync(closeStatus, closeMessage, context.RequestAborted);// this triggers an exception #2
72+249                        }
73+249                        catch (Exception e2){
74+249                            LoggerProxy.Default.Error(e2.ToString());
75+249
76+249                        }
77+249                    }
78+249                });
79+249
80+249                // Spawn an async task that will poll the local client websocket, in a loop, and then
81+249                // write any data it gets to the remote server websocket.
82+249                var clientTask = Task.Run(async () =>
83+249                {
84+249                    System.Net.WebSockets.WebSocketReceiveResult clientResult = null;
85+249                    var clientBuffer = new byte[1024 * 4];
86+249                    try
87+249                    {
88+249                        bool looping = true;
89+249
90+249                        clientResult = await wsClient.ReceiveAsync(new ArraySegment<byte>(clientBuffer), context.RequestAborted);
91+249
92+249                        while (looping && !clientResult.CloseStatus.HasValue && !context.RequestAborted.IsCancellationRequested)
93+249                        {
94+249                            if (inspect)
95+249                            {
96+249                                clientMessageInfo.Body = new Memory<byte>(clientBuffer, 0, clientResult.Count);
97+249
98+249                                switch (clientResult.MessageType)
99+249                                {
100+249                                    case System.Net.WebSockets.WebSocketMessageType.Binary:
101+249                                        {
102+249                                            clientMessageInfo.BodyContentType = s_octetStreamContentType;
103+249                                        }
104+249                                        break;
105+249
106+249                                    case System.Net.WebSockets.WebSocketMessageType.Text:
107+249                                        {
108+249                                            clientMessageInfo.BodyContentType = s_plainTextContentType;
109+249                                        }
110+249                                        break;
111+249                                }
112+249
113+249                                _configuration.HttpMessageWholeBodyInspectionHandler?.Invoke(clientMessageInfo, null);
114+249                            }
115+249
116+249                            switch (clientMessageInfo.ProxyNextAction)
117+249                            {
118+249                                case ProxyNextAction.DropConnection:
119+249                                    {
120+249                                        looping = false;
121+249                                    }
122+249                                    break;
123+249
124+249                                default:
125+249                                    {
126+249                                        await wsServer.SendAsync(new ArraySegment<byte>(clientBuffer, 0, clientResult.Count), clientResult.MessageType, clientResult.EndOfMessage, context.RequestAborted);
127+249
128+249                                        if (!wsServer.CloseStatus.HasValue)
129+249                                        {
130+249                                            clientResult = await wsClient.ReceiveAsync(new ArraySegment<byte>(clientBuffer), context.RequestAborted);
131+249                                            continue;
132+249                                        }
133+249                                    }
134+249                                    break;
135+249                            }
136+249
137+249                            looping = false;
138+249                        }
139+249
140+249                        await wsServer.CloseAsync(clientResult.CloseStatus.Value, clientResult.CloseStatusDescription, context.RequestAborted);// this triggers an exception #3
141+249                    }
142+249                    catch(Exception e)
143+249                    {
144+249
145+249                        LoggerProxy.Default.Error(e.ToString());
146+249                        try{
147+249                            var closeStatus = clientResult?.CloseStatus ??
148+249                                              System.Net.WebSockets.WebSocketCloseStatus.NormalClosure;
149+249                            var closeMessage = clientResult?.CloseStatusDescription ?? string.Empty;
150+249
151+249                            await wsServer.CloseAsync(closeStatus, closeMessage, context.RequestAborted);// this triggers an exception #4
152+249                        }
153+249                        catch (Exception e2){
154+249                            LoggerProxy.Default.Error(e2.ToString());
155+249                        }
156+249                    }
157+249                });
158+249
159+249                // Above, we have created a bridge between the local and remote websocket. Wait for
160+249                // both associated tasks to complete.
161+249                await Task.WhenAll(serverTask, clientTask);
//  FilterHttpResponseHandler.cs
0+386                   try
1+386                    {
2+386                        if (false){
3+386                            
4+386                        }
5+386                        response = await upstreamClient.SendAsync(requestMsg, HttpCompletionOption.ResponseHeadersRead, context.RequestAborted);
6+386                    }
7+386                    catch (Exception e)
8+386                    {

Exceptions:

ERRO: System.OperationCanceledException: Aborted ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'SslStream'.
   at System.Net.Security.SslState.CheckThrow(Boolean authSuccessCheck, Boolean shutdownCheck)
   at System.Net.Security.SslState.get_SecureStream()
   at System.Net.Security.SslStream.EndRead(IAsyncResult asyncResult)
   at System.IO.Stream.<>c.<BeginEndReadAsync>b__43_1(Stream stream, IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncTrimPromise`1.Complete(TInstance thisRef, Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Relay.Websockets.Managed.ManagedWebSocket.<EnsureBufferContainsAsync>d__70.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Relay.Websockets.Managed.ManagedWebSocket.<ReceiveAsyncPrivate>d__61.MoveNext()
   --- End of inner exception stack trace ---
   at Relay.Websockets.Managed.ManagedWebSocket.<ReceiveAsyncPrivate>d__61.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Relay.Net.Handlers.FilterWebsocketHandler.<>c__DisplayClass4_1.<<Handle>b__0>d.MoveNext() in C:\Users\pathtoproject\Net\Handlers\FilterWebsocketHandler.cs:line 300

ERRO: System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.Http.HttpClient.<FinishSendAsyncUnbuffered>d__59.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Relay.Net.Handlers.FilterHttpResponseHandler.<Handle>d__7.MoveNext() in C:\Users\pathtoproject\Net\Handlers\FilterHttpResponseHandler.cs:line 391
ERRO: System.OperationCanceledException: Aborted ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'SslStream'.
   at System.Net.Security.SslState.CheckThrow(Boolean authSuccessCheck, Boolean shutdownCheck)
   at System.Net.Security.SslState.get_SecureStream()
   at System.Net.Security.SslStream.EndRead(IAsyncResult asyncResult)
   at System.IO.Stream.<>c.<BeginEndReadAsync>b__43_1(Stream stream, IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncTrimPromise`1.Complete(TInstance thisRef, Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Relay.Websockets.Managed.ManagedWebSocket.<EnsureBufferContainsAsync>d__70.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Relay.Websockets.Managed.ManagedWebSocket.<ReceiveAsyncPrivate>d__61.MoveNext()
   --- End of inner exception stack trace ---
   at Relay.Websockets.Managed.ManagedWebSocket.<ReceiveAsyncPrivate>d__61.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Relay.Net.Handlers.FilterWebsocketHandler.<>c__DisplayClass4_1.<<Handle>b__0>d.MoveNext() in C:\Users\pathtoproject\Net\Handlers\FilterWebsocketHandler.cs:line 0
ERRO: System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.WebSockets.Protocol.CommonWebSocket.<CloseOutputAsync>d__42.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.WebSockets.Protocol.CommonWebSocket.<CloseAsync>d__41.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Relay.Net.Handlers.FilterWebsocketHandler.<>c__DisplayClass4_1.<<Handle>b__0>d.MoveNext() in C:\Users\pathtoproject\Net\Handlers\FilterWebsocketHandler.cs:line 320


ERRO: System.OperationCanceledException: Aborted ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'SslStream'.
   at System.Net.Security.SslState.CheckThrow(Boolean authSuccessCheck, Boolean shutdownCheck)
   at System.Net.Security.SslState.get_SecureStream()
   at System.Net.Security.SslStream.EndRead(IAsyncResult asyncResult)
   at System.IO.Stream.<>c.<BeginEndReadAsync>b__43_1(Stream stream, IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncTrimPromise`1.Complete(TInstance thisRef, Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Relay.Websockets.Managed.ManagedWebSocket.<EnsureBufferContainsAsync>d__70.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Relay.Websockets.Managed.ManagedWebSocket.<ReceiveAsyncPrivate>d__61.MoveNext()
   --- End of inner exception stack trace ---
   at Relay.Websockets.Managed.ManagedWebSocket.<ReceiveAsyncPrivate>d__61.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Relay.Websockets.Managed.ManagedWebSocket.<CloseAsyncPrivate>d__67.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Relay.Net.Handlers.FilterWebsocketHandler.<>c__DisplayClass4_1.<<Handle>b__1>d.MoveNext() in C:\Users\pathtoproject\Net\Handlers\FilterWebsocketHandler.cs:line 389


ERRO: System.TypeInitializationException: The type initializer for 'System.SR' threw an exception. ---> System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure
"Relay.Websockets.Client.Managed.Strings.resources" was correctly embedded or linked into assembly "ProjectSockets" at compile time, or that all the satellite assemblies required are loadable and fully signed.
   at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName)
   at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
   at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
   at Relay.Websockets.Client.Managed.Strings.get_net_WebSockets_InvalidCloseStatusDescription()
   at System.SR..cctor()
   --- End of inner exception stack trace ---
   at Relay.Websockets.Managed.WebSocketValidate.ThrowIfInvalidState(WebSocketState currentState, Boolean isDisposed, WebSocketState[] validStates)
   at Relay.Websockets.Managed.ManagedWebSocket.CloseAsync(WebSocketCloseStatus closeStatus, String statusDescription, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Relay.Net.Handlers.FilterWebsocketHandler.<>c__DisplayClass4_1.<<Handle>b__1>d.MoveNext() in C:\Users\pathtoproject\Net\Handlers\FilterWebsocketHandler.cs:line 400






Possible bug in port mapping arrays

I think the port mapping arrays should probably have a size of 65535+1 (ushort.MaxValue + 1) because of zero based indexes. In theory there could be ::1:65535 for example, which would throw an out of bounds exception in the windiverter code.

propagating invalid SSL certificate error to the browser

I noticed that you get notified of an SSL cert error only through try/catch block of upstream HttpClient request. By that time, https connection with the browser has long been established and the browser happily shows the lock icon.

I opened TlsSniConnectionAdapter and found only hooks for SNI inspection via StreamExtended API. Does Kestrel have an option for intercepting certificate sent from remote machine much like it is capable of intercepting ClientHello messages?

Upgrade to WinDivert 1.4.x

There's been a couple of pretty critical issues arise between our current version of WinDivert (1.3) and the latest version, which need to be addressed. We need to upgrade.

Proxy intercepting is unstable

It seems that WinDivert driver doesn't intercept traffic for processes started after CitadelCore.
For example, all browsers need to be restarter if they were launched before the CitadelCore. I am not able to reproduce this issue on all occasions, but it happens very often.

Is this a bug or a known limitation?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.