0xf4b1 / traktor-streaming-proxy

Allow Traktor DJ to stream music from YouTube, Spotify, and Tidal by faking Beatport's API
Other
37 stars 2 forks source link

Mac auth #17

Closed Simacrus closed 7 months ago

Simacrus commented 8 months ago

have same issue, tested with curl https://api.beatport.com/v4/catalog/genres/ and get "results": [ { "id": 1, "name": "YouTube" } ] added certificates to trust store Снимок экрана 2024-02-18 в 22 55 48

console log: Снимок экрана 2024-02-18 в 22 57 50

but still have this notification Снимок экрана 2024-02-18 в 23 18 12

0xf4b1 commented 8 months ago

Hey, I haven't noticed any problems on my system so far but I found the problem. I haven't updated for a while and with the most recent version 3.11.1 17, I get the same error. It still works with older versions, like 3.7.1 337 and 3.8.0 46 for example. I'll try to find out what has changed.

Simacrus commented 8 months ago

my version 3.11.0 44 don't want to downgrade cause have screens mod that i edit for my self and trying to upgrade it, and a lot of other modifications

Simacrus commented 8 months ago

I can look at the code with fresh eyes without looking into it too much and give you a couple of guesses.

Simacrus commented 8 months ago

hmmmm is it ok that i can't import ca.key.pem to keychain?

Simacrus commented 8 months ago

I tried to listen port 8000 but there was nothing there Снимок экрана 2024-02-20 в 01 48 30

0xf4b1 commented 8 months ago

What I can say so far is that Traktor no longer trusts any other certificate so I guess its pinned to the original beatport public key. Most likely this needs to be patched in the binary

Simacrus commented 8 months ago

Have no idea how to do it

Simacrus commented 8 months ago

So what we gonna do?

0xf4b1 commented 8 months ago

Hey, good news, I have it working again and it does not require any changes of the code here. Traktor was indeed verifying that it only connects to servers with the correct certificate and needs a small binary patch to effectively disable it. However, I did this manually and will try to put something together tomorrow to apply this in the best case across different versions

Simacrus commented 8 months ago

happy-happy-happy-happy.gif

Simacrus commented 8 months ago

out of curiosity, in which file which part of the code did you change and to which one?

0xf4b1 commented 8 months ago

the beatport client moved into a library libbeatport.dylib and this has a verify_cert function which fails because the return of the function call SecTrustEvaluate is recoverableTrustFailure. I'm not entirely sure if its possible to generate a certificate with better parameters than the minimal ones in the gen-cert.sh script to let the trust check pass :thinking: but if this is not possible, it works at least with a little change in the binary. I've also found a way that works without patching anything and should work across versions and I think I'll leave it with this and add this soon.

Simacrus commented 8 months ago

aaaaaah i can't wait to try it , and also i wanna share this project to all my friends

Simacrus commented 8 months ago

if u'll update project today i'll start working in video guide about it

0xf4b1 commented 8 months ago

I've added the respective piece and hope it works :) The only thing that needs to be done is the new step 6 in the README

Simacrus commented 8 months ago

still have same error

console log:

