MCPcopy Create free account
hub / github.com/Integuru-AI/Integuru / aggregate_functions

Function aggregate_functions

integuru/util/print.py:268–314  ·  view source on GitHub ↗
(txt_path, output_path)

Source from the content-addressed store, hash-verified

266 return code
267
268def aggregate_functions(txt_path, output_path):
269 # Read the content of the file
270 with open(txt_path, 'r') as file:
271 content = file.read()
272
273 # Initialize ChatGPT
274
275 # Prepare the prompt for ChatGPT
276 prompt = f"""
277 The following text contains multiple Python functions:
278
279 {content}
280
281 Please generate Python code that does the following:
282 1. Fix up the functions if needed in the order they appear in the text.
283 2. Leave everything that is hardcoded as is.
284 3. Call each function in the order they appear in the text.
285 4. The cookies will be hard coded in the file in a string format of key=value;key=value. You will need to convert them to a dict to retrieve values from them.
286 5. Pass the return value of each function as an argument to the next function, if applicable.
287 6. Ensure that the last function in the text is called last.
288 7. Output the entire directly runnable code
289
290
291
292 Only provide the Python code, without any explanations or markdown formatting.
293 DO NOT include any backticks or markdown syntax AT ALL
294 """
295
296 # Get the response from ChatGPT
297
298 llm_model = llm.switch_to_alternate_model()
299 try:
300 response = llm_model.invoke(prompt)
301 except Exception as e:
302 print("Switching to default model")
303 llm.revert_to_default_model()
304 response = llm.switch_to_alternate_model().invoke(prompt)
305 # Extract the generated code
306 generated_code = response.content.strip()
307
308 # Save the generated code to the specified output file
309 with open(output_path, 'w') as file:
310 file.write(generated_code)
311
312 print(f"Aggregated function calls have been saved to '{output_path}'")
313
314 return output_path
315
316def generate_obfuscation_map(dynamic_parts_list: List[str]) -> Dict[str, str]:
317 obfuscation_map = {}

Callers 1

print_dag_in_reverseFunction · 0.85

Calls 2

Tested by

no test coverage detected