Header Banner
Null Byte Logo
Null Byte
wonderhowto.mark.png
Cyber Weapons Lab Forum Metasploit Basics Facebook Hacks Password Cracking Top Wi-Fi Adapters Wi-Fi Hacking Linux Basics Mr. Robot Hacks Hack Like a Pro Forensics Recon Social Engineering Networking Basics Antivirus Evasion Spy Tactics MitM Advice from a Hacker

How to Make a Multi-User Chat Program for Hackers

"How to Make a Multi-User Chat Program for Hackers" cover image

Have you ever felt alone in the place and felt like there are no hackers amongst you? Do you go to Star Bucks and feel like "If there was someone here with me hacking all these people like Aiden Pearce(you should play Watch_Dogs if you haven't...)"? Well, I have too...So i created a chat program that lets anyone who figures "hey...lemme hack the people here" to find hacker buddies....lol...

It's just a chat program, so nothing special...hehehe...

Here is the code:

import socket, os

import thread, time

userssocks =

users
addr =

number = 0

usernames =

if os.path.exists("chatlogs.txt") == False:

f = open("chat
logs.txt", "w")

f.close()

def usernamethreader(sock, addr):

sock.send("*WELCOME TO THIS CHAT PROGRAM!!\n(If this is a hack attempt then you are among friends :D)\n")

sock.send("*Simply close your shell to terminate the program")

sock.send("\n*As at now, there are %d number of users" %number)

sock.send("\n*If you happen to be the only one here and feel like leaving but want to keep in touch, leave something so that we can contact you!")

while True:

try:

sock.send("\n+What is your username: ")

name = sock.recv(1024)

if name in usernames:

sock.send("\n*Username already exists!!")

else:

break

except:

pass

usernames.append(name)

recvMsg(sock, addr, name)

def recvMsg(sock, addr, username):

while True:

try:

data = sock.recv(4096)

msg = username.strip() + ":" + str(data.strip())

for isock in userssocks:

i
sock.send(msg+"\n")

g.write(msg+"\n")

except:

sock.close()

usernames.remove(username)

usersaddr.remove(addr)

continue

def connections():

os.system("clear")

for addrs in usersaddr:

print "*Connection from %s" %str(addrs)

time.sleep(3)

g = open("chatlogs.txt", "a")

g.write(time.strftime('-'15+' %Y-%m-%d %H:%M:%S '+'-'15))

s = socket.socket(socket.AF
INET, socket.SOCKSTREAM)

s.setsockopt(socket.SOL
SOCKET, socket.SOREUSEADDR, 1)

s.bind(('', 9000))

s.listen(10)

while True:

try:

conn, addr = s.accept()

userssocks.append(conn)

usersaddr.append(addr)

number+=1

print "* Connection from %s" %str(addr)

thread.start
newthread(usernamethreader, (conn, addr,))

thread.startnewthread(connections, ())

except socket.timeout:

pass

except KeyboardInterrupt:

break

g.close()

The format might not have come out right...click this link if you want.

Happy New Year guys...

Wuzi out!!

Apple's iOS 26 and iPadOS 26 updates are packed with new features, and you can try them before almost everyone else. First, check Gadget Hacks' list of supported iPhone and iPad models, then follow the step-by-step guide to install the iOS/iPadOS 26 beta — no paid developer account required.

Related Articles

Comments

No Comments Exist

Be the first, drop a comment!