Skip to content

Commit

Permalink
Merge pull request #47 from dmdhrumilmistry/fix-nuitka-onefile-error
Browse files Browse the repository at this point in the history
Fix nuitka not found error on ubuntu
  • Loading branch information
dmdhrumilmistry authored Apr 29, 2023
2 parents 515432b + a4c5f54 commit db6a8a8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ The disclaimer advises users to use the open source project for ethical and legi
- [View How to create a Trojan](./HowTo/Malwares/CreateTrojanPackage.md)
- [Generator Script](./examples/EvilFiles/generatorScript.py)

`Note`: On linux host machines, user needs to install `patchelf` package. Install using below command.

```bash
apt/dnf/yum install patchelf
```

> Above command needs root privileges.
## Have any Ideas 💡 or issue

- Create an issue
Expand Down
20 changes: 15 additions & 5 deletions pyhtools/evil_files/exec_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
module: generator.py
description: generates evil file executable
'''
from enum import Enum
from subprocess import call
from os import name as os_name
from enum import Enum


class Compilers(Enum):
Expand All @@ -15,7 +15,7 @@ class Compilers(Enum):

class ExecutableGenerator:
'''
creates executable
creates executable from python script.
'''

def __init__(self, file_path: str, output_dir: str = None, icon: str = None, compiler: Compilers = Compilers.DEFAULT, onefile: bool = True, remove_output: bool = True,) -> None:
Expand All @@ -26,7 +26,6 @@ def __init__(self, file_path: str, output_dir: str = None, icon: str = None, com
self.__options = {
'onefile': onefile,
'standalone': True,
'onefile': True,
'remove-output': remove_output,
'output-dir': output_dir,
}
Expand All @@ -44,7 +43,14 @@ def __init__(self, file_path: str, output_dir: str = None, icon: str = None, com
self.__options['mingw'] = True

def __generate_command(self):
command = 'nuitka '
'''
generates nuitka command
'''
if os_name == 'nt':
command = 'python -m nuitka '
else:
command = 'python3 -m nuitka '

for key in self.__options:
cmd = ''
value = self.__options[key]
Expand All @@ -64,5 +70,9 @@ def __generate_command(self):
return command

def generate_executable(self):
# linux devices requires patchelf to be installed
# sudo apt install patchelf
command = self.__generate_command()
return call(command.split(), shell=True)

# vuln: os command injection
return call(command, shell=True)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyhtools"
version = "2.2.0"
version = "2.2.1"
description = "Python Hacking Tools (PyHTools) (pht) is a collection of python written hacking tools consisting of network scanner, arp spoofer and detector, dns spoofer, code injector, packet sniffer, network jammer, email sender, downloader, wireless password harvester credential harvester, keylogger, download&execute, and reverse_backdoor along with website login bruteforce, scraper, web spider etc. PHT also includes malwares which are undetectable by the antiviruses."
authors = ["Dhrumil Mistry <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit db6a8a8

Please sign in to comment.