Creation d'un serveur web rapide


Différents moyen de lancer un serveur FTP ou HTTP rapidement

Updog

https://www.hackerunder.dev/whats-updog/

Liste de commande multi language.

https://gist.github.com/willurd/5720255


Serveur HTTP

python -m SimpleHTTPServer 80

ou

python3 -m http.server 9000

ou

import http.server
 
PORT = 80
server_address = ("", PORT)

server = http.server.HTTPServer
handler = http.server.CGIHTTPRequestHandler
handler.cgi_directories = ["/"]
print("Serveur actif sur le port :", PORT)

httpd = server(server_address, handler)
httpd.serve_forever()

Serveur FTP

apt install python3
apt install python3-pip
pip3 install pyftpdlib

Veuillez vous placer dans le répertoire que vous souhaitez, car la commande transformera le répertoire en répertoire racine et fournira un accès anonyme. Le port par défaut est 2121

python -m pyftpdlib

Vous pouvez utiliser ftp:// :2121 pour accéder à votre serveur ftp via votre navigateur ou le tester à partir de la ligne de commande comme indiqué ci-dessous :

root@ubuntu18-test1:~# ftp localhost 2121
Connected to localhost.
220 pyftpdlib 1.5.6 ready.
Name (localhost:jon_netsec): anonymous
331 Username ok, send password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 Active data connection established.
125 Data connection already open. Transfer starting.
-rw-------   1 root     root           75 Jan 02 17:42 .bash_history
-rw-r--r--   1 root     root         3106 Apr 09  2018 .bashrc
drwx------   3 root     root         4096 Apr 23 01:36 .cache
-rw-r--r--   1 root     root          148 Aug 17  2015 .profile
drwx------   2 root     root         4096 Dec 12 20:10 .ssh
drwxr-xr-x   3 root     root         4096 Jan 02 17:36 snap
226 Transfer complete.
ftp> q
?Ambiguous command
ftp> quit
221 Goodbye.

Pour utiliser une authentification

python -m pyftpdlib -u ftpuser1 -P password1234

Sources

http://blog.51sec.org/2021/05/one-python-command-to-start-ftp-or-http.html