Here in 2016 we have tons and tons of chat application with various features. They have millions of users and giant servers at very high speed but still why hackers and geeks are running behind encrypted communication like torchat? because privacy. Even though you are using an encrypted and secured application, keep in mind still they work on a third party server you cannot trust them blindly. They can be broken any time. If you are really concerned about privacy, here i have developed a simple application NEURON in python.

Neuron server can be setup on your linux machine and have full controll over it. Neuron python sockets to send message with AES encryption. It has two scripts basically one as server and other as client. Set up server on any machine so that your firends with the script neuron.py can connect to your server remotely with the correct password. No one can invade your privacy, if you find any malicious activity you can simply shut down the server. You can see the connections on the server console and even live chat if you changed the view mode. This is safe application because messages are encrypted in AES algorithm which cannot be cracked without the right key. If an eavesdropper tries to sneak in with a wrong password and if we send a message his script decrypt it with a different key i.e. even if he got the messages in this format he cannot decrypt to raw strings.

This server don’t have any special hardware requirements this can be run on any linux machine and can be user on both LAN and WAN network. Neuron is available on github, follow the steps for complete tutorial. check out the video too so that it will give you an idea.NOTE: forward the port on router for remote connections over internet.

Demo video

 

Download neuron

clone to github
# git clone https://github.com/susmithHCK/neuron.git

 

Setup server

Now open the folder so that you can find two main python script and a config file. Config file is for server script, you can tweak it. Open the file with any text editor change the HOST to your internal IP if you are using it on lan network. Change HOST to your public ip if you are using it on WAN network. PORT can be any unused port. Option PASSWORD can be any desired password. change view mode to 1 if you want live feed of chat on the server console. Save and close the file and right click open terminal on that directory.

# python server.py

 

 

neuron.py usage

Once the server is setup only thing you need is neuron.py . Anyone with your host details and correct password can connect to your server and create a group chat. Open the terminal in the directory and use the command below.
# python neuron.py “host_ip” “port” “password” “nick_name”

all your friends can connect from the internet with this simple piece of script.

Any doubts or questions? post it on the comment section below. If you like this blog give me a like on facebook and add me on google plus. Subscribe my youtube channel for video tutorials.

 


Susmith Krishnan

I’m a computer enthusiast basically and i love to write blogs on tech issues and cyber security. I started penetration testing at the age of 16 and i would like to explore security vulnerabilities and latest tech news and wanna share with you

41 Comments

1Ztw.Cn · July 14, 2016 at 4:36 am

Wonderful goods from you, man. I have understand
your stuff previous to and you are just too excellent.

I really like what you have acquired here, really like what you’re saying and the way in which you say it.
You make it enjoyable and you still care for to keep it wise.
I cant wait to read far more from you. This is actually a terrific web site.

best pillows to buy · July 15, 2016 at 11:01 am

Fine wayy of telling,and pleasant paragraph to obyain information about my presentatikn subject matter, which i
am going to deliver in academy.

schools in the united states · July 16, 2016 at 3:15 am

It is not my first time to pay a quick visit this website, i am
visiting this website dailly and get fastidious facts from
here all the time.

Robin · July 16, 2016 at 9:57 pm

Have you ever considered writing an e-book or guest authoring on other sites?

I have a blog centered on the same topics you discuss and would love to have
you share some stories/information. I know my visitors would appreciate your work.
If you’re even remotely interested, feel free to
send me an email.

iphone Phone insurance · July 19, 2016 at 12:59 am

Very shortly this web page will be famous amid all blog
users, due to it’s good posts

    susmith HCK · July 19, 2016 at 9:11 pm

    Thanks for your kind words, Keep supporting. Keep sharing

consultant psychiatrist · July 19, 2016 at 8:55 am

Hi there mates, its great article on the topic of educationand completely explained, keep it up all
the time.

Bernie · July 19, 2016 at 9:02 am

Great article, exactly what I needed.

Elva · July 19, 2016 at 2:34 pm

It is appropriate time to make a few plans for the long run and it is time
to be happy. I’ve learn this publish and if I could I want
to counsel you few fascinating things or tips. Perhaps you could write next articles regarding this article.
I want to learn even more things approximately it!

Barney · July 19, 2016 at 4:20 pm

When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time
a comment is added I get three e-mails with the same comment.
Is there any way you can remove people from that service?

Many thanks!

    susmith HCK · July 19, 2016 at 9:16 pm

    Im trying to fix the bugs. Thanks for reporting. if still the problem persist pls let me know.

psychiatric evaluation · July 19, 2016 at 4:28 pm

Greetings! Very useful advice within this post!

It is the little changes that make the most important changes.
Many thanks for sharing!

problems in the american education system · July 19, 2016 at 10:40 pm

Appreciate the recommendation. Will try it out.

http://Aidedc.Cn · July 20, 2016 at 2:34 am

Cool blog! Is your theme custom made or did you download it
from somewhere? A design like yours with a few simple adjustements
would really make my blog shine. Please let me know where you got your theme.
Many thanks

    susmith HCK · July 20, 2016 at 7:44 pm

    This is the free version of the theme “colormag”. I have tweaked it a little bit with some css thats all.

ipad and iphone insurance · July 20, 2016 at 10:24 am

Hello! I just would like to offer you a huge thumbs up for
your great information you have got here on this post. I’ll be coming back to your site for more soon.

Beverly · July 20, 2016 at 11:16 am

I really like it when people get together and share ideas.

Great website, stick with it!

Finlay · July 20, 2016 at 2:09 pm

Hello there! Nice post! Please keep us posted!

psychiatric help · July 20, 2016 at 2:31 pm

Fantastic blog you have here but I was curious about if you
knew of any message boards that cover the same topics discussed in this article?
I’d really love to be a part of community where I can get comments
from other knowledgeable people that share the same interest.
If you have any recommendations, please let
me know. Appreciate it!

Drew · July 20, 2016 at 2:34 pm

It’s nearly impossible to find experienced people on this
topic, but you sound like you know what you’re talking about!
Thanks

us.alamstore.com · July 20, 2016 at 3:39 pm

Hi! I simply want to offer you a huge thumbs up for your
excellent info you have got right here on this post. I will be returning to your blog for more soon.

Vince · July 20, 2016 at 4:33 pm

Pretty great post. I simply stumbled upon your weblog and wished to mention that I have really enjoyed
browsing your blog posts. After all I will be
subscribing for your rss feed and I’m hoping you write once
more soon!

Greg · July 20, 2016 at 4:48 pm

Howdy! I simply want to give you a big thumbs
up for the great info you have got right here on this post.
I’ll be coming back to your blog for more soon.

hotel-restaurant-odendahl.de · July 20, 2016 at 5:23 pm

This page certainly has all of the info I wanted
about this subject and didn’t know who to ask.

TheBlaCkCoDeR · September 10, 2016 at 6:20 am

But the host ip of clients are visible and can be monitored… if you can add a network cryptography module…

    susmith HCK · September 10, 2016 at 7:00 pm

    U mean hiding client ip ? IP is the basic protocol, we cannot simply encrypt and communicate. However we can use tor . That would be better idea. I will think about it.. 😀 if u are coder u can modify the code and commit on github .

Arch!m3de · November 16, 2016 at 5:19 am

Hi, I have a little problem. I configure the neuron.conf to use neuron over the internet. So, i put my public ip. But, when i launch python server.py i get the error:
socket.error: [Errno 99] Cannot assign requested address

Can you explain, if it’s possible, how to fix it ? 🙂

Thx

    susmith HCK · November 16, 2016 at 5:30 pm

    you cannot assign public ip in the server, but you can use internal ip and then forward the port in router. Just enter the external ip in the client. you can connect remotely.

CyberEnginner · April 15, 2017 at 4:16 am

Hello there sir! great article as always 🙂
But i have a question if you don’t mind ! i want to know how to host this kind of project in a external server so it could stay always online.

I’ve read the previews comment and i understood you answer, but if i host the server on one of my devices that device must be always turned on in order to keep the server always online !!! and i’m afraid that this is impossible because i can’t keep my laptop 24/7 on.

So i’m looking for something that like VPS or Python Server like PythonAnyWhere.com or any host that can run the nueron server and be online 24/7 just like websites do.

I really hope that you respond sir as soon as possible because i’m really exited about it, besides your respond will open a new door of future opportunities in the hosting field…and thank you in advance 🙂

    susmith HCK · April 17, 2017 at 7:14 pm

    Buy some cheap server online or setup a raspberry pi and configure your custom DDNS.

