# Path: sibyl/heuristics/func.py
# class FuncHeuristic(Heuristic):
#     """Provide heuristic for function start address detection"""
# 
#     # Enabled passes
#     heuristics = [
#         named_symbols,
#         pattern_matching,
#         recursive_call,
#         ida_funcs,
#         ghidra_funcs,
#     ]
# 
#     def __init__(self, cont, machine, filename):
#         """
#         @cont: miasm2's Container instance
#         @machine: miasm2's Machine instance
#         @filename: target's filename
#         """
#         super(FuncHeuristic, self).__init__()
#         self.cont = cont
#         self.machine = machine
#         self.filename = filename
# 
#     def do_votes(self):
#         """Call recursive_call at the end"""
#         do_recursive = False
#         if recursive_call in self.heuristics:
#             do_recursive = True
#             self.heuristics.remove(recursive_call)
# 
#         super(FuncHeuristic, self).do_votes()
#         addresses = self._votes
# 
#         if do_recursive:
#             new_addresses = recursive_call(self,
#                                            [addr
#                                             for addr, vote in addresses.iteritems()
#                                             if vote > 0])
#             for addr, vote in new_addresses.iteritems():
#                 addresses[addr] = addresses.get(addr, 0) + vote
#         self._votes = addresses
# 
#     def guess(self):
#         for address, value in self.votes.iteritems():
#             # Heuristic may vote negatively
#             if value > 0:
#                 yield address


import os
import re
import subprocess
from argparse import ArgumentParser
from utils.log import log_error, log_success, log_info
from elfesteem.elf_init import ELF
from sibyl.heuristics.func import FuncHeuristic
#!/usr/bin/python


match_C = re.compile("\w+[ \*]+(\w+)\(.*\)")
custom_tag = "my_"
whitelist_funcs = ["main"]



# Path: sibyl/heuristics/func.py
# class FuncHeuristic(Heuristic):
#     """Provide heuristic for function start address detection"""
# 
#     # Enabled passes
#     heuristics = [
#         named_symbols,
#         pattern_matching,
#         recursive_call,
#         ida_funcs,
#         ghidra_funcs,
#     ]
# 
#     def __init__(self, cont, machine, filename):
#         """
#         @cont: miasm2's Container instance
#         @machine: miasm2's Machine instance
#         @filename: target's filename
#         """
#         super(FuncHeuristic, self).__init__()
#         self.cont = cont
#         self.machine = machine
#         self.filename = filename
# 
#     def do_votes(self):
#         """Call recursive_call at the end"""
#         do_recursive = False
#         if recursive_call in self.heuristics:
#             do_recursive = True
#             self.heuristics.remove(recursive_call)
# 
#         super(FuncHeuristic, self).do_votes()
#         addresses = self._votes
# 
#         if do_recursive:
#             new_addresses = recursive_call(self,
#                                            [addr
#                                             for addr, vote in addresses.iteritems()
#                                             if vote > 0])
#             for addr, vote in new_addresses.iteritems():
#                 addresses[addr] = addresses.get(addr, 0) + vote
#         self._votes = addresses
# 
#     def guess(self):
#         for address, value in self.votes.iteritems():
#             # Heuristic may vote negatively
#             if value > 0:
#                 yield address


# Path: test/find/run_ctests.py
import os
import re
import subprocess
from argparse import ArgumentParser
from utils.log import log_error, log_success, log_info
from elfesteem.elf_init import ELF
from sibyl.heuristics.func import FuncHeuristic

#!/usr/bin/python


match_C = re.compile("\w+[ \*]+(\w+)\(.*\)")
custom_tag = "my_"
whitelist_funcs = ["main"]



def get_funcs_exe_source(c_file, filename):