Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Suppose you have written the following piece of code:# test _ eval.pyimport sysimport osdef run _ code ( string ) : Evaluate
Suppose you have written the following piece of code:# testeval.pyimport sysimport osdef runcodestring: Evaluate the passed string as code try:evalstringexcept Exception as e:printrepreif namemain:runcodesysargvConsider a scenario where an attacker is trying to exploit this piece of code to find out the contents of a directory where an application is running. The attacker tries to list the contents of the current folder using the following code:$ python testeval.py ossystemls aThe given code results in an error. Why did the error occur?Each correct answer represents a part of the solution. Choose two.This type of question contains radio buttons and checkboxes for selection of options. Use Tab for navigation and Enter or space to select the option.Aoption ABecause the second argument is passed as an empty dictionaryBoption BBecause Python is unable to resolve the os nameCoption CBecause eval is safeDoption DBecause the code is incomplete
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started