obscurepy package

Submodules

obscurepy.obfuscator module

class obscurepy.obfuscator.Obfuscator(filepath=None, plugins=False, project_directory=None, output_directory='.', log=False, verbose=False)[source]

Bases: object

Main obfuscator class for managing files, handlers and other processes

Attributes:

filepath (str): Single file to be obscured

plugins (bool): Boolean representing whether or not load custom handlers

project_directory (str): The directory of the project to be obscured

output_directory (str): The directory to output the obscured code

filepaths (list): List of filenames to be obscured

chain (:obj: `Handler`): A single handler which is the first in the chain of handlers

tree (:obj: `ast.Module`): Reference to the ast tree created from text attribute

Args:

filepath (str): Single file to be obscured

plugins (bool): Boolean representing whether or not load custom handlers

project_directory (str): The directory of the project to be obscured

output_directory (str): The directory to output the obscured code

build_chain()[source]

Loads handlers and assigns the first one to the chain property

build_output_directories()[source]

Recreates the project directory structure in the output directory

get_project_filepaths()[source]

Sets the filepaths property to a list of filepaths found in the project directory

is_multi_file()[source]

Checks if this class is configured properly for a multi file project

is_single_file()[source]

Checks if this class is configured properly for a single file

obscure()[source]

Obscures the project or single file as defined in the class properties

obscure_file()[source]

Obscures a single file

obscure_project()[source]

Obscures a multi file project

set_tree(filepath)[source]

Sets the tree property to the parsed abstract syntax tree of source in the filepath provided

Args:

filepath (str): File path of which to get the tree

setup_logging()[source]

Sets the Obfuscator logger based on user configuration

write_tree_to_file(filepath)[source]

Writes unparsed abstract syntax trees to files

Args:

filepath (str): The location to save the source of the ast

Module contents