Python › Module 2 › Lesson 5
Quiz — Python Networking
10-question quiz on sockets, HTTP, and responsible scanning
Opening
Python Networking — Module Quiz
You treated TCP connect as “is anyone listening” on a host:port you are allowed to ask, with timeout so a drop fails instead of hanging. You used connect_ex as a 0-or-errno yes/no, distinguished bind (server) from connect (client), and kept HOST at 127.0.0.1. You installed requests on YOUR machine, GET/HEAD to example.com or a local http.server, read 200/301/403/404 and Server/CSP as observation — never login spray, never SQLi. You designed a connect scanner as a small loop whose scope is the control, then ran it on loopback and wrote $HOME/cyberlium-lab/localhost-scan.txt mode 600. These ten APPLY items test that judgment on fictional machines you own. No nmap of café Wi-Fi, ISP gear, school subnets, or random internet hosts. No credential stuffing. No verify=False as a default. Next — Automating Security Tasks — continues Python on chores you are allowed to script.
Knowledge Check
APPLY: socket.SOCK_STREAM + AF_INET, then connect_ex(("127.0.0.1", 1)) with settimeout(1.0) returns non-zero. Mechanism and move?
Multiple choice
Knowledge Check
APPLY: True or False: Skipping s.settimeout makes scanners faster because connect always returns immediately, and bind() is just the client-side spelling of connect().
True or False
Knowledge Check
APPLY: You pip install requests and GET https://example.com with timeout=5. Status 200, Server header present. A classmate wants to POST rockyou.txt at the campus login. Correct pair?
Multiple choice
Knowledge Check
APPLY: Match the status code to the defender reading (not an attack plan). 200, 301, 403, 404 — which statement is correct?
Multiple choice
Knowledge Check
APPLY: Select the responsible pair for a beginner connect scanner. (Select 2)
Select all that apply
Knowledge Check
APPLY: connect_ex == 0 on 127.0.0.1:8000 after you started python -m http.server 8000 on THIS machine. What did OPEN prove?
Multiple choice
Knowledge Check
APPLY: True or False: verify=False is the safe default for production HTTPS monitoring, and HEAD is how you download the body faster so you can stuff a login.
True or False
Knowledge Check
APPLY: r.headers.get("server") and r.headers.get("content-security-policy") on example.com (or YOUR site). Defensive use?
Multiple choice
Knowledge Check
APPLY: Lab file $HOME/cyberlium-lab/localhost-scan.txt should contain which set, and which mode?
Multiple choice
Knowledge Check
APPLY: After this module, which next lesson starts scripting repetitive allowed chores (logs, generators, glue) — not a bigger unauthorized scan?
Multiple choice
Answer all 10 knowledge checks to continue. (0/10 answered)