john · August 17, 2017 at 6:18 pm

hello sir..it was a great program..
but if you make a tutorial for explaining how the code work, that will be fantastic

sahiltikoo · October 2, 2017 at 6:46 am

hey buddy i am having some problem with the aes encrypted chat i developed could you please look at it , https://github.com/viperbluff/EncRyPto_Chat , basically when the message is broadcasted that any user has joined the chatroom an error pops up that input string must be multiple of 16 . I am from india and nobody know anything about python scripting in my college , please help!!

B4D51573M · January 26, 2018 at 7:55 am

Traceback (most recent call last):
File “server.py”, line 126, in
sys.exit(chat_server())
File “server.py”, line 69, in chat_server
server_socket.bind((HOST, PORT))
File “/usr/lib/python2.7/socket.py”, line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 99] Cannot assign requested address
How I fix this?

chris · February 9, 2018 at 9:45 am

Hey lads! i followed this great tutorial but i ran into small problems,the coding didn’t work on my windows op i changed couple things to make it run but when i connected to my chat i couldn’t type, non of my keys on keyboard worked could you guys help me out please>? 🙂

# neuron_client

import base64
import sys, socket, select
from Crypto.Cipher import AES
import os
import hashlib
import signal

os.system(“cls”)
print “””
___ ___ __ _________ ___
/ _ \/ -_) // / __/ _ \/ _ \
/_//_/\__/\_,_/_/ \___/_//_/
messenger v 1.2 | susmithHCK

“””

def sigint_handler(signum, frame):
print ‘\n user interrupt ! shutting down’
print “[info] shutting down NEURON \n\n”
sys.exit()

signal.signal(signal.SIGINT, sigint_handler)

def hasher(key):
hash_object = hashlib.sha512(key)
hexd = hash_object.hexdigest()
hash_object = hashlib.md5(hexd)
hex_dig = hash_object.hexdigest()
return hex_dig

def encrypt(secret,data):
BLOCK_SIZE = 32
PADDING = ‘{‘
pad = lambda s: s + (BLOCK_SIZE – len(s) % BLOCK_SIZE) * PADDING
EncodeAES = lambda c, s: base64.b64encode(c.encrypt(pad(s)))
cipher = AES.new(secret)
encoded = EncodeAES(cipher, data)
return encoded

def decrypt(secret,data):
BLOCK_SIZE = 32
PADDING = ‘{‘
pad = lambda s: s + (BLOCK_SIZE – len(s) % BLOCK_SIZE) * PADDING
DecodeAES = lambda c, e: c.decrypt(base64.b64decode(e)).rstrip(PADDING)
cipher = AES.new(secret)
decoded = DecodeAES(cipher, data)
return decoded

def chat_client():
if(len(sys.argv) < 5) :
print 'Usage : python neuron.py ‘
sys.exit()

host = sys.argv[1]
port = int(sys.argv[2])
key = sys.argv[3]
key = hasher(key)
uname = sys.argv[4]

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(2)

try :
s.connect((host, port))

except :
print “\033[91m”+’Unable to connect’+”\033[0m”
sys.exit()

print “Connected to remote host. You can start sending messages”
sys.stdout.write(“\033[34m”+’\n[Me :] ‘+ “\033[0m”); sys.stdout.flush()

while 1:
socket_list = [socket.socket(), s]
read_sockets, write_sockets, error_sockets = select.select(socket_list , [], [])

for sock in read_sockets:
if sock == s:

data = sock.recv(4096)

if not data :
print “\033[91m”+”\nDisconnected from chat server”+”\033[0m”
sys.exit()
else :
data = decrypt(key,data)
sys.stdout.write(data)
sys.stdout.write(“\033[34m”+’\n[Me :] ‘+ “\033[0m”); sys.stdout.flush()

else :

msg = socket.socket().readline()
msg = ‘[ ‘+ uname +’: ] ‘+msg
msg = encrypt(key,msg)
s.send(msg)
sys.stdout.write(“\033[34m”+’\n[Me :] ‘+ “\033[0m”); sys.stdout.flush()

if __name__ == “__main__”:

sys.exit(chat_client())

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.