P2P-Chat is a python based peer-to-peer chat client with a command line interface.
As this project was only for demonstation purposes as part of my paper on p2p, I will no longer work on p2p-chat.
You may fork this repository to work on it yourself.
A regular client/server based chat:
/<----\ /<----\
Client A Server Client B
\---->/ \---->/
A peer-to-peer based chat:
/<----\
Client A Client B
\---->/
As you can see, there is no third-party server involved when using peer-to-peer. All the messages you send and receive are private. They're only seen by your client and the client you are connected to.
WARNING:
Nothing this client sends or receives is encrypted. Do only use it when connected to a private network.
To install P2P-Chat simply download this repo.
git clone https://github.com/F1xw/p2p-chat
cd ./p2p-chat
P2P-Chat uses several python module. Make sure the package manager pip is installed, so that p2p-chat can automatically install all required modules.
npyscreen uses the curses library which might not be pre-installed on windows. Download the corresponding version for your installation from here and install it with pip.
Run /run.py to start the client.
python run.py
You will be greeted with a slick, nostalgic CLI.
Try resizing your terminal if the app chrashes instantly.
To use p2p-chat follow these steps:
You are now able to send messages to the connected peer by typing them in and pressing enter. Take a look at all the other commands down below.
P2P-Chat uses commands to setup and connect. Try /help to get a list of all available commands.
Use /connect [host] [port] to connect to a peer. The client will try to connect for 5 seconds. You will have to set your nickname before connecting using /nick
Example:
/connect office-pc.local 3333
Use /disconnect to close the current connection.
Example:
/disconnect
Use /nick [nickname] to set your nickname. Updating your nickname while a connection is active will send your new name to the connected peer.
Example:
/nick flowei
Use /quit to quit the app.
Example:
/quit
Use /port to change the port your server runs on.
Example:
/port 3456
Use /connectback to connect to a peer without having to enter their hostname and port. This command is only available if your server receives a connection while your client is not connected.
Example:
/connectback
Use /clear to clear the chat.
Example:
/clear
Use /eval [python code] to execute python code within the app itself. The output will be relayed to the chat feed.
Example:
# Print the nickname of the connected peer
/eval print(self.peer)
# Generate a system message
/eval self.sysMsg("Hello from /eval!")
# Forcefully exit the app
/eval exit()
Use /status to get the current status of server and client.
Example:
/status
Use /log to log all messages sent and received during your session to a file.
Example:
/log
Use /help to get a list of all available commands.
Example:
/help