nerdexam
EC-Council

312-50V10 · 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 correct g++ command to compile a C++ source file and name the output binary uses the -o flag followed by the desired output filename.

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

(27 responses)
  • A
    93% (25)
  • B
    4% (1)
  • D
    4% (1)

Why each option

The correct g++ command to compile a C++ source file and name the output binary uses the -o flag followed by the desired output filename.

Ag++ hackersExploit.cpp -o calc.exeCorrect

The GNU C++ compiler (g++) compiles C++ source files (.cpp) using the syntax 'g++ <source_file> -o <output_file>'. The -o flag specifies the output file name, so 'g++ hackersExploit.cpp -o calc.exe' correctly compiles the C++ source and names the resulting binary calc.exe.

Bg++ hackersExploit.py -o calc.exe

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

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

The .pl extension indicates a Perl script, not C++, and -i is not a valid g++ input flag.

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

The flag '--compile' does not exist in g++; the correct flag for compile-only (without linking) would be -c, and even then it would not produce a final executable named calc.exe.

Concept tested: GNU g++ compiler command syntax and flags

Source: https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html

Topics

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

Community Discussion

No community discussion yet for this question.

Full 312-50V10 Practice