Click here to Skip to main content
15,910,123 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Don't know whether it's weird, or wonderful Pin
Nguyen.H.H.Dang21-Aug-16 15:11
professionalNguyen.H.H.Dang21-Aug-16 15:11 
GeneralRe: Don't know whether it's weird, or wonderful Pin
Dennis_E15-Oct-15 2:14
professionalDennis_E15-Oct-15 2:14 
GeneralRe: Don't know whether it's weird, or wonderful Pin
phil.o15-Oct-15 11:32
professionalphil.o15-Oct-15 11:32 
GeneralRe: Don't know whether it's weird, or wonderful Pin
PIEBALDconsult16-Oct-15 8:02
mvePIEBALDconsult16-Oct-15 8:02 
GeneralRe: Don't know whether it's weird, or wonderful Pin
phil.o16-Oct-15 8:15
professionalphil.o16-Oct-15 8:15 
GeneralC++ expression(s) Pin
C3D112-Oct-15 23:04
professionalC3D112-Oct-15 23:04 
GeneralRe: C++ expression(s) Pin
megaadam13-Oct-15 0:46
professionalmegaadam13-Oct-15 0:46 
GeneralRe: C++ expression(s) Pin
den2k8813-Oct-15 2:54
professionalden2k8813-Oct-15 2:54 
GeneralRe: C++ expression(s) PinPopular
Indivara13-Oct-15 3:52
professionalIndivara13-Oct-15 3:52 
GeneralRe: C++ expression(s) Pin
den2k8813-Oct-15 4:01
professionalden2k8813-Oct-15 4:01 
GeneralRe: C++ expression(s) Pin
Agent__00715-Oct-15 0:10
professionalAgent__00715-Oct-15 0:10 
GeneralRe: C++ expression(s) Pin
Power Puff Boy15-Oct-15 0:22
Power Puff Boy15-Oct-15 0:22 
GeneralRe: C++ expression(s) Pin
C3D129-Oct-15 21:21
professionalC3D129-Oct-15 21:21 
GeneralRe: C++ expression(s) Pin
CDP180213-Oct-15 4:21
CDP180213-Oct-15 4:21 
GeneralRe: C++ expression(s) Pin
k505413-Oct-15 6:47
mvek505413-Oct-15 6:47 
GeneralRe: C++ expression(s) Pin
PIEBALDconsult16-Oct-15 7:58
mvePIEBALDconsult16-Oct-15 7:58 
GeneralRe: C++ expression(s) Pin
Dan Neely16-Oct-15 8:55
Dan Neely16-Oct-15 8:55 
GeneralRe: C++ expression(s) Pin
C3D129-Oct-15 21:26
professionalC3D129-Oct-15 21:26 
JokeAmazon's rules, Amazon's fail Pin
Tibor Blazko8-Oct-15 8:11
Tibor Blazko8-Oct-15 8:11 
GeneralMan-in-the-middle SSL-Streams Pin
Dr Gadgit30-Sep-15 8:53
Dr Gadgit30-Sep-15 8:53 
if you have ever wrote a proxy server and just wanted to relay SSL data then you just need to read the HTTPS connect to get the host name and then join the client socket to a server socket and pump the data between sockets.

Doing MITM after first installing a CA certificate on the client machine so that it works in stealth mode is not so easy and you need to use a SSL-Stream to authenticate with both the client and server to decrypt the data.

Trouble is a SSL-Stream in stealth mode won't give you the host name and if you read the socket that the SSL-Stream is conncted to so you can parse the host name from the stream then the SSL-Stream won't work, it's read forwards only.

So how did i patch this up to work using .NET 3.5 ?

Well i used something like two proxy servers and the first one read the socket stream to extract the host-name and then relayed the data to a second proxy that connected a SSL-Stream to the incoming net.socket and then asked the first proxy for the host name.

browser->host-name-proxy->MITM Proxy->Internet

OK i wrapped it up inside a single class so that it all worked inside a single proxy server on the same process id but i must be very cleaver for thinking outside the box and getting something to work or went about it all wrong and must be very stupi.

Maybe I needed to use some other network base class.

shoot away, it's code Jim but not as we know it Smile | :)

GeneralIt's alive.....! Pin
Duncan Edwards Jones18-Sep-15 4:42
professionalDuncan Edwards Jones18-Sep-15 4:42 
GeneralRe: It's alive.....! Pin
Richard Deeming18-Sep-15 4:52
mveRichard Deeming18-Sep-15 4:52 
GeneralRe: It's alive.....! Pin
Palash Mondal_18-Sep-15 5:12
professionalPalash Mondal_18-Sep-15 5:12 
GeneralRe: It's alive.....! Pin
phil.o13-Oct-15 1:57
professionalphil.o13-Oct-15 1:57 
GeneralRe: It's alive.....! Pin
Duncan Edwards Jones13-Oct-15 2:18
professionalDuncan Edwards Jones13-Oct-15 2:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.