MacBook-Air-MacBook:cert macbookair13$ DYLD_INSERT_LIBRARIES=./SecTrustEvaluateStub.dylib "/Applications/Traktor Pro 3/Traktor.app/Contents/MacOS/Traktor" cannot resolve resource: TTFd 1 qml: S4 MK3: Mapping loaded! file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/S4MK3/Views/Deck/Deck.qml:218:5: Unable to assign [undefined] to QString file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:37: TypeError: Cannot read property 'isDiscrete' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:36:5: Unable to assign [undefined] to double file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:57: TypeError: Cannot read property 'isDiscrete' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:56: TypeError: Cannot read property 'steps' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:55: TypeError: Cannot read property 'steps' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopControls.qml:120:9: Unable to assign [undefined] to bool file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:37: TypeError: Cannot read property 'isDiscrete' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:36:5: Unable to assign [undefined] to double file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:57: TypeError: Cannot read property 'isDiscrete' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:56: TypeError: Cannot read property 'steps' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:55: TypeError: Cannot read property 'steps' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopControls.qml:132:9: Unable to assign [undefined] to QString file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopControls.qml:131:9: Unable to assign [undefined] to QString file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopControls.qml:130:9: Unable to assign [undefined] to bool file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:37: TypeError: Cannot read property 'isDiscrete' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:36:5: Unable to assign [undefined] to double file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:57: TypeError: Cannot read property 'isDiscrete' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:56: TypeError: Cannot read property 'steps' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:55: TypeError: Cannot read property 'steps' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopControls.qml:142:9: Unable to assign [undefined] to QString file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopControls.qml:141:9: Unable to assign [undefined] to QString file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopControls.qml:140:9: Unable to assign [undefined] to bool file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:37: TypeError: Cannot read property 'isDiscrete' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:36:5: Unable to assign [undefined] to double file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:57: TypeError: Cannot read property 'isDiscrete' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:56: TypeError: Cannot read property 'steps' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopInfoDetails.qml:55: TypeError: Cannot read property 'steps' of null file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopControls.qml:152:9: Unable to assign [undefined] to QString file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopControls.qml:151:9: Unable to assign [undefined] to QString file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Overlays/TopControls.qml:150:9: Unable to assign [undefined] to bool qml: S4 MK3: Not running file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/S4MK3/Views/Deck/Deck.qml:218:5: Unable to assign [undefined] to QString file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/S4MK3/Views/Deck/Deck.qml:218:5: Unable to assign [undefined] to QString file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/S4MK3/Views/Deck/Deck.qml:218:5: Unable to assign [undefined] to QString file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/S4MK3/Views/Deck/Deck.qml:218:5: Unable to assign [undefined] to QString file:///Applications/Traktor Pro 3/Traktor.app/Contents/MacOS/../Resources/qml/CSI/S4MK3/S4MK3TransportButtons.qml:104: ReferenceError: tempoBPM is not defined file:///Applications/Traktor Pro 3/Traktor.app/Contents/MacOS/../Resources/qml/CSI/S4MK3/S4MK3TransportButtons.qml:104: ReferenceError: tempoBPM is not defined file:///Applications/Traktor Pro 3/Traktor.app/Contents/MacOS/../Resources/qml/CSI/S4MK3/S4MK3TransportButtons.qml:104: ReferenceError: tempoBPM is not defined file:///Applications/Traktor Pro 3/Traktor.app/Contents/MacOS/../Resources/qml/CSI/S4MK3/S4MK3TransportButtons.qml:104: ReferenceError: tempoBPM is not defined file:///Applications/Traktor Pro 3/Traktor.app/Contents/MacOS/../Resources/qml/CSI/S4MK3/S4MK3TransportButtons.qml:104: ReferenceError: tempoBPM is not defined file:///Applications/Traktor Pro 3/Traktor.app/Contents/MacOS/../Resources/qml/CSI/S4MK3/S4MK3TransportButtons.qml:104: ReferenceError: tempoBPM is not defined file:///Applications/Traktor Pro 3/Traktor.app/Contents/MacOS/../Resources/qml/CSI/S4MK3/S4MK3TransportButtons.qml:104: ReferenceError: tempoBPM is not defined file:///Applications/Traktor Pro 3/Traktor.app/Contents/MacOS/../Resources/qml/CSI/S4MK3/S4MK3TransportButtons.qml:104: ReferenceError: tempoBPM is not defined file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Widgets/Waveform/SingleWaveform.qml:25:5: Unable to assign [undefined] to QColor file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Widgets/Waveform/SingleWaveform.qml:25:5: Unable to assign [undefined] to QColor file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Widgets/Stripe/Stripe.qml:51:3: Unable to assign [undefined] to QColor file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Widgets/Stripe/Stripe.qml:51:3: Unable to assign [undefined] to QColor file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Widgets/Waveform/SingleWaveform.qml:25:5: Unable to assign [undefined] to QColor file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Widgets/Waveform/SingleWaveform.qml:25:5: Unable to assign [undefined] to QColor file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Widgets/Stripe/Stripe.qml:51:3: Unable to assign [undefined] to QColor file:///Applications/Traktor Pro 3/Traktor.app/Contents/Resources/qml/Screens/Shared/Widgets/Stripe/Stripe.qml:51:3: Unable to assign [undefined] to QColor

0xf4b1 commented 8 months ago

oh sad :cry: the console log unfortunately does not help because all of this is unrelated, for me it only prints the first line. is it really the same error message? then it seems something must be different for you and the version you use. make sure you have the correct ca.pem and nothing more added to the keychain and enable trust. I encountered another message regarding offline mode but this was easy to circumvent.

Simacrus commented 8 months ago

i updated to last version Снимок экрана 2024-02-23 в 03 00 58

Simacrus commented 8 months ago

deleted old certificates, delete old repo, did every step

Simacrus commented 8 months ago

a few more console logs

/Native Instruments/Traktor 3.11.1/Crashlogs/crashdb/completed/1c80d994-099f-4e0d-8766-5cbc301c7479.dmp [28861:864632:20240223,030925.722728:WARNING crash_report_database_mac.mm:725] Failed to read report metadata for /Users/macbookair13/Documents/Native Instruments/Traktor 3.11.1/Crashlogs/crashdb/completed/be242927-e634-4730-bfc6-6967513b2276.dmp objc[28859]: objc_disposeClassPair: class 'NICocoaWindow' still has subclasses, including 'NSKVONotifying_NICocoaWindow'! objc[28859]: objc_disposeClassPair: class 'NICocoaWindow' still has subclasses, including 'NSKVONotifying_NICocoaWindow'! objc[28859]: objc_disposeClassPair: class 'NICocoaPanel' still has subclasses, including 'NSKVONotifying_NICocoaPanel'! objc[28859]: objc_disposeClassPair: class 'NICocoaPanel' still has subclasses, including 'NSKVONotifying_NICocoaPanel'!

Simacrus commented 8 months ago

how can i contact 2 u in private chat?

0xf4b1 commented 8 months ago

hmm, I think I found one missing step that prevents it from working :/ To be able to attach a debugger to the application, I had to create a code signing certificate and sign and override the original signature of the binary. And without having done this, this stub library trick does not work. So you have to create a code signing certificate in keychain (you can use the certificate assistant and choose certificate type "Code Signing") and if you named it "code" run the following on the Traktor binary sudo codesign --force --sign "code" /Applications/Native Instruments/Traktor Pro 3/Traktor.app/Contents/MacOS/Traktor

Simacrus commented 8 months ago

Funny story, the difference between our time zones is about 12 hours, I waited all day for an answer, finally you answered, but nothing worked and while I was sending you the console logs, someone tried to steal my battle net, restored it, just sat down to try your advice and I’ve run out of money on the Internet, apparently it’s not my destiny to do this today, I’ll try tomorrow)

Simacrus commented 7 months ago

If I understand correctly, I create a certificate using the assistant, name its code, identification type self-signed root certificate, certificate type code signing, then enter sudo codesign --force --sign "code" /Applications/Native Instruments/Traktor Pro 3/Traktor.app/Contents/MacOS/Traktor

Simacrus commented 7 months ago

if this is correct then nothing is working yet

0xf4b1 commented 7 months ago

oh sad :/ I can only try to also set it up from scratch again by following carefully the instructions I put together and if it works for me, I have no idea what else could be wrong or different on your side

0xf4b1 commented 7 months ago

I can confirm that with a fresh setup from scratch it works fine for me, so I have no idea what else could be different for you :( What ever you want to share, I can not access it, please make it non-private

Simacrus commented 7 months ago

Done✅

0xf4b1 commented 7 months ago

the codesign command in the last step does not succeed: resource fork, finder information, or similar detritus not allowed. I can not remember ever seen this error, try researching what can be done to solve this. For me, the command asks for password and only prints the first line. If you run echo $? after the command, it should print 0 which indicates the previous command succeeded.

Simacrus commented 7 months ago

YAAAAAAAAAAAAAAAAAAAAAAAAA FINALLY

Simacrus commented 7 months ago

so before sudo codesign --force --sign "code" /Applications/Native Instruments/Traktor Pro 3/Traktor.app/Contents/MacOS/Traktor u need to run sudo xattr -rc /Applications/Traktor\ Pro\ 3/Traktor.app; to delete metadata from keychain