HusseinBakri/Tanit-Keylogger

macOS executable not working

edenhikri opened this issue · 4 comments

I have tried to create a macOS executable using pyinstaller main.py --onefile --noconsole and it successfully completes. However, when I go to dist and double click the main file executable with the logo, nothing happens. It simply opens and then immediately closes. I have tried going into "Show Package Contents" -> "Contents" -> "macOS" -> "Open on the terminal file" but it does nothing.

I have also realised that pyinstaller does not work so well with python3.8 so I have switched it to python3.7 through python3.7 -m PyInstaller main.py --noconsole --onefile but this still does not work.

I am not sure why this is happening. I do not have AntiVirus installed on my computer.

Here is the terminal output when I run pyinstaller main.py --onefile --noconsole:

129 INFO: PyInstaller: 3.6
129 INFO: Python: 3.8.2
140 INFO: Platform: macOS-10.15.3-x86_64-i386-64bit
141 INFO: wrote /Users/myuser/Desktop/Tanit-Keylogger/main.spec
144 INFO: UPX is not available.
146 INFO: Extending PYTHONPATH with paths
['/Users/myuser/Desktop/Tanit-Keylogger',
 '/Users/myuser/Desktop/Tanit-Keylogger']
146 INFO: checking Analysis
146 INFO: Building Analysis because Analysis-00.toc is non existent
146 INFO: Initializing module dependency graph...
152 INFO: Caching module graph hooks...
162 INFO: Analyzing base_library.zip ...
Traceback (most recent call last):
  File "<string>", line 41, in <module>
  File "<string>", line 13, in walk_packages
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/pkgutil.py", line 130, in iter_modules
    for name, ispkg in iter_importer_modules(i, prefix):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/pkgutil.py", line 149, in _iter_file_finder_modules
    import inspect
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/inspect.py", line 40, in <module>
    import linecache
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/linecache.py", line 11, in <module>
    import tokenize
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tokenize.py", line 32, in <module>
    import re
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/re.py", line 143, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Traceback (most recent call last):
  File "<string>", line 41, in <module>
  File "<string>", line 13, in walk_packages
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/pkgutil.py", line 130, in iter_modules
    for name, ispkg in iter_importer_modules(i, prefix):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/pkgutil.py", line 149, in _iter_file_finder_modules
    import inspect
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/inspect.py", line 40, in <module>
    import linecache
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/linecache.py", line 11, in <module>
    import tokenize
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tokenize.py", line 32, in <module>
    import re
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/re.py", line 143, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
3355 INFO: Processing pre-find module path hook   distutils
3356 INFO: distutils: retargeting to non-venv dir '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8'
7094 INFO: Caching module dependency graph...
7176 INFO: running Analysis Analysis-00.toc
7184 INFO: Analyzing /Users/myuser/Desktop/Tanit-Keylogger/main.py
7449 INFO: Processing pre-safe import module hook   six.moves
10233 INFO: Processing module hooks...
10233 INFO: Loading module hook "hook-pkg_resources.py"...
Traceback (most recent call last):
  File "<string>", line 41, in <module>
  File "<string>", line 13, in walk_packages
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/pkgutil.py", line 130, in iter_modules
    for name, ispkg in iter_importer_modules(i, prefix):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/pkgutil.py", line 149, in _iter_file_finder_modules
    import inspect
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/inspect.py", line 40, in <module>
    import linecache
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/linecache.py", line 11, in <module>
    import tokenize
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tokenize.py", line 32, in <module>
    import re
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/re.py", line 143, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
10358 INFO: Excluding import '__main__'
10359 INFO:   Removing import of __main__ from module pkg_resources
10359 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
10362 INFO: Loading module hook "hook-lib2to3.py"...
10368 INFO: Loading module hook "hook-_tkinter.py"...
10372 ERROR: Tcl/Tk improperly installed on this system.
10372 INFO: Loading module hook "hook-encodings.py"...
Traceback (most recent call last):
  File "<string>", line 41, in <module>
  File "<string>", line 13, in walk_packages
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/pkgutil.py", line 130, in iter_modules
    for name, ispkg in iter_importer_modules(i, prefix):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/pkgutil.py", line 149, in _iter_file_finder_modules
    import inspect
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/inspect.py", line 40, in <module>
    import linecache
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/linecache.py", line 11, in <module>
    import tokenize
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tokenize.py", line 32, in <module>
    import re
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/re.py", line 143, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
10428 INFO: Loading module hook "hook-sysconfig.py"...
10440 INFO: Loading module hook "hook-xml.py"...
10555 INFO: Loading module hook "hook-pydoc.py"...
10556 INFO: Loading module hook "hook-distutils.py"...
10573 INFO: Looking for ctypes DLLs
10624 INFO: Analyzing run-time hooks ...
10627 INFO: Including run-time hook 'pyi_rth__tkinter.py'
10631 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
10634 INFO: Including run-time hook 'pyi_rth_pkgres.py'
10641 INFO: Looking for dynamic libraries
10817 INFO: Looking for eggs
10817 INFO: Using Python library /Library/Frameworks/Python.framework/Versions/3.8/Python
10821 INFO: Warnings written to /Users/myuser/Desktop/Tanit-Keylogger/build/main/warn-main.txt
10851 INFO: Graph cross-reference written to /Users/myuser/Desktop/Tanit-Keylogger/build/main/xref-main.html
10867 INFO: checking PYZ
10867 INFO: Building PYZ because PYZ-00.toc is non existent
10867 INFO: Building PYZ (ZlibArchive) /Users/myuser/Desktop/Tanit-Keylogger/build/main/PYZ-00.pyz
11440 INFO: Building PYZ (ZlibArchive) /Users/myuser/Desktop/Tanit-Keylogger/build/main/PYZ-00.pyz completed successfully.
11451 INFO: checking PKG
11451 INFO: Building PKG because PKG-00.toc is non existent
11452 INFO: Building PKG (CArchive) PKG-00.pkg
15186 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
15190 INFO: Bootloader /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/bootloader/Darwin-64bit/runw
15190 INFO: checking EXE
15190 INFO: Building EXE because EXE-00.toc is non existent
15190 INFO: Building EXE from EXE-00.toc
15190 INFO: Appending archive to EXE /Users/myuser/Desktop/Tanit-Keylogger/dist/main
15224 INFO: Fixing EXE for code signing /Users/myuser/Desktop/Tanit-Keylogger/dist/main
15227 INFO: Building EXE from EXE-00.toc completed successfully.
15231 INFO: checking BUNDLE
15231 INFO: Building BUNDLE because BUNDLE-00.toc is non existent
15231 INFO: Building BUNDLE BUNDLE-00.toc
15296 INFO: moving BUNDLE data files to Resource directory

Wait, do you want to open *.exe on macOS? An *.exe is an executable file for Windows so won't work on the Mac.

@Subucc Oh I see the mistake I have made. Is there a way to use Pyinstaller to make a macOS executable? I used the program normally (without using Pyinstaller to turn it into an app) and it works well on my Mac. But I want it as an app with Pyinstaller.

@Subucc its actually not a .exe it's a .app

Does this keylogger work on new Mac OS version? I read about a special feauture that will ask the user to authorize the logging of keystrokes pressed