How to Make a Multi-User Chat Program for Hackers

Dec 31, 2015 06:49 PM
Dec 31, 2015 06:54 PM
635871559250022212.jpg

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!!

Just updated your iPhone? You'll find new Apple Intelligence capabilities, sudoku puzzles, Camera Control enhancements, volume control limits, layered Voice Memo recordings, and other useful features. Find out what's new and changed on your iPhone with the iOS 18.2 update.

Related Articles

637263493835297420.jpg

How to Use Zero-Width Characters to Hide Secret Messages in Text (& Even Reveal Leaks)

636455706472146367.jpg

How to Hide DDE-Based Attacks in MS Word

Comments

No Comments Exist

Be the first, drop a comment!