nerdexam
EC-Council

312-50V9 · Question #74

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…

The correct answer is A. g++ hackersExploit.cpp -o calc.exe. The g++ compiler requires a valid C++ source file (.cpp extension) and the -o flag to compile and name the output executable.

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

How the community answered

(16 responses)
  • A
    94% (15)
  • B
    6% (1)

Why each option

The g++ compiler requires a valid C++ source file (.cpp extension) and the -o flag to compile and name the output executable.

Ag++ hackersExploit.cpp -o calc.exeCorrect

The command 'g++ hackersExploit.cpp -o calc.exe' uses correct GNU C++ compiler syntax: g++ is the C++ compiler driver, hackersExploit.cpp carries the valid C++ source file extension, and '-o calc.exe' specifies the output binary filename. This is the standard invocation for compiling a single C++ source file into a named executable on any platform.

Bg++ hackersExploit.py -o calc.exe

A .py file extension denotes a Python script, not C++ source code; g++ is a C++ compiler and cannot compile Python files.

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

A .pl file extension denotes a Perl script, not C++ source code, and '-i' is not a valid g++ flag for specifying an input file.

Concept tested: g++ C++ compiler command syntax and output flag

Source: https://gcc.gnu.org/onlinedocs/gcc/Invoking-GXX.html

Topics

#g++ compiler#exploit development#C++#Backtrack

Community Discussion

No community discussion yet for this question.

Full 312-50V9 Practice