passepartoutvpn / tunnelkit

VPN client library for Apple platforms.
GNU General Public License v3.0
10 stars 8 forks source link

Add Complete XOR Patch Functionality #255

Closed tmthecoder closed 2 years ago

tmthecoder commented 2 years ago

This PR adds complete XOR patch functionality (building on the existing single-byte scramble xormask statement).

This feature adds the following specifically:

All of these implementations are done following Tunnelblick's XOR patch and their small article on it here (Header titled "Scramble Option Syntax")

I've found myself needed the full extent of this functionality, specifically the scramble obfuscate option with a multu-byte password, hence my decision to write an implementation for it. I believe I've followed the guidelines outlined as well as the code structure already defined. Looking forward to hearing your insight!

tmthecoder commented 2 years ago

Also, please note that this does change the xorMask type to a Data as opposed to a UInt8 since we've added support for multibyte values to be used as the xormask or obfuscate arguments

tmthecoder commented 2 years ago

@keeshux Just looking here again, should I add in a commit to update the README with the complete XOR functionality?

keeshux commented 2 years ago

@keeshux Just looking here again, should I add in a commit to update the README with the complete XOR functionality?

Hey, yes you can go ahead with that. Sorry that I won't be able to review this until I release Passepartout 2.0

keeshux commented 2 years ago

Okay, time has finally come to look into this.

keeshux commented 2 years ago

@tmthecoder sorry for the long delay!

First of all, thanks again for your dedication, this is great work and I'm sincerely glad for your contribution.

I could finally take some time to review this and I refactored your code to fit it better into the library. It's all about simplifying and moving things around, but the purpose and algorithms should be 100% unaffected.

Since I understand you are using all these in your server, please do some stress tests with this updated code of mine. Meanwhile, I'll try to at least add some unit tests of the XOR processing routines, to make sure e.g. that packets are correctly reversible (p1 -> scramble -> p2 -> scramble -> p1).

Cheers

tmthecoder commented 2 years ago

@keeshux Sounds good, I'll run some tests on my setups

tmthecoder commented 2 years ago

@keeshux Couldn't find any issues in local tests against VPN servers

keeshux commented 2 years ago

@keeshux Couldn't find any issues in local tests against VPN servers

Awesome. Have you also ensured continued operation in UDP/TCP without any XOR option enabled?

keeshux commented 2 years ago

Tested myself, and Passepartout beta will be another testbed. Merged!

daaku commented 1 year ago

Wondering when this will be in TestFlight / Release?

keeshux commented 1 year ago

Wondering when this will be in TestFlight / Release?

It's in TestFlight versions of Passepartout already.

keeshux commented 1 year ago

@tmthecoder your work is now part of Passepartout 2.1.0 on the App Store. Thanks again!

@daaku FYI