Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with timhoeck Android App : invalid password" #6

Open
gemboot opened this issue Apr 26, 2017 · 12 comments
Open

Incompatible with timhoeck Android App : invalid password" #6

gemboot opened this issue Apr 26, 2017 · 12 comments
Labels

Comments

@gemboot
Copy link

gemboot commented Apr 26, 2017

Hello,

There seem to be an incompatibility with this Android Plugin :
https://github.com/timhoeck/eventghost-android

Whenever I try to send an event from EventGhost to this Android app, I get this error on the app "invalid password", it receives the event but can't go further because of the password problem. Now if I do the exact same test with the same settings but this time with the original "Event Network Sender" included in EventGhost it works right away, so there must be something broken. Maybe the problem comes from the Android App itself, but the awkward thing is that it works flawlessly with "Event Network Sender"... Any hints on this ? Does anybody have noticed this as well ?

thanks.

@per1234
Copy link
Owner

per1234 commented Apr 27, 2017

Hi, I've never tested this plugin with that app. I only recently got an Android device and I'm kind of clueless about how to proceed. Here's what I tried:

  1. Install Android Studio
  2. Download and unzip https://github.com/timhoeck/eventghost-android/archive/master.zip
  3. Start Android Studio
  4. Open the eventghost-android-master folder.
  5. Build > Generate Signed APK...
  6. Copy the generated .apk file to my Android tablet.
  7. Ran the .apk file and installed the app

but then every time I try to start the app it says:

Unfortunately, Eventghost for Android has stopped.

Any chance you could give me a description of the steps I need to take to get this app running?

@gemboot
Copy link
Author

gemboot commented Apr 27, 2017

Hi, thanks for your quick reply.

Well to tell you the truth, I didn't install Android Studio, I have just installed the EG app from the PlayStore just like I would do with any other app, nothing special to say about it, it worked right away, I've been using it for many months now, and I came across your wonderful plugin, and notice it's not compatible with this app...

What version of Android do you have on your phone ?

@per1234
Copy link
Owner

per1234 commented Apr 27, 2017

Oh... haha. I'm sure showing my cluelessness about this Android stuff. I haven't used the PlayStore before so I definitely took the hard path. That Android Studio is 5.5 GB! I'll give the PlayStore thing a try later today when I get some time.

@gemboot
Copy link
Author

gemboot commented Apr 27, 2017

LOL ok, no problem, if I can help you in any way don't hesitate to ask, even though my knowledge in coding is very limited :)

@gemboot
Copy link
Author

gemboot commented Apr 29, 2017

Hi, did you have the time to check this out ?

@per1234
Copy link
Owner

per1234 commented Apr 29, 2017

I've identified the problem. The issue is that TCPEvents sends some extra characters during the communication process to identify itself as the TCPEvents plugin, rather that the standard EventGhost Network Events Sender/Receiver plugins:
The extra space prepended to "accept" here:

self.push(" accept\n")

 self.push(" accept\n")

"TCPEvents" prepended to the MD5 here:

sock.sendall("TCPEvents" + digest)

 sock.sendall("TCPEvents" + digest)

This enables the special actions of TCPEvents: Send Data and Request Data.

The Network Events Sender/Receiver plugins happen to be written so that these extra characters don't interfere with the communication but unfortunately @timhoeck's app is not so lenient. The extra characters cause the communication with the app to fail. This happens even when used with the original TCPEvents plugin

The best solution would be to change the app to make it compatible with TCPEvents as well as the Network Event Sender/Receiver plugins.

The next best solution, and the one more accessible to me, is to add options to the TCPEvents plugin configuration and Send an event action configuration dialogs that cause TCPEvents to not send the extra characters that identify the plugin. The drawback is that will prevent the use of the special features.

I don't have the time to do a proper fix now so I have done a quick fix that just removes the extra characters normally sent by TCPEvents to make the plugin work with the app without adding the configuration options. This means Send Data and Request Data can not be used. The modified plugin is attached:
TCPEvents-issue_6.zip

@gemboot
Copy link
Author

gemboot commented Apr 30, 2017

Hi, thanks for the explanation, and especially for this quick temporary fix, it works now !! :) 👍

Many thanks again for this plugin, that I find more useful than the original NES/R.

@gemboot
Copy link
Author

gemboot commented Jun 13, 2017

Hi,
any plan to work on this plugin soon to make it 100% compatible with all the features ?
Thank you

@per1234
Copy link
Owner

per1234 commented Jun 13, 2017

It will be some weeks before I can work on this. I'm uncertain whether it will ever be possible for me to allow compatibility with the app and also the use of the special "data" actions of TCPEvents at the same time. The reason is those extra characters that caused the incompatibility with the app are also required for the special "data" actions to work. The easy fix is to just add an option to the plugin configuration that allows the user to turn on or off support for the "data" actions. However, I do have an idea for how it might be done but I haven't spent any time looking at the code or testing to see if this is feasible.

Do you actually use those "data" actions? I've never found a need for them myself.

@gemboot
Copy link
Author

gemboot commented Jun 13, 2017

I recently changed my phone and your previous fix is not working anymore, with my previous phone (Android 4.4.2) it's still working, but with the new one (Android 7.1.1) I can receive the event on it but it says "invalid password from server" and I'm sure the password is correct (I tried short passwords, long passwords, without password) and I get the same error for all cases.

I also tried with the legacy Network Event Sender, and to my surprise I got the same error, so now it's something common to both plugins, neither works ! :) It's a "good" news in a way, it probably means that the password information is sent in a form that the new Android doesn't understand, maybe related to some sort of text encoding ? UTF8 or UTF16 or anything else ? I have no clue...

On the other hand, sending an event from the phone (7.1.1.) to the computer works perfectly.

Regarding your question about the "data" feature, I don't use it at all, maybe you could make a special version without this feature ? I'm not sure anyone is using it, I don't know.

Thank you again.

@per1234
Copy link
Owner

per1234 commented Jun 13, 2017

The password issue will be difficult for me to work on since I can't reproduce it. If you find a solution and want to submit a pull request for it I'll definitely consider merging it. My recommendation is to use the free program Wireshark to view the TCP packets sent between the Android and your computer. You'll want to add a filter to restrict logging to TCP and the IP address of the Android so that other network events don't clutter up the log.

Since you're not using the data actions the patched version of the plugin I attached in my previous reply will work just as well for you as any final solution I come up with. The only limitation of that version of the plugin is that it disables use of the data actions in favor of compatibility with the app. This is the main reason I have been putting other EventGhost related work at a higher priority than working on this issue. A temporary solution already exists and I don't see the loss of the rarely used data actions as being an inconvenience to anyone.

@gemboot
Copy link
Author

gemboot commented Jun 13, 2017

ok, i used wireshark and I used the Network Event Sender plugin to be in the most basic setup, and I saw something that is different between the two phones, have a look on this screenshot below :
https://lut.im/AuMe4wheBc/pBshewzhk6CqXLB2.png

Legend :

  • on the left (top & bottom) it's the android 4.4.2 (working)
  • on the right (top & bottom) it's the android 7.1.1 (not working)
  • pink colored lines are sent from EG to android
  • blue colored lines are sent from android to EG

as you can see 5 bytes are missing in the packet sent from Android to EG (the first blue line)
Android 7.1.1 sends 1 byte only : 34

on the other hand, all 6 bytes are there in the packet sent from Android to EG
Android 4.4.2 sends 6 bytes : 34353139330a

that's the reason why the following packets are not correct.. I don't know why this is happening ?
Do you need other information ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants