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
number = 0
if os.path.exists("chatlogs.txt") == False:
f = open("chatlogs.txt", "w")
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!")
sock.send("\n+What is your username: ")
name = sock.recv(1024)
if name in usernames:
sock.send("\n*Username already exists!!")
recvMsg(sock, addr, name)
def recvMsg(sock, addr, username):
data = sock.recv(4096)
msg = username.strip() + ":" + str(data.strip())
for isock in userssocks:
for addrs in usersaddr:
print "*Connection from %s" %str(addrs)
g = open("chatlogs.txt", "a")
g.write(time.strftime('-'15+' %Y-%m-%d %H:%M:%S '+'-'15))
s = socket.socket(socket.AFINET, socket.SOCKSTREAM)
s.setsockopt(socket.SOLSOCKET, socket.SOREUSEADDR, 1)
conn, addr = s.accept()
print "* Connection from %s" %str(addr)
thread.startnewthread(usernamethreader, (conn, addr,))
The format might not have come out right...click this link if you want.
Happy New Year guys...