import pandas as pd def get_img_api(hash, data_path): df = pd.read_csv(data_path) row = df[df['SHA256'] == hash] if row.empty: return None, None # Extract the image path img_path = 'src/data/Images/' + row['SHA256'].values[0] + '.jpg' # Extract the API calls api_columns = df.columns[2:] # Skip the first two columns (SHA256 and Type) api_calls = row[api_columns].values.flatten().tolist() # Filter out only the API calls that are present (value == 1) api_call_list = [[api for api, value in zip(api_columns, api_calls) if value == 1]] return img_path, api_call_list # hash_value = '002ce0d28ec990aadbbc89df457189de37d8adaadc9c084b78eb7be9a9820c81' # img_path, api_call_list = get_img_api(hash_value) # print("Image Path:", img_path) # print("API Call List:", api_call_list)