Skip to content

Commit

Permalink
🗓 Oct 8, 2023 3:39:45 PM
Browse files Browse the repository at this point in the history
🐙 minor changes
  • Loading branch information
securisec committed Oct 8, 2023
1 parent f2c8844 commit eb31bdd
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion chepy/chepy_plugins
22 changes: 11 additions & 11 deletions chepy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def __init__(self, *data):
self.cyberchef = self.web
#: Alias for `load_file`
self.read_file = self.load_file
#: Holds all the methods that are called/chanined and their args
#: Holds all the methods that are called/chained and their args
self._stack = list()

#: Log level
Expand Down Expand Up @@ -528,7 +528,7 @@ def delete_buffer(self, index: int):
def substring(self, pattern: str, group: int = 0):
"""Choose a substring from current state as string
The preceeding methods will only run on the substring and
The preceding methods will only run on the substring and
not the original state. Group capture is supported.
Args:
Expand All @@ -542,13 +542,13 @@ def substring(self, pattern: str, group: int = 0):
return self

def _convert_to_bytes(self) -> bytes:
"""This method is used to coerce the curret object in
"""This method is used to coerce the current object in
the state variable into a string. The method should be
called inside any method that operates on a string object
instead of calling `self.state` directly to avoid errors.
Raises:
NotImplementedError: If type coercian isnt available
NotImplementedError: If type coercian isn't available
for the current state type.
"""
if isinstance(self.state, bytes):
Expand Down Expand Up @@ -578,13 +578,13 @@ def _convert_to_bytearray(self) -> bytearray:
return bytearray(self._convert_to_bytes())

def _convert_to_str(self) -> str:
"""This method is used to coerce the curret object in
"""This method is used to coerce the current object in
the state variable into bytes. The method should be
called inside any method that operates on a bytes object
instead of calling `self.state` directly to avoid errors.
Raises:
NotImplementedError: If type coercian isnt available
NotImplementedError: If type coercian isn't available
for the current state type.
"""
if isinstance(self.state, bytes):
Expand Down Expand Up @@ -638,13 +638,13 @@ def _bytes_to_str(self, s: bytes) -> str: # pragma: no cover
return s

def _convert_to_int(self) -> int:
"""This method is used to coerce the curret object in
"""This method is used to coerce the current object in
the state variable into an int. The method should be
called inside any method that operates on a int types
instead of calling `self.state` directly to avoid errors.
Raises:
NotImplementedError: If type coercian isnt available
NotImplementedError: If type coercian isn't available
for the current state type.
"""
if isinstance(self.state, int):
Expand Down Expand Up @@ -1015,7 +1015,7 @@ def run_recipe(self, recipes: List[Mapping[str, Union[str, Mapping[str, Any]]]])
def save_recipe(self, path: str):
"""Save the current recipe
A recipe will be all the previous methdos called on the
A recipe will be all the previous methods called on the
chepy instance along with their args
Args:
Expand Down Expand Up @@ -1107,7 +1107,7 @@ def loop(self, iterations: int, callback: str, args: dict = {}):
# this allows for both method and string passing
callback = callback.__name__
assert isinstance(callback, str), "Callback must be a string"
assert isinstance(iterations, int), "Iterations must be an intiger"
assert isinstance(iterations, int), "Iterations must be an integer"
assert isinstance(args, dict), "Args must be a dick"

stack_loop_index = next(
Expand Down Expand Up @@ -1287,7 +1287,7 @@ def load_command(self): # pragma: no cover
Chepy: The Chepy object.
Examples:
This method can be used to interace with the shell and Chepy
This method can be used to interface with the shell and Chepy
directly by ingesting a commands output in Chepy.
>>> c = Chepy("ls -l").shell_output().o
Expand Down
2 changes: 1 addition & 1 deletion chepy/extras/combinatons.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def generate_combo(
Args:
words (List[Any]): List of strings.
min_length (int, optional): Mininum length of permutations. By default, 0 which
min_length (int, optional): Minimum length of permutations. By default, 0 which
will generate all
max_length (int, optional): Maximum length of permutations.
By default, it is the length of the `words` list
Expand Down
10 changes: 5 additions & 5 deletions chepy/modules/dataformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def list_to_str(self, join_by: Union[str, bytes] = " ") -> DataFormatT:
"a,b,c"
"""
assert isinstance(self.state, list), "Data in state not a list"
# convert the list of items in state appropiately
# convert the list of items in state appropriately
if isinstance(join_by, str):
self.state = [str(x) for x in self.state]
elif isinstance(join_by, bytes):
Expand Down Expand Up @@ -585,7 +585,7 @@ def from_hex(self, delimiter: str = None, join_by: str = " ") -> DataFormatT:

@ChepyDecorators.call_stack
def hex_to_int(self) -> DataFormatT:
"""Converts hex into its intiger represantation
"""Converts hex into its integer representation
Returns:
Chepy: The Chepy object.
Expand Down Expand Up @@ -899,7 +899,7 @@ def from_charcode(

@ChepyDecorators.call_stack
def to_decimal(self, join_by: str = " ") -> DataFormatT:
"""Convert charactes to decimal
"""Convert characters to decimal
Args:
join_by (str, optional): Join the decimal values by this. Defaults to ' '.
Expand Down Expand Up @@ -1180,7 +1180,7 @@ def decode_bruteforce(self) -> DataFormatT:

@ChepyDecorators.call_stack
def to_braille(self) -> DataFormatT:
"""Convery text to six-dot braille symbols
"""Convert text to six-dot braille symbols
Returns:
Chepy: The Chepy object.
Expand All @@ -1195,7 +1195,7 @@ def to_braille(self) -> DataFormatT:

@ChepyDecorators.call_stack
def from_braille(self) -> DataFormatT:
"""Convery text to six-dot braille symbols
"""Convert text to six-dot braille symbols
Returns:
Chepy: The Chepy object.
Expand Down
26 changes: 13 additions & 13 deletions chepy/modules/encryptionencoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def _rsa_process_key(self, key: str, is_file: bool, passphrase=None):
return RSA.import_key(key, passphrase)

def _rsa_cipher(self, c_format: str, rsa):
"""Returns an RSA Cipher instnace based for cipher type"""
"""Returns an RSA Cipher instance based for cipher type"""
if c_format == "PKCS":
return PKCS1_v1_5.new(rsa)
return PKCS1_OAEP.new(rsa)
Expand Down Expand Up @@ -434,7 +434,7 @@ def jwt_sign(self, secret: str, algorithms: str = "HS256") -> EncryptionEncoding
def jwt_token_generate_none_alg(
self, headers: Dict[str, Any] = {}
) -> EncryptionEncodingT:
"""Generate a jwt token with none algorithem
"""Generate a jwt token with none algorithm
Args:
headers (Dict[str, Any], optional): Headers. `alg` key will be overwritten. Defaults to {}.
Expand Down Expand Up @@ -467,7 +467,7 @@ def jwt_token_generate_embedded_jwk(
private_key_pem (str): Private key to sign token
private_key_passphrase (str, optional): Private key passphrase. Defaults to None.
headers (dict, optional): Token headers. Defaults to {}.
alg (str, optional): Token algorithem. Defaults to "RS256".
alg (str, optional): Token algorithm. Defaults to "RS256".
Returns:
Chepy: The Chepy object.
Expand Down Expand Up @@ -596,7 +596,7 @@ def des_encrypt(
>>> Chepy("some data").des_encrypt("70617373776f7264").o
b"1ee5cb52954b211d1acd6e79c598baac"
To encrypt using a differnt mode
To encrypt using a different mode
>>> Chepy("some data").des_encrypt("password", mode="CTR").o
b"0b7399049b0267d93d"
Expand Down Expand Up @@ -1131,14 +1131,14 @@ def vigenere_decode(self, key: str) -> EncryptionEncodingT:

@ChepyDecorators.call_stack
def affine_encode(self, a: int = 1, b: int = 1) -> EncryptionEncodingT:
"""Encode with Affine ciper
"""Encode with Affine cipher
Args:
a (int, optional): Multiplier value. Defaults to 1
b (int, optional): Additive value. Defaults to 1
Returns:
Chepy: The Chepy oject.
Chepy: The Chepy object.
Examples:
>>> Chepy("secret").affine_encode().o
Expand All @@ -1149,14 +1149,14 @@ def affine_encode(self, a: int = 1, b: int = 1) -> EncryptionEncodingT:

@ChepyDecorators.call_stack
def affine_decode(self, a: int = 1, b: int = 1) -> EncryptionEncodingT:
"""Decode Affine ciper
"""Decode Affine cipher
Args:
a (int, optional): Multiplier value. Defaults to 1
b (int, optional): Additive value. Defaults to 1
Returns:
Chepy: The Chepy oject.
Chepy: The Chepy object.
Examples:
>>> Chepy("TFDSFU").affine_decode().o
Expand All @@ -1167,10 +1167,10 @@ def affine_decode(self, a: int = 1, b: int = 1) -> EncryptionEncodingT:

@ChepyDecorators.call_stack
def atbash_encode(self) -> EncryptionEncodingT:
"""Encode with Atbash ciper
"""Encode with Atbash cipher
Returns:
Chepy: The Chepy oject.
Chepy: The Chepy object.
Examples:
>>> Chepy("secret").atbash_encode().o
Expand All @@ -1181,10 +1181,10 @@ def atbash_encode(self) -> EncryptionEncodingT:

@ChepyDecorators.call_stack
def atbash_decode(self) -> EncryptionEncodingT:
"""Decode Atbash ciper
"""Decode Atbash cipher
Returns:
Chepy: The Chepy oject.
Chepy: The Chepy object.
Examples:
>>> Chepy("hvxivg").atbash_decode().o
Expand Down Expand Up @@ -1439,7 +1439,7 @@ def rsa_private_pem_to_jwk(self) -> EncryptionEncodingT:

@ChepyDecorators.call_stack
def rsa_public_key_from_jwk(self) -> EncryptionEncodingT:
"""Genereate RSA public key in PEM format from JWK
"""Generate RSA public key in PEM format from JWK
Raises:
AssertionError: If n or e not found
Expand Down
14 changes: 7 additions & 7 deletions chepy/modules/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def extract_hashes(self) -> ExtractorsT:
>>> ).extract_hashes()
{'md5': [b'60b725f10c9c85c70d97880dfe8191b3'], 'sha1': [b'3f786850e387550fdab836ed7e6dc881de23001b'], 'sha256': [], 'sha512': []}
"""
# TODO make this more effecient. because at the moment, we are compiling and running this 4 separate times.
# TODO make this more efficient. because at the moment, we are compiling and running this 4 separate times.
data = self._convert_to_bytes()
found = {}
found["md5"] = re.findall(
Expand Down Expand Up @@ -437,7 +437,7 @@ def extract_base64(self, min: int = 20) -> ExtractorsT:
"""Extract base64 encoded strings
Args:
min (int, optional): Minium length to match. Defaults to 20.
min (int, optional): Minimum length to match. Defaults to 20.
Returns:
Chepy: The Chepy object.
Expand All @@ -457,7 +457,7 @@ def find_continuous_patterns(
Args:
str2 (Union[str, bytes]): String to find matches against
min_value (int, optional): Minimum value of continious matches. Defaults to 10.
min_value (int, optional): Minimum value of continuous matches. Defaults to 10.
Returns:
Chepy: The Chepy object.
Expand All @@ -481,7 +481,7 @@ def find_continuous_patterns(

@ChepyDecorators.call_stack
def find_longest_continious_pattern(self, str2: str) -> ExtractorsT:
"""Find longest continious pattern
"""Find longest continuous pattern
Args:
str2 (Union[str, bytes]): String to find match against
Expand Down Expand Up @@ -572,11 +572,11 @@ def decode_from_zero_width_characters_text(str1):
return "".join(result)

def decodeText(text):
splitted = split_zerowidth_characters(text)
split = split_zerowidth_characters(text)
return {
# 'originalText': splitted['originalText'],
# 'originalText': split['originalText'],
"hidden": decode_from_zero_width_characters_text(
splitted["hiddenText"]
split["hiddenText"]
) # , codelengthText)
}

Expand Down
4 changes: 2 additions & 2 deletions chepy/modules/hashing.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,10 @@ def scrypt_hash(
@ChepyDecorators.call_stack
@ChepyDecorators.is_stdout
def password_hashing(self, format: str, **kwargs: Any) -> HashingT:
"""Hash the state with various password hashing algorithems
"""Hash the state with various password hashing algorithms
Args:
format (str): Hash state with password algorithems
format (str): Hash state with password algorithms
Returns:
Chepy: The Chepy object.
Expand Down
4 changes: 2 additions & 2 deletions chepy/modules/internal/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def cli_get_attr(fire: object, attr: str):
if fire is not None and not isinstance(fire, Chepy):
print_in_colors(getattr(fire, attr)())
else:
print(red("Nope. That didnt work.."))
print(red("Nope. That didn't work.."))


def cli_pretty_print(fire: object):
Expand All @@ -255,7 +255,7 @@ def cli_pretty_print(fire: object):
if fire is not None and isinstance(fire, Chepy):
print_in_colors(pprint.pformat(fire.state))
else:
print(red("Nope. That didnt work.."))
print(red("Nope. That didn't work.."))


def cli_plugin_path(config):
Expand Down
4 changes: 2 additions & 2 deletions chepy/modules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def reverse(self, count: int = 1) -> UtilsT:

@ChepyDecorators.call_stack
def count_occurances(self, regex: str, case_sensitive: bool = False) -> UtilsT:
"""Counts occurances of the regex.
"""Counts occurrences of the regex.
Counts the number of times the provided string occurs.
Expand Down Expand Up @@ -128,7 +128,7 @@ def regex_search(
Args:
pattern (str): Required. The regex pattern to search by
ignore_case (bool, optional): Set case insentive flag. Defaults to False.
ignore_case (bool, optional): Set case insensitive flag. Defaults to False.
multiline (bool, optional): ^/$ match start/end. Defaults to False.
dotall (bool, optional): `.` matches newline. Defaults to False.
unicode (bool, optional): Match unicode characters. Defaults to False.
Expand Down

0 comments on commit eb31bdd

Please sign in to comment.