get an error : "TypeError: list indices must be integers, not str" in python when run in linux
im using this code but it doesnt work.. content of filepath
available here peid.yara
filepath=("https://github.com/urwithajit9/ClaMP/blob/master/scripts/peid.yara") def check_packer(self,filepath): result=[] matches = self.rules.match(filepath) if matches == {}: result.append([0,"NoPacker"]) else: result.append([1,matches['main'][0]['rule']]) return result def main(): source_path= raw_input("Enter the path of samples (ending with /) >> ") output_file= raw_input("Give file name of output file. (.csv) >>") label = raw_input("Enter type of sample( malware(1)|benign(0))>>")
when i run the program i get an error
osboxes@osboxes:~/honeymalware/scripts$ python integrated_features_extraction.py Traceback (most recent call last): File "integrated_features_extraction.py", line 375, in <module> main() File "integrated_features_extraction.py", line 372, in main features.create_dataset() File "integrated_features_extraction.py", line 356, in create_dataset data = self.extract_all(filepath) File "integrated_features_extraction.py", line 330, in extract_all packer = self.check_packer(filepath) File "integrated_features_extraction.py", line 239, in check_packer result.append([1,matches['main'][0]['rule']]) TypeError: list indices must be integers, not str
is there something wrong with this syntax result.append([1,matches['main'][0]['rule']])
?