janmechtel / rockettype

A windows keylooger to track typing statistics like WPM
MIT License
3 stars 0 forks source link

Installer #2

Closed janmechtel closed 4 years ago

janmechtel commented 4 years ago

Would be really nice if one could download an .exe or .msi to install everything.

Installer candidates

Which installer should we use? Apparently we need something to included the Python stuff and then something to create an installer.

Combined Freeze and Installer:

Freeze Tools:

Actual Installers:

What to consider:

Signing

This will probably trigger Windows Smartscreen / Defender warnings when publishing unsigned / without and EV certificate. Even with the certificate there will be a warning for the first couple of downloads.

See https://pynsist.readthedocs.io/en/latest/faq.html#code-signing

One way around this would be to go through the Windows Store

Windows Store would also provide some basic stats?

janmechtel commented 4 years ago

PyInstaller

pip install pyinstaller pyinstaller logger.pyw

TODO

janmechtel commented 4 years ago

pynist

Installation

  1. https://nsis.sourceforge.io/Download (3.06.1)
  2. pip install pynsist
  3. Write installer.cfg
  4. python -m nsist installer.cfg

Result

TODO

janmechtel commented 4 years ago

Not working yet :-( The RocketType Start menu shortcut contains this:

C:\Users\JanMechtel\AppData\Local\Programs\RocketType\Python\pythonw.exe "C:\Users\JanMechtel\AppData\Local\Programs\RocketType\logger.pyw"

Which doesn't seem to work. I tricked myself into thinking it works by double clicking logger.pyw

janmechtel commented 4 years ago

running with python.exe instead C:\Projects\Keys\RocketType\build\nsis\Python\python.exe "C:\Projects\Keys\RocketType\build\nsis\logger.pyw"

  1. Revealed that "import six" fails, adding six==... to the .cfg fixed that.
  2. Now the next one is pkg_resources which seems to be related to setuptools addin to .cfg fixed that
  3. win32api missing added pypiwin32 didn't work

... the last one was tricky

"C:\Users\JanMechtel\AppData\Local\Programs\Python\Python38\lib\site-packages\nsist\wheels.py", line c. 40,

remove the m from d = {'cp%sm' % py_version_nodot: 3, # Is the m reliable? and turn it into d = {'cp%s' % py_version_nodot: 3, # Is the m reliable?

then it at least builds the installer but still fails :(

I've confirmed that there is a file pkgs/win32/win32api.pyd .pyd is supposed to be a windows specific python module.

I can't import it.

I tried runnning only the nsist/python.exe and import there.

import pynput print(pynput)

works

also import sys and print(sys.path) shows the correct path

I'm a bit out of luck why the module can not be loaded I'll ask on StackOverflow maybe it's related to 32 vs. 64 bit (however import platform + platform.architecture shows 64bit both in the nsist and my normal local version.

Otherwise we could try:

janmechtel commented 4 years ago

Partial success the nsist\python.exe can import win32api after:

sys.path.append('C:\\Projects\\Keys\\RocketType\\build\\nsis\\pkgs\\win32\\lib')
sys.path.append('C:\\Projects\\Keys\\RocketType\\build\\nsis\\pkgs\\win32')
import pywin32_bootstrap
import win32api

Now that I found the problem I fixed it and submitted a PR https://github.com/takluyver/pynsist/pull/204

janmechtel commented 4 years ago

@appins can you please try the installer from the homepage and report back?

appins commented 4 years ago

@janmechtel I tried this, the program worked the first time and then stopped working. Running it from the command line yields no output. I suspect it might have trouble trying to capture the keyboard output the second time around. Could you see if you need to close access to any of the files/objects you're using in the code?

appins commented 4 years ago

Also, you should consider cython, it might be nice to have a portable binary, as this would also solve #12

janmechtel commented 4 years ago

@janmechtel I tried this, the program worked the first time and then stopped working. Running it from the command line yields no output. I suspect it might have trouble trying to capture the keyboard output the second time around.

Can you:

I will:

janmechtel commented 4 years ago

I don't have any idea about objects we are blocking, even the listener is not exclusive. In fact i can start the installed app multiple times at once ...

I will:

janmechtel commented 4 years ago

Cython

I'm not really sure how this would work yet and believe this would also create one giant .exe not a real installer

https://stackoverflow.com/questions/2581784/can-cython-compile-to-an-exe

appins commented 4 years ago

Yeah, I tried opening task manager and python and pythonw were both running. When I killed the tasks and reopened it, it continued to not work and the processes reappeared. I will try restarting my computer since maybe that has something to do with it and get back to you.

As for Cython, it would create a large executable, but maybe that wouldn't be too bad of a way to use the program. I feel like people might be more willing to have a keylogger be a portable program rather than an installer, but maybe that's a project for a later time.

appins commented 4 years ago

After restarting my computer, this issue no longer occurs.