securisec / chepy

@@ -9,6 +9,23 @@
Loading
9 9
    `Reference <https://github.com/dxa4481/truffleHog>`__
10 10
    """
11 11
12 +
    @ChepyDecorators.call_stack
13 +
    def search(self, pattern: str):
14 +
        """Search. Group matches are returned as tuples.
15 +
        
16 +
        Args:
17 +
            pattern (str): String pattern to search
18 +
        
19 +
        Returns:
20 +
            Chepy: The Chepy object. 
21 +
22 +
        Examples:
23 +
            >>> Chepy("abcdefg123 and again abcdefg123").search("abc(de)fg(12)(3)").o
24 +
            [('abcdefg123', 'de', '12', '3'), ('abcdefg123', 'de', '12', '3')]
25 +
        """
26 +
        self.state = re.findall('({})'.format(pattern), self._convert_to_str())
27 +
        return self
28 +
12 29
    @ChepyDecorators.call_stack
13 30
    def search_ctf_flags(self, prefix: str, postfix: str = ".+?\{*\}"):
14 31
        """Search CTF style flags. 

@@ -70,6 +70,37 @@
Loading
70 70
        self.state = self.state.translate(lookup)
71 71
        return self
72 72
73 +
    @ChepyDecorators.call_stack
74 +
    def rotate_bruteforce(self):
75 +
        """Brute force rotation from 1 to 26.
76 +
        Returned value is a dict where key is the rotation count.
77 +
        
78 +
        Returns:
79 +
            Chepy: The Chepy object.
80 +
81 +
        Examples:
82 +
            In this example, we will rotate by 20
83 +
84 +
            >>> Chepy('uryyb').rotate_bruteforce()
85 +
            {
86 +
                '1': 'vszzc',
87 +
                '2': 'wtaad',
88 +
                ...
89 +
                '13': 'hello',
90 +
                ...
91 +
            }
92 +
        """
93 +
        hold = {}
94 +
        lc = string.ascii_lowercase
95 +
        uc = string.ascii_uppercase
96 +
        for rotate_by in range(1,27):
97 +
            lookup = str.maketrans(
98 +
                lc + uc, lc[rotate_by:] + lc[:rotate_by] + uc[rotate_by:] + uc[:rotate_by]
99 +
            )
100 +
            hold[str(rotate_by)] = self.state.translate(lookup)
101 +
        self.state = hold
102 +
        return self
103 +
73 104
    @ChepyDecorators.call_stack
74 105
    def rot_13(self):
75 106
        """ROT-13 encoding
Files Coverage
chepy 100.00%
Project Totals (24 files) 100.00%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading