Skip to content

DouServer is a simple web server built using Node.js and Express. It provides features such as request tracking, management of blacklisted IPs, DDoS protection, and more. The server is highly customizable with options to specify the port, index file, and other settings. Ideal for personal or learning projects.

License

Notifications You must be signed in to change notification settings

douxxu/DouServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧰 DouServer WebServer

DouServer Webserver is a secure webserver who uses Express.js and commands line to work.

📀 Requirements

To work properly, DouServer requires:

Bases:

Packages:

note: all these packages are on npmjs.org and can be installed with the command npm install xyz (xyz is the package name)

🖥 Installation

To install DouServer, follow these easy steps:

  1. Make sure that you have node js and npm installed on your device
  2. open a terminal
  3. copy and paste this command in the terminal:
curl -sSL https://douxx.xyz/dserver/install.sh | bash

If there is an error, you can install DouServer step by step:

sudo git clone https://github.com/douxxu/DouServer.git
cd DouServer
sudo npm install express morgan yargs colors
sudo chmod +x cmd.js
sudo npm link
  1. DouServer is now installed, you can now run it with
dserver

⚡️ Running DouServer

You can run DouServer using the following command:

dserver

This command will run a basic web server, the default port is the http port (80), and the default index file is the /public/index.html file, you can access it from http://localhost:80.

You can use the differents arguments for editing the web server:

______ _____ _   _ _____ ___________ _   _ ___________ 
|  _  \  _  | | | /  ___|  ___| ___ \ | | |  ___| ___ \
| | | | | | | | | \ `--.| |__ | |_/ / | | | |__ | |_/ /
| | | | | | | | | `--. \  __||    /| | | |  __||    / 
| |/ /\ \_/ / |_| /\__/ / |___| |\ \\ \_/ / |___| |\ \ 
|___/  \___/ \___/\____/\____/\_| \_\___/\____/\_| \_|
----------------------------------------------------------------
| Server created by Douxx.xyz (https://github.com/douxxu/)     |
----------------------------------------------------------------
𝗔𝘃𝗮𝗶𝗹𝗮𝗯𝗹𝗲 𝗼𝗽𝘁𝗶𝗼𝗻𝘀:
| -p, --port [port]: Specifies the server port
| -s, --shield: Activates Shield mode to limit requests
| -bl, --blacklist [ip1 ip2 ...] : List of IP addresses to be blocked
| -t, --start [minutes]: Automatically starts the server after a set time.
| -i, --index [path]: Specify HTML index file path
| -r, --robots: Blocks robots if the option is present
| -h: Shows this help message

𝐄𝐱𝐚𝐦𝐩𝐥𝐞 𝐮𝐬𝐚𝐠𝐞:
----------------------------------------------------------------
| dserver -p 3000 -s -bl 127.0.0.1 -t 1 -i ./public/index.html -r
----------------------------------------------------------------

Options: -p [port]/--port [port]: Specify the server port. Usage: dserver -p 8080: Server will be hosted on http://127.0.0.1:8080.

-s/--shield: If this option is enabled, the server will automatically blacklist all ip's exceeding the allowed request limit every 5 seconds. The default number of requests is 10. This can be changed with the line const rlimit = 10;. Usage: dserver -s: server will activate shield mode.

-bl [ips]/--blacklist [ips]: With this option, you can disable access to the server for given ips. Usage: dserver -bl 192.168.0.0 192.168.0.1 10.0.0.2: Ips '192.168.0.0', '192.168.0.1' and '10.0.0.2' will be blacklisted.

-t [time]/--start [time]: Will set a countdown before the server starts. Usage: dserver --start 1: The server will start after 1 minute.

-i/--index: Will set the default page (/) file to the given file. Usage: dserver -i /path/to/your/file.html: The server default file will be file.html.

-r/--robots: If this option is enabled, the server will remove access to bots. Usage: dserver -r.

note: you can also host images, doing this command:

dserver -i /path/to/your/image.png

📃 Website pages (/)

You can easily create website pages adding a new folder into the public folder and putting an index.extention file into this folder. The page will have the name of folder. Exemple: we can access to the image into the /public/image going to http://127.0.0.1:port/image. Same for the html and txt folder. Here are the default pages:

[SERVER] messages

A log system was implemented to the server. All the [SERVER] messages in the console are server logs. There is all the type of logs:

  1. Launching logs: [SERVER] Server is running at http://127.0.0.1:1111 these logs are giving you the server URL.

  2. Requests logs: [SERVER] [DD/MM/YYYY, hh:mm:ss] - 127.0.0.1 - 1 these logs provide you with the ip of the visitor to your website, as well as the number of times this ip has visited your website in this session. The log is formed as follows: [SERVER] [date, time] - ip adrs. - number of visits by this ip. The visitor's user agent can be found in the server.log file.

  3. Blacklist logs: [SERVER] [DD/MM/YYYY, hh:mm:ss] - BLACKLISTED IP 127.0.0.1 tried to connect. these logs only appear if you have blacklisted one or more ips with the -bl parameter, and one of these ips has tried to access your server. (127.0.0.1 is the blacklisted ip adrs.)

  4. Shield logs: [SERVER] [DD/MM/YYYY, hh:mm:ss] - 127.0.0.1 exceeded requests threshold (3). this log occurs when the -s (--shield) parameter has been activated, and an ip address has exceeded the limit of 3 requests every 5 seconds.

  5. Index file log: [SERVER] Using custom index file: /path/to/your/index/file.html this log confirms that the custom index file you configured with the -index [path] parameter has been used.

💾 Tested devices / os

Devices

Os

LICENSE

MIT license, check the LICENSE file

About

DouServer is a simple web server built using Node.js and Express. It provides features such as request tracking, management of blacklisted IPs, DDoS protection, and more. The server is highly customizable with options to specify the port, index file, and other settings. Ideal for personal or learning projects.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published