This is a simple command-line based chat application written in Python. It allows users to connect using netcat and share encrypted & anonymous messages in a terminal environment. This is our playground.
-
Clone this repository to your local machine.
-
Open the
main.pyfile and locate thePORTconstant at the top of the file:
PORT = 8008 # Change this to your desired port- Create a credentials.txt file in the same directory as main.py with the following format:
username1:password1
username2:password2Each line represents a username and password pair.
- Install the necessary dependencies by running the following command:
pip install requests- Run the server by executing the following command in your terminal:
python main.pyOpen a new terminal.
Connect to the server using one of the following methods:
nc <server_public_ip> <port>If you're on Windows, select the raw connection type and fill in the host's IP and port in PuTTY's configuration. Alternatively, run cmd and enter:
putty -raw <server_public_ip> <port>SSH (Secure Shell): Not supported yet.
- Execute the Ctrl+C command.
- Enter clear to clear the terminal.
Each user's messages are prefixed with their username for easy identification. The server broadcasts messages to all connected users. Users cannot connect with the same username more than once. Color-coded messages for better readability. The server shows the number of users upon authentication and updates when users join or leave the chat.