ctfsolver.src.position_cipher_functions

Classes

Module Contents

class PositionCipher[source]
load_lyrics()[source]
dictionary_analysis(lyrics)[source]
print_dictionary(d)[source]
lyric_transpose(lyrics, offset, wrap=True)[source]
lyric_transformation(lyrics)[source]
lyrics_all()[source]
Description:

This function generates all possible combinations of lyrics transformations based on the provided replace_combos and control_combos. It uses itertools.product to create combinations of the specified number of transformations, allowing for flexible lyric manipulation.

Returns:

A list of transformed lyrics combinations.

Return type:

list

creating_control_combos(start=0, end=1, number=8)[source]
lyrics_transformation(lyrics, replace_combos, control_combos=None)[source]
brute_transpose_find_flag(lyrics, partial_flag, keys, verbose=False, wrap=True)[source]
Description:

For the lyrics given

Parameters:
  • lyrics (str) – Lyrics given

  • partial_flag (str) – partial flag to look

  • verbose (bool, optional) – _description_. Defaults to False.

  • keys (list)

  • wrap (bool)

Returns:

possible flag

Return type:

str

check_for_rot(text, partial='ecsc')[source]
Description:

Checks if the text is a rotation of “ecsc”. This function checks if the first four characters of the text can be rearranged to form the string “ecsc”. It does this by comparing the ASCII values of the characters in the text with the ASCII values of the characters in “ecsc”. If the conditions are met, it returns True, indicating that the text is a rotation of “ecsc”. Otherwise, it returns False. This function is useful for identifying specific patterns in the text that match the structure of “ecsc”, which could be relevant in certain

Challenge_specific

Parameters:

text (_type_) – _description_

Returns:

_description_

Return type:

_type_

position_cipher(text, keys)[source]
Description:

This function takes a text and a list of keys, and returns a new string where each character in the text is replaced by the character at the corresponding index in the keys list. If the index exceeds the length of the text, it wraps around using modulo operation.

Parameters:
  • text (str) – The input text to be transformed.

  • keys (list) – A list of integers representing the positions in the text.

Returns:

A new string formed by replacing characters in the text based on the keys.

Return type:

str

bruteforce_all_lyrics(all_lyrics, partial_flag, keys, verbose=False, wrap=True)[source]
Parameters:
init_some_values()[source]
another_attempt()[source]
main()[source]