eliasgranderubio / dagda

a tool to perform static analysis of known vulnerabilities, trojans, viruses, malware & other malicious threats in docker images/containers and to monitor the docker daemon and running docker containers for detecting anomalous activities
Apache License 2.0
1.15k stars 160 forks source link

Unknown Error Arises #58

Closed oldlurefinder closed 5 years ago

oldlurefinder commented 5 years ago

Short description

I was trying to analyze a static image by using "Python3 dagda.py check -i . I did get the accepted for analysis message. When I issue the history command it does return an analyzing message, but the server shows an error, forcing it to hang.

On which platforms did you notice this:

Please complete the following information:

Backtrace

Serving on http://localhost:5000 <2019-04-11 05:43:51,022> <'unknown'> Traceback (most recent call last): File "dagda.py", line 35, in main r = execute_dagda_cmd(cmd=cmd, args=parsed_args) File "/home/user/Desktop/Fresh/dagda/dagda/cli/dagda_cli.py", line 43, in execute_dagda_cmd ds.run() File "/home/user/Desktop/Fresh/dagda/dagda/api/dagda_server.py", line 81, in run self._check_docker_by_image_name(item) File "/home/user/Desktop/Fresh/dagda/dagda/api/dagda_server.py", line 166, in _check_docker_by_image_name evaluated_docker_image = analyzer.evaluate_image(item['image_name'], None) File "/home/user/Desktop/Fresh/dagda/dagda/analysis/analyzer.py", line 120, in evaluate_image data['static_analysis'] = self.generate_static_analysis(image_name, os_packages, dependencies, malware_binaries) File "/home/user/Desktop/Fresh/dagda/dagda/analysis/analyzer.py", line 135, in generate_static_analysis data['prog_lang_dependencies'] = self.generate_dependencies_report(image_name, dependencies) File "/home/user/Desktop/Fresh/dagda/dagda/analysis/analyzer.py", line 161, in generate_dependencies_report dep_details[splitted_dep[0]].append(d) KeyError: 'unknown'

oldlurefinder commented 5 years ago

I looked at analyzer.py in Visual Studio Code today and realized the system did not like the dict() object to be one letter. It kept braking on the append(d) which is on line 161. Looking at the entire section 151-161, there are 13 single d entries. Pylint gave me an error that they were not snake-like. So I changed them all to depe. Stopped the dagda server, restarted it, submitted a different image for analysis. Upon the history command, everything worked!!!!!