MCPcopy
hub / github.com/bee-san/pyWhat / print_raw

Method print_raw

pywhat/printer.py:127–193  ·  view source on GitHub ↗
(self, text: dict, text_input, print_tags=False)

Source from the content-addressed store, hash-verified

125 """
126
127 def print_raw(self, text: dict, text_input, print_tags=False):
128 output_str = ""
129
130 if text["File Signatures"] and text["Regexes"]:
131 for key, value in text["File Signatures"].items():
132 if value:
133 output_str += "\n"
134 output_str += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
135 output_str += f"\n[bold #D7Afff]File Description:[/bold #D7Afff] {value['Description']}."
136 output_str += "\n"
137
138 if text["Regexes"]:
139 for key, value in text["Regexes"].items():
140 for i in value:
141 description = None
142 matched = i["Matched"]
143 if self._check_if_directory(text_input):
144 output_str += f"[bold #D7Afff]File: {key}[/bold #D7Afff]\n"
145 output_str += (
146 "[bold #D7Afff]Matched on: [/bold #D7Afff]" + i["Matched"]
147 )
148 output_str += (
149 "\n[bold #D7Afff]Name: [/bold #D7Afff]"
150 + i["Regex Pattern"]["Name"]
151 )
152
153 link = None
154 if "URL" in i["Regex Pattern"] and i["Regex Pattern"]["URL"]:
155 link = (
156 "\n[bold #D7Afff]Link: [/bold #D7Afff] "
157 + i["Regex Pattern"]["URL"]
158 + matched.replace(" ", "")
159 )
160
161 if link:
162 output_str += link
163
164 if i["Regex Pattern"]["Description"]:
165 description = (
166 "\n[bold #D7Afff]Description: [/bold #D7Afff]"
167 + i["Regex Pattern"]["Description"]
168 )
169
170 if description:
171 output_str += description
172
173 if (
174 "Exploit" in i["Regex Pattern"]
175 and i["Regex Pattern"]["Exploit"]
176 ):
177 output_str += (
178 "\n[bold #D7Afff]Exploit: [/bold #D7Afff]"
179 + i["Regex Pattern"]["Exploit"]
180 )
181
182 if print_tags:
183 output_str += f"\n[bold #D7Afff]Tags: [/bold #D7Afff]{', '.join(i['Regex Pattern']['Tags'])}"
184

Callers 1

mainFunction · 0.95

Calls 1

_check_if_directoryMethod · 0.95

Tested by

no test coverage detected