Giter VIP home page Giter VIP logo

chatroom's Introduction

ChatRoom

This is an advanced Python-based chat room with secure login. The project is entirely based on the socket programming done using Python. The server is set to the listening mode, with a specific port number (asked at runtime). Client are made to connect to the server, prompted to enter a nickname and password. The messages are then broadcasted to all the connected clients.

First login will register nickname and password on the server.

It is also possible to ensure traffic by wrapping TCP packet into TOR full-encrypted connection, creating hidden service and using torsocks.

Introduction

Sockets

Sockets and the socket API are used to send messages across a network. They provide a form of inter-process communication (IPC). The network can be a logical, local network to the computer, or one that’s physically connected to an external network, with its own connections to other networks. The obvious example is the Internet, which you connect to via your ISP.


Image Credit:Real Python

TCP Socket

In the diagram below, given the sequence of socket API calls and data flow for TCP:

Usage in clearnet

  1. We will have to start our server first.
python3 server.py
  1. Run the client file, to start the conversation.
python3 client.py

3. enter a nickname, password and server address for start your chatting.

Chatting over deep web

  1. Install TOR typing (under Linux):
sudo apt install tor
  1. Create hidden service editing '/etc/tor/torrc' with:
HiddenServiceDir /var/lib/tor/ChatRoom/
HiddenServicePort 8080 127.0.0.1:8080
  1. Restart TOR:
$ systemctl restart tor
  1. Find onion address:
$ cat /var/lib/tor/ChatRoom/hostname
  1. Start server.py entering the port;

binding host = '127.0.0.1' by editing server code, we will receive only tor connections, being able to leave the ports of the firewall and the router closes.

  1. Then start client.py typing:
$ torsocks python3 client.py

and compile entries 'Host' and 'Port' with onion address and port (8080) used before in tor setup.

Example of TOR connection


Server-side:

Client-side:


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.