← Quiz: Command Injection and Path Traversal: all 10 questions
Quiz: Command Injection and Path Traversal · Question 3 of 10
What does this print? (code)
What does this print?
cmd = ["ping", "-c", "1", "1.1.1.1 && whoami"]
print(len(cmd), cmd[-1])
- A.6 whoami
- B.4 1.1.1.1 && whoami
- C.5 &&
- D.4 1.1.1.1
Answer & explanation
Correct answer: 4 1.1.1.1 && whoami
The user's whole text is one list item, so ping receives it as one strange host name.
Can you get the rest right without peeking?
Take the timed Quiz: Command Injection and Path Traversal quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →