Skip to content

Server listeners

SMTP Server

Setup a SMTP server with Python.

$ sudo python3 -m smtpd -n -c DebuggingServer 0.0.0.0:25
---------- MESSAGE FOLLOWS ----------
b'Date: Sun, 26 Sep 2021 18:21:06 +0200'
b'To: user@example.com'
b'From: me@example.com'
b'Subject: test Sun, 26 Sep 2021 18:21:06 +0200'
b'Message-Id: <20210926182106.026180@arch.localdomain>'
b'X-Mailer: swaks vDEVRELEASE jetmore.org/john/code/swaks/'
b'X-Peer: 127.0.0.1'
b''
b'This is a test mailing'
b''
------------ END MESSAGE ------------

Command to send the mail :

$ swaks --to user@example.com --from me@example.com --server localhost

HTTP Server

Setup a HTTP server with Python.

$ python3 -m http.server --bind 0.0.0.0 4444
Serving HTTP on 0.0.0.0 port 4444 (http://0.0.0.0:4444/) ...
127.0.0.1 - - [26/Sep/2021 18:24:47] code 404, message File not found
127.0.0.1 - - [26/Sep/2021 18:24:47] "GET /hello HTTP/1.1" 404 -

Command to the the HTTP request :

$ curl localhost:4444/hello
Back to top