nerdexam
EC-Council

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.

System Hacking

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)
  • A
    91% (30)
  • B
    6% (2)
  • C
    3% (1)

Why each option

The g++ compiler is used to compile C++ source files using the -o flag to specify the output binary name.

Ag++ hackersExploit.cpp -o calc.exeCorrect

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++.

Bg++ hackersExploit.py -o calc.exe

The .py extension identifies a Python script, not a C++ file, so g++ cannot compile it.

Cg++ -i hackersExploit.pl -o calc.exe

The -i flag is not a valid g++ compilation flag, and .pl identifies a Perl script which g++ is not designed to compile.

Dg++ --compile hackersExploit.cpp -o calc.exe

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

#exploit compilation#g++ compiler#C++ exploits#Backtrack

Community Discussion

No community discussion yet for this question.

Full 312-50V11 Practice