nerdexam
EC-Council

312-50V13 · Question #360

#!/usr/bin/python import socket buffer=[""A""] counter=50 while len(buffer)<=100: buffer.append (""A""*counter) counter=counter+50 commands= [""HELP"",""STATS ."",""RTIME ."",""LTIME. "",""SRUN…

The correct answer is B. Buffer Overflow. The provided Python code repeatedly sends increasingly large strings to a network service, a characteristic technique used to exploit or discover buffer overflow vulnerabilities.

Submitted by saadiq_pk· Mar 6, 2026System Hacking

Question

#!/usr/bin/python import socket buffer=[""A""] counter=50 while len(buffer)<=100: buffer.append (""A""*counter) counter=counter+50 commands= [""HELP"",""STATS ."",""RTIME ."",""LTIME. "",""SRUN ."',""TRUN ."",""GMON ."",""GDOG ."",""KSTET .",""GTER ."",""HTER ."", ""LTER .",""KSTAN .""] for command in commands: for buffstring in buffer: print ""Exploiting"" +command +"":""+str(len(buffstring)) s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((`127.0.0.1', 9999)) s.recv(50) s.send(command+buffstring) s.close() What is the code written for?

Options

  • ADenial-of-service (DOS)
  • BBuffer Overflow
  • CBruteforce
  • DEncryption

How the community answered

(38 responses)
  • A
    5% (2)
  • B
    74% (28)
  • C
    13% (5)
  • D
    8% (3)

Why each option

The provided Python code repeatedly sends increasingly large strings to a network service, a characteristic technique used to exploit or discover buffer overflow vulnerabilities.

ADenial-of-service (DOS)

While a buffer overflow can lead to a denial-of-service, the primary intent of sending overflowing data to observe program behavior or crash it is to exploit a buffer overflow, not just to deny service in the general sense of a DoS attack.

BBuffer OverflowCorrect

The script attempts to write data exceeding the expected buffer size by appending increasingly larger strings ('A'*50, 'A'*100, etc.) to commands before sending them to a socket, which is a classic method to test for buffer overflow conditions in a target application.

CBruteforce

Bruteforce attacks involve systematically trying many passwords or keys; this script focuses on sending oversized data, not iterating through possible credentials.

DEncryption

Encryption involves transforming data to secure it; the script sends raw, easily readable 'A' characters, indicating no attempt at encryption.

Concept tested: Buffer overflow exploitation techniques

Source: https://learn.microsoft.com/en-us/windows/win32/secbp/buffer-overruns

Topics

#Buffer overflow#Python scripting#exploit development#fuzzing

Community Discussion

No community discussion yet for this question.

Full 312-50V13 Practice