Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Titanium-Web-Proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Titanium-Web-Proxy
Commits
4b302863
Commit
4b302863
authored
Sep 04, 2015
by
justcoding121
Committed by
justcoding121
Sep 04, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in secure connect
parent
02be898e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
21 deletions
+9
-21
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+9
-21
No files found.
Titanium.Web.Proxy/RequestHandler.cs
View file @
4b302863
...
@@ -77,26 +77,14 @@ namespace Titanium.Web.Proxy
...
@@ -77,26 +77,14 @@ namespace Titanium.Web.Proxy
//instead = we are going to perform a man in the middle "attack"
//instead = we are going to perform a man in the middle "attack"
//the user's browser should warn them of the certification errors,
//the user's browser should warn them of the certification errors,
//to avoid that we need to install our root certficate in users machine as Certificate Authority.
//to avoid that we need to install our root certficate in users machine as Certificate Authority.
remoteUri
=
"https://"
+
splitBuffer
[
1
];
remoteUri
=
"https://"
+
splitBuffer
[
1
];
tunnelHostName
=
splitBuffer
[
1
].
Split
(
':'
)[
0
];
tunnelHostName
=
splitBuffer
[
1
].
Split
(
':'
)[
0
];
int
.
TryParse
(
splitBuffer
[
1
].
Split
(
':'
)[
1
],
out
tunnelPort
);
int
.
TryParse
(
splitBuffer
[
1
].
Split
(
':'
)[
1
],
out
tunnelPort
);
if
(
tunnelPort
==
0
)
tunnelPort
=
80
;
var
isSecure
=
true
;
if
(
tunnelPort
==
0
)
tunnelPort
=
443
;
for
(
int
i
=
1
;
i
<
requestLines
.
Count
;
i
++)
{
var
rawHeader
=
requestLines
[
i
];
String
[]
header
=
rawHeader
.
ToLower
().
Trim
().
Split
(
colonSpaceSplit
,
2
,
StringSplitOptions
.
None
);
if
((
header
[
0
]
==
"host"
))
{
var
hostDetails
=
header
[
1
].
ToLower
().
Trim
().
Split
(
':'
);
if
(
hostDetails
.
Length
>
1
)
{
isSecure
=
false
;
}
}
}
requestLines
.
Clear
();
requestLines
.
Clear
();
clientStreamWriter
.
WriteLine
(
RequestVersion
+
" 200 Connection established"
);
clientStreamWriter
.
WriteLine
(
RequestVersion
+
" 200 Connection established"
);
...
@@ -135,7 +123,7 @@ namespace Titanium.Web.Proxy
...
@@ -135,7 +123,7 @@ namespace Titanium.Web.Proxy
//Pinned certificate clients cannot be proxied
//Pinned certificate clients cannot be proxied
//Example dropbox.com uses certificate pinning
//Example dropbox.com uses certificate pinning
//So just relay the request after identifying it by first failure
//So just relay the request after identifying it by first failure
if
(!
pinnedCertificateClients
.
Contains
(
tunnelHostName
)
&&
isSecure
)
if
(!
pinnedCertificateClients
.
Contains
(
tunnelHostName
))
{
{
try
try
...
@@ -145,7 +133,7 @@ namespace Titanium.Web.Proxy
...
@@ -145,7 +133,7 @@ namespace Titanium.Web.Proxy
sslStream
.
AuthenticateAsServer
(
certificate
,
false
,
SslProtocols
.
Tls
|
SslProtocols
.
Ssl3
|
SslProtocols
.
Ssl2
,
false
);
sslStream
.
AuthenticateAsServer
(
certificate
,
false
,
SslProtocols
.
Tls
|
SslProtocols
.
Ssl3
|
SslProtocols
.
Ssl2
,
false
);
clientStreamReader
=
new
CustomBinaryReader
(
sslStream
,
Encoding
.
ASCII
);
clientStreamReader
=
new
CustomBinaryReader
(
sslStream
,
Encoding
.
ASCII
);
clientStreamWriter
=
new
StreamWriter
(
sslStream
);
clientStreamWriter
=
new
StreamWriter
(
sslStream
);
//HTTPS server created - we can now decrypt the client's traffic
//HTTPS server created - we can now decrypt the client's traffic
clientStream
=
sslStream
;
clientStream
=
sslStream
;
}
}
...
@@ -449,7 +437,7 @@ namespace Titanium.Web.Proxy
...
@@ -449,7 +437,7 @@ namespace Titanium.Web.Proxy
client
.
Close
();
client
.
Close
();
}
}
}
}
...
@@ -652,7 +640,7 @@ namespace Titanium.Web.Proxy
...
@@ -652,7 +640,7 @@ namespace Titanium.Web.Proxy
args
.
ClientStream
.
ReadByte
();
args
.
ClientStream
.
ReadByte
();
}
}
sb
.
Clear
();
sb
.
Clear
();
}
}
}
}
...
@@ -665,7 +653,7 @@ namespace Titanium.Web.Proxy
...
@@ -665,7 +653,7 @@ namespace Titanium.Web.Proxy
throw
;
throw
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment