junlarsen / league-connect

:electric_plug: Node.js HTTP/1.1, HTTP/2.0 and WebSocket interface to the League of Legends Client APIs
https://www.npmjs.com/package/league-connect
MIT License
156 stars 24 forks source link

Password RegEx bug #85

Closed lologrignola closed 1 year ago

lologrignola commented 2 years ago

image

As you can see the current RegEx (the top portion of the screenshot) is taking the "--app-pid" and this is causing problems in the authentication part. I'm basically trash at RegEx so couldn't find a RegEx-fix but had a work around with .replace.

Let me know if you can fix it with RegEx or you want me to create a branch with the other fix.

Bye 😄

junlarsen commented 2 years ago

That's interesting, do you think you'd be able to get the entire output from the program (the stdout variable here https://github.com/matsjla/league-connect/blob/master/src/authentication.ts#L140) for debugging purposes? You can censor out any sensitive parts, but I'd like to see why it would join them

The RegEx used is /--remoting-auth-token=([\w-_]+)/ which suggests there is no space in your output but I'd love to double check.

It would also be appreciated if you could open a fix with the .replace so we can evaluate different approaches! Thanks!

lologrignola commented 2 years ago

Yes, here it is:

"M:/Games/Riot Games/Riot Client/UX/RiotClientUx.exe" --app-port=56160 --remoting-auth-token=RQC0fruXtnXRUyS5SDd6DA --app-pid=1160 "--log-dir=C:/Users/loren/AppData/Local/Riot Games/Riot Client/Logs" "--user-data-root=C:/Users/loren/AppData/Local/RiotGames/Riot Client" "--app-root=M:/Games/Riot Games/Riot Client" --crashpad-environment=KeystoneFoundationLiveWin

junlarsen commented 2 years ago

Uhm that's very weird. The regex is not supposed to, and does not capture --app-pid 🤔

https://regexr.com/6qm8l

lologrignola commented 2 years ago

Wtf, that's weird idk why it gets captured in my case then. Probably you can just ignore this then, seems like an exclusive scenario and I found a work around. Thanks

junlarsen commented 2 years ago

Sounds good, I'll keep this issue open in case anybody else stumbles upon the same issue

andrewshvv commented 2 years ago

Bumping it, same issue

junlarsen commented 2 years ago

They patched the package locally I believe with this change https://github.com/matsjla/league-connect/pull/86/files

vDk3 commented 1 year ago

@matsjla any update? still broken but in my case it capture --app-port at the end of password. _url: 'wss://riot:8CB0AGpFZigrT7zNIXKpeQ--app-port@127.0.0.1:53125',

https://regexr.com/73pb3

junlarsen commented 1 year ago

Hmm maybe we could edit the regex to ignore any trailing double dashes

vDk3 commented 1 year ago

Hmm maybe we could edit the regex to ignore any trailing double dashes

Also there is no spaces in stdout because of this line: const stdout = rawStdout.replace(/\s/g, "");

if you apply regex against rawStdout it works.

So replacing const [, password] = stdout.match(passwordRegex); to const [, password] = rawStdout.match(passwordRegex);

fixes this issue.

junlarsen commented 1 year ago

Right, that I believe someone had a similar problem with the rawStdout too though https://github.com/matsjla/league-connect/pull/60

infister commented 1 year ago

https://github.com/matsjla/league-connect/pull/97