Commit 3b94f35d authored by Minkush's avatar Minkush

Adding the offline scripts that I created while experimenting with tasks

parent 90482b6f
#debconf-announce
import requests
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
print("This is a program to automate the process of subscription to the mailing list.\n")
#Submitting user email on the website:
with requests.Session() as c:
url="https://lists.debian.org/cgi-bin/subscribe.pl"
email=input("Enter you E-mail: ") #enter user's email
c.get(url)
login_data={'user_email':email, 'list':'debconf-announce', 'action':'Subscribe'}
c.post(url,data=login_data,stream=True)
print("\nCheck your mail for further instructions!")
#confirming subscription by replying to the mail:
a=input("\nEnter the code of the subject you recieved in your mail: ")
b="CONFIRM "+a # Subject
fromaddr = "gsocdebian@gmail.com" # Enter sender's email address
toaddr = "debconf-announce-request@lists.debian.org"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = b
body = "Subscribe"
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.gmail.com', 587) #connects to server using port 587
server.starttls()
server.login(fromaddr, "testuser") #Enter password of sender's email in " "
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
print("\nCongrats, your email has been successfully registered in debconf-announce mailing list!")
k=input("\nPress any key to exit")
#debian-announce
import requests
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
print("This is a program to automate the process of subscription to the mailing list.\n")
#Submitting user email on the website:
with requests.Session() as c:
url="https://lists.debian.org/cgi-bin/subscribe.pl"
email=input("Enter you E-mail: ") #enter user's email
c.get(url)
login_data={'user_email':email, 'list':'debian-announce', 'action':'Subscribe'}
c.post(url,data=login_data,stream=True)
print("\nCheck your mail for further instructions!")
#confirming subscription by replying to the mail:
a=input("\nEnter the code of the subject you recieved in your mail: ")
b="CONFIRM "+a # Subject
fromaddr = "gsocdebian@gmail.com" # Enter sender's email address
toaddr = "debian-announce-request@lists.debian.org"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = b
body = "Subscribe"
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.gmail.com', 587) #connects to server using port 587
server.starttls()
server.login(fromaddr, "testuser") #Enter password of sender's email in " "
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
print("\nCongrats, your email has been successfully registered in debian-announce mailing list!")
k=input("\nPress any key to exit")
#debian-devel-announce
import requests
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
print("This is a program to automate the process of subscription to the mailing list.\n")
#Submitting user email on the website:
with requests.Session() as c:
url="https://lists.debian.org/cgi-bin/subscribe.pl"
email=input("Enter you E-mail: ") #enter user's email
c.get(url)
login_data={'user_email':email, 'list':'debian-devel-announce', 'action':'Subscribe'}
c.post(url,data=login_data,stream=True)
print("\nCheck your mail for further instructions!")
#confirming subscription by replying to the mail:
a=input("\nEnter the code of the subject you recieved in your mail: ")
b="CONFIRM "+a # Subject
fromaddr = "gsocdebian@gmail.com" # Enter sender's email address
toaddr = "debian-devel-announce-request@lists.debian.org"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = b
body = "Subscribe"
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.gmail.com', 587) #connects to server using port 587
server.starttls()
server.login(fromaddr, "testuser") #Enter password of sender's email in " "
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
print("\nCongrats, your email has been successfully registered in debian-devel-announce mailing list!")
k=input("\nPress any key to exit")
#debian-dug-in
import requests
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
print("This is a program to automate the process of subscription to the mailing list.\n")
#Submitting user email on the website:
with requests.Session() as c:
url="https://lists.debian.org/cgi-bin/subscribe.pl"
email=input("Enter you E-mail: ") #enter user's email
c.get(url)
login_data={'user_email':email, 'list':'debian-dug-in', 'action':'Subscribe'}
c.post(url,data=login_data,stream=True)
print("\nCheck your mail for further instructions!")
#confirming subscription by replying to the mail:
a=input("\nEnter the code of the subject you recieved in your mail: ")
b="CONFIRM "+a # Subject
fromaddr = "gsocdebian@gmail.com" # Enter sender's email address
toaddr = "debian-dug-in-request@lists.debian.org"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = b
body = "Subscribe"
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.gmail.com', 587) #connects to server using port 587
server.starttls()
server.login(fromaddr, "testuser") #Enter password of sender's email in " "
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
print("\nCongrats, your email has been successfully registered in debian-dug-in mailing list!")
k=input("\nPress any key to exit")
#debian-events-apac
import requests
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
print("This is a program to automate the process of subscription to the mailing list.\n")
#Submitting user email on the website:
with requests.Session() as c:
url="https://lists.debian.org/cgi-bin/subscribe.pl"
email=input("Enter you E-mail: ") #enter user's email
c.get(url)
login_data={'user_email':email, 'list':'debian-events-apac', 'action':'Subscribe'}
c.post(url,data=login_data,stream=True)
print("\nCheck your mail for further instructions!")
#confirming subscription by replying to the mail:
a=input("\nEnter the code of the subject you recieved in your mail: ")
b="CONFIRM "+a # Subject
fromaddr = "gsocdebian@gmail.com" # Enter sender's email address
toaddr = "debian-events-apac-request@lists.debian.org"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = b
body = "Subscribe"
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.gmail.com', 587) #connects to server using port 587
server.starttls()
server.login(fromaddr, "testuser") #Enter password of sender's email in " "
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
print("\nCongrats, your email has been successfully registered in debian-events-apac mailing list!")
k=input("\nPress any key to exit")
#debian-events-eu
import requests
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
print("This is a program to automate the process of subscription to the mailing list.\n")
#Submitting user email on the website:
with requests.Session() as c:
url="https://lists.debian.org/cgi-bin/subscribe.pl"
email=input("Enter you E-mail: ") #enter user's email
c.get(url)
login_data={'user_email':email, 'list':'debian-events-eu', 'action':'Subscribe'}
c.post(url,data=login_data,stream=True)
print("\nCheck your mail for further instructions!")
#confirming subscription by replying to the mail:
a=input("\nEnter the code of the subject you recieved in your mail: ")
b="CONFIRM "+a # Subject
fromaddr = "gsocdebian@gmail.com" # Enter sender's email address
toaddr = "debian-events-eu-request@lists.debian.org"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = b
body = "Subscribe"
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.gmail.com', 587) #connects to server using port 587
server.starttls()
server.login(fromaddr, "testuser") #Enter password of sender's email in " "
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
print("\nCongrats, your email has been successfully registered in debian-events-eu mailing list!")
k=input("\nPress any key to exit")
#debian-events-ha
import requests
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
print("This is a program to automate the process of subscription to the mailing list.\n")
#Submitting user email on the website:
with requests.Session() as c:
url="https://lists.debian.org/cgi-bin/subscribe.pl"
email=input("Enter you E-mail: ") #enter user's email
c.get(url)
login_data={'user_email':email, 'list':'debian-events-ha', 'action':'Subscribe'}
c.post(url,data=login_data,stream=True)
print("\nCheck your mail for further instructions!")
#confirming subscription by replying to the mail:
a=input("\nEnter the code of the subject you recieved in your mail: ")
b="CONFIRM "+a # Subject
fromaddr = "gsocdebian@gmail.com" # sender's email address
toaddr = "debian-events-ha-request@lists.debian.org"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = b
body = "Subscribe"
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.gmail.com', 587) #connects to server using port 587
server.starttls()
server.login(fromaddr, "testuser")
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
print("\nCongrats, your email has been successfully registered in debian-events-ha mailing list!")
k=input("\nPress any key to exit")
#debian-events-na
import requests
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
print("This is a program to automate the process of subscription to the mailing list.\n")
#Submitting user email on the website:
with requests.Session() as c:
url="https://lists.debian.org/cgi-bin/subscribe.pl"
email=input("Enter you E-mail: ") #enter user's email
c.get(url)
login_data={'user_email':email, 'list':'debian-events-na', 'action':'Subscribe'}
c.post(url,data=login_data,stream=True)
print("\nCheck your mail for further instructions!")
#confirming subscription by replying to the mail:
a=input("\nEnter the code of the subject you recieved in your mail: ")
b="CONFIRM "+a # Subject
fromaddr = "gsocdebian@gmail.com" #sender's email address
toaddr = "debian-events-na-request@lists.debian.org"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = b
body = "Subscribe"
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.gmail.com', 587) #connects to server using port 587
server.starttls()
server.login(fromaddr, "testuser") #Enter password of sender's email in " "
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
print("\nCongrats, your email has been successfully registered in debian-events-na mailing list!")
k=input("\nPress any key to exit")
#debian-news
import requests
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
print("This is a program to automate the process of subscription to the mailing list.\n")
#Submitting user email on the website:
with requests.Session() as c:
url="https://lists.debian.org/cgi-bin/subscribe.pl"
email=input("Enter you E-mail: ") #enter user's email
c.get(url)
login_data={'user_email':email, 'list':'debian-news', 'action':'Subscribe'}
c.post(url,data=login_data,stream=True)
print("\nCheck your mail for further instructions!")
#confirming subscription by replying to the mail:
a=input("\nEnter the code of the subject you recieved in your mail: ")
b="CONFIRM "+a # Subject
fromaddr = "gsocdebian@gmail.com" # sender's email address
toaddr = "debian-news-request@lists.debian.org"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = b
body = "Subscribe"
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.gmail.com', 587) #connects to server using port 587
server.starttls()
server.login(fromaddr, "testuser")
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
print("\nCongrats, your email has been successfully registered in debian-news mailing list!")
k=input("\nPress any key to exit")
#debian-outreach
import requests
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
print("This is a program to automate the process of subscription to the mailing list.\n")
#Submitting user email on the website:
with requests.Session() as c:
url="https://lists.debian.org/cgi-bin/subscribe.pl"
email=input("Enter you E-mail: ") #enter user's email
c.get(url)
login_data={'user_email':email, 'list':'debian-outreach', 'action':'Subscribe'}
c.post(url,data=login_data,stream=True)
print("\nCheck your mail for further instructions!")
#confirming subscription by replying to the mail:
a=input("\nEnter the code of the subject you recieved in your mail: ")
b="CONFIRM "+a # Subject
fromaddr = "gsocdebian@gmail.com" # sender's email address
toaddr = "debian-outreach-request@lists.debian.org"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = b
body = "Subscribe"
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.gmail.com', 587) #connects to server using port 587
server.starttls()
server.login(fromaddr, "testuser")
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
print("\nCongrats, your email has been successfully registered in debian-outreach mailing list!")
k=input("\nPress any key to exit")
1) debian-outreach:
Public discussion of the Outreach Team's activities
Discussion of Debian's participation in internship-like programs, such as Outreachy, Google Summer of Code, ...
2) debian-news:
Debian News, weekly and otherwise
General news about the distribution and the project.
3) debian-announce:
Important announcements
Major news and very important changes in the project are announced here.
4) debconf-announce:
Debconf Announcements
Important news about Debconf. This list is a *MUST* for everyone, organizer or participant.
5) debian-devel-announce:
Announcements for developers
Announcements of development issues like policy changes, important release issues &c.
6) debian-events-apac:
Events with Debian affiliation in Asia/Pacific region
Announcements, discussions and organizational stuff about events organized by Debian or a Debian presence at events in the Asia/Pacific region.
7) debian-events-eu:
Events with Debian affiliation in Europe
Discussions and organizational stuff about booths for Debian at european exhibitions.
8) debian-events-na:
Events with Debian affiliation in North America
Discussions and organizational stuff about booths and presentations for Debian at North American exhibitions.
9) debian-events-ha:
Events with Debian affiliation in Hispanic America
Mailing list for announcements and events organization with Debian affiliation in Hispanic America.
10) debian-dug-in:
Discussion list for the Indian Debian Community
Discussion list for the Debian community in India without being tied to a particular group in order to link all groups and individuals in the country and facilitate the coordination of local events.
\ No newline at end of file
# Learning server client program for IRC script
# Creating a server
import socket
import sys
ms = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
msinfo = socket.getaddrinfo(None, 1234)
print(msinfo[3][4])
try:
ms.bind(msinfo[3][4])
except socket.error:
print("Failed to bind")
sys.exit()
ms.listen(5)
while True:
conn, addr = ms.accept()
data = conn.recv(1024)
if not data:
break
print ("Got a request!")
print (data)
# closing conenction
conn.close()
ms.close()
# Experimenting with IRC bot script
import sys
import socket
import string
HOST = "irc.freenode.net"
PORT = 6667
NICK = input("Enter the IRC nickname you want to register: ")
mail = input("Enter your email: ")
password = input("Enter password for your nickname: ")
IDENT = NICK
REALNAME = input("Enter your name: ")
MASTER = "CHANGETHIS"
channel = "#Beginner"
msg = "/msg nickserv register qwertyuiop12 minkushtest@gmail.com"
readbuffer = ""
s=socket.socket( )
s.connect((HOST, PORT))
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)))
s.send(str.encode("PRIVMSG " + channel +" :" + msg + "\n"))
s.send("#Beginner".encode("UTF-8"), "Hello!".encode("UTF-8"))
s.send("#Beginner".encode("UTF-8"), "/msg nickserv register qwertyuiop minkushtest@gmail.com".encode("UTF-8"))
s.send(bytes("PRIVMSG %s :Hello Master\r\n" % MASTER, "UTF-8"))
# Ping Pong mechanism
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"))
# show the messages received from client
for index, i in enumerate(line):
print(line[index])
import requests
#Submitting user email on the website:
with requests.Session() as c:
url="https://github.com/join/plan"
username=input("Enter your username: ") #enter user's email
email = input("Enter your email: ")
password = input ("Enter ur pwd: ")
c.get(url)
# clicking submit button using requests library
login_data={'user_login':username, 'user_email':email, 'user_password':password, 'submit':""}
c.post(url,data=login_data,stream=True)
print("\nCheck your mail for further instructions!")
from irc_test1 import *
import os
import random
channel = "#Beginner"
server = "irc.freenode.net"
nickname = "minkush123"
irc = IRC()
irc.connect(server, channel, nickname)
while 1:
text = irc.get_text()
print (text)
import socket
import sys
class IRC:
irc = socket.socket()
def __init__(self):
self.irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def send(self, chan, msg):
#self.irc.send(b"PRIVMSG " + chan + " " + msg + "n")
self.irc.send(b"PRIVMSG #channel good\n")
def connect(self, server, channel, botnick):
#defines the socket
print ("connecting to:"+server)
self.irc.connect((server, 6667)) #connects to the server
self.irc.send("USER " + botnick + " " + botnick +" " + botnick + " :This is a fun bot!n") #user authentication
self.irc.send(b"NICK " + botnick + "n")
self.irc.send(b"JOIN " + channel + "n") #join the chan
self.irc.send(b"NICK minkush123\n")
self.irc.send(b"JOIN #channel\n")
self.irc.send(b"/msg NickServ REGISTER qwertyuiop minkushtest@gmail.com")
def get_text(self):
text=self.irc.recv(2040) #receive the text
# if text.find('PING') != -1:
# self.irc.send('PONG ' + text.split() [1] + 'rn')
return text
# testing signal library to kill process
import subprocess, signal
p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE)
out, err = p.communicate()
for line in out.splitlines():
if 'thunderbird' in line:
pid = int(line.split(None, 1)[0])
os.kill(pid, signal.SIGKILL)
# learning socket programming
from twython import TwythonStreamer
c_k = "key"
c_s = "key"
a_t = "key"
a_s = "key"
count = 0
def increase():
global count
count = count+1
class MyStreamer(TwythonStreamer):
def on_success(self, data):
text = 'text'
for text in data:
increase()
print (count)
break
if count == 3:
print("Debian is popular!")
stream = MyStreamer(c_k, c_s, a_t, a_s)
stream.statuses.filter(track="#Debian")
import requests
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
print("This is a program to automate the process of subscription to the mailing list.\n")
#created codes between S1----S10 corresponding to each mailing list. In GUI, S1---S10 would be the name of ten "Subscribe" buttons.
list_code=input("Enter mailing list code between S1 and S10: ") #variable list_code will contain the mailing list code.
if list_code=="S1":
listname = "debian-outreach"
elif list_code=="S2":
listname = "debian-news"
elif list_code=="S3":
listname = "debian-announce"
elif list_code=="S4":
listname = "debconf-announce"
elif list_code=="S5":
listname = "debian-devel-announce"
elif list_code=="S6":
listname = "debian-events-apac"
elif list_code=="S7":
listname = "debian-events-eu"
elif list_code=="S8":
listname = "debian-events-na"
elif list_code=="S9":
listname = "debian-events-ha"
elif list_code=="S10":
listname = "debian-dug-in"
#Submitting user email on the website:
with requests.Session() as c:
url="https://lists.debian.org/cgi-bin/subscribe.pl"
email=input("Enter you E-mail: ") #enter user's email here
c.get(url)
login_data={'user_email':email, 'list':listname, 'action':'Subscribe'}
c.post(url,data=login_data,stream=True)
print("\nCheck your mail for further instructions!")
#confirming subscription by replying to the mail: