312-50V11 · Question #301
An engineer is learning to write exploits in C++ and is using the exploit tool Backtrack. The engineer wants to compile the newest C++ exploit and name it calc.exe. Which command would the engineer us
The correct answer is A. g++ hackersExploit.cpp -o calc.exe. The g++ compiler is used to compile C++ source files using the -o flag to specify the output binary name.
Question
An engineer is learning to write exploits in C++ and is using the exploit tool Backtrack. The engineer wants to compile the newest C++ exploit and name it calc.exe. Which command would the engineer use to accomplish this?
Options
- Ag++ hackersExploit.cpp -o calc.exe
- Bg++ hackersExploit.py -o calc.exe
- Cg++ -i hackersExploit.pl -o calc.exe
- Dg++ --compile hackersExploit.cpp -o calc.exe
How the community answered
(33 responses)- A91% (30)
- B6% (2)
- C3% (1)
Why each option
The g++ compiler is used to compile C++ source files using the -o flag to specify the output binary name.
The g++ command compiles C++ source files with the .cpp extension. The syntax 'g++ hackersExploit.cpp -o calc.exe' correctly identifies the C++ source file and uses the standard -o flag to designate the output executable name, which is the correct invocation for compiling and naming a binary with g++.
The .py extension identifies a Python script, not a C++ file, so g++ cannot compile it.
The -i flag is not a valid g++ compilation flag, and .pl identifies a Perl script which g++ is not designed to compile.
The --compile switch does not exist in g++; standard compilation simply requires the source file and the -o flag to name the output.
Concept tested: Compiling C++ source files with g++
Source: https://gcc.gnu.org/onlinedocs/gcc/Invoking-G_002b_002b.html
Topics
Community Discussion
No community discussion yet for this question.