Commit 0a9f9491 authored by Minkush's avatar Minkush

add IRC nick registration script

parent 51dc49d8
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import socket
import string
HOST = 'irc.freenode.net'
PORT = 6667
channel = '#Beginner'
s = socket.socket()
s.connect((HOST, PORT))
def nick_register(
REALNAME,
NICK,
mail,
password,
):
readbuffer = ''
IDENT = irc_nick
s.send(bytes('NICK %s\r\n' % NICK, 'UTF-8'))
s.send(bytes('USER %s %s bla :%s\r\n' % (IDENT, HOST, REALNAME),
'UTF-8'))
s.send(bytes('JOIN #Beginner\r\n', 'UTF-8'))
s.send(str.encode('PRIVMSG NickServ :REGISTER %s %s\r\n'
% (password, mail)))
while 1:
readbuffer = readbuffer + s.recv(1024).decode('UTF-8')
temp = str.split(readbuffer, '\n')
readbuffer = temp.pop()
for line in temp:
line = str.rstrip(line)
line = str.split(line)
if line[0] == 'PING':
s.send(bytes('PONG %s\r\n' % line[1], 'UTF-8'))
if line[1] == 'PRIVMSG':
sender = ''
for char in line[0]:
if char == '!':
break
if char != ':':
sender += char
size = len(line)
i = 3
message = ''
while i < size:
message += line[i] + ' '
i = i + 1
message.lstrip(':')
s.send(bytes('PRIVMSG %s %s \r\n' % (sender, message),
'UTF-8'))
for (index, i) in enumerate(line):
print(line[index])
if __name__ == '__main__':
print('This Program will automate IRC Nickname Registration\n')
user_name = input('Enter your name: ')
irc_nick = input('Enter the IRC nickname you want to register: ')
email = input('Enter your email: ')
password = input('Enter password for your nickname: ')
nick_register(user_name, irc_nick, email, password)
print('\n Congrats! your IRC nickname has been registered. Check your mail for further instructions.')
......@@ -40,6 +40,6 @@ def edit_config(username):
if __name__ == '__main__':
print 'Program to close Thunderbird application and edit its configuration settings\n'
print('Program to close Thunderbird application and edit its configuration settings\n')
username = input("Enter your PC's user name: ")
edit_config(username)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment