Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.47 KB | None | 0 0
  1. import vk
  2. import tkinter
  3. import time
  4. from tkinter import *
  5. import webbrowser
  6. x=("")
  7. mail =('')
  8. pas =("")
  9. start1=True
  10. start2=0
  11. countt=()
  12. ownerr=()
  13. msgg=()
  14. ttme=()
  15. sc=()
  16. so=""
  17. sm=""
  18. st=str(1)
  19. ll = open('lastlogin.txt','r')
  20. lp=open('lastpas.txt','r')
  21. session = vk.AuthSession(app_id='5984408',user_login=mail, user_password=pas,scope="photos,audio,video,docs,notes,pages,status,offers,questions,wall,groups,messages,email,notifications,stats,ads,offline,docs,pages,stats,notifications")
  22.  
  23. def sstart():
  24.     mail=open("lastlogin.txt","r")
  25.     pas=open("lastpas.txt","r")
  26.     session = vk.AuthSession(app_id='5984408',user_login=mail, user_password=pas,scope=8192)
  27.     api = vk.API(session)
  28.     global st
  29.     global ttime
  30.     global so
  31.     global ownerr
  32.     global sm
  33.     global msgg
  34.     global sc
  35.     global countt
  36.     global start1
  37.     global start2
  38.     st=ttime.get()
  39.     so=ownerr.get()
  40.     sc=countt.get()
  41.     sm=msgg.get()
  42.     while start1==True:
  43.         api.wall.post(owner_id="-"+so,message=sm)
  44.         time.sleep(2)
  45.  
  46. def spam():
  47.     w = Label(root, text="количество сообщений")
  48.     global countt
  49.     global sc
  50.     countt=Entry(root,width=20)
  51.     w2 = Label(root, text="ID сообщества")
  52.     w2.pack()
  53.     global ownerr
  54.     global so
  55.     ownerr=Entry(root,width=20)
  56.     ownerr.pack()
  57.     w1 = Label(root, text="Сообщение")
  58.     w1.pack()
  59.     global msgg
  60.     global sm
  61.     msgg=Entry(root,width=20)
  62.     msgg.pack()
  63.     w = Label(root, text="интервал в секундах")
  64.     global ttime
  65.     global st
  66.     ttime=Entry(root,width=3)
  67.     startt=Button(root,text=u"Старт",command=sstart)
  68.     startt.pack()
  69.  
  70. def quitg():
  71.     mail=open("lastlogin.txt","r")
  72.     pas=open("lastpas.txt","r")
  73.     session = vk.AuthSession(app_id='5984408',user_login=mail, user_password=pas,scope=262144)
  74.     api = vk.API(session)
  75.     qg=open("groups.txt","w")
  76.     gg=api.groups.get(user_id=0)
  77.     my_data_string = "".join(["api.groups.leave(group_id=%s)\n" % group_id for group_id in gg])
  78.     qg.write(my_data_string)
  79.     qg.close()
  80.     commands = open("groups.txt").readlines()
  81.     for command in commands:
  82.         exec(command)
  83.  
  84. def delreq():
  85.     mail=open("lastlogin.txt","r")
  86.     pas=open("lastpas.txt","r")
  87.     session = vk.AuthSession(app_id='5984408',user_login=mail, user_password=pas,scope=2)
  88.     api = vk.API(session)
  89.     api.friends.deleteAllRequests()
  90.  
  91.    
  92. def getfr():
  93.     mail=open("lastlogin.txt","r")
  94.     pas=open("lastpas.txt","r")
  95.     session = vk.AuthSession(app_id='5984408',user_login=mail, user_password=pas,scope=2)
  96.     api = vk.API(session)
  97.     gfa=api.friends.get(user_id=0)
  98.     gf=open("friends.txt","w")
  99.     my_data_string = "".join(["api.friends.delete(user_id=%s)\n" % user_id for user_id in gfa])
  100.     gf.write(my_data_string)
  101.     gf.close()
  102.     commands = open("friends.txt").readlines()
  103.     for command in commands:
  104.         exec(command)
  105.    
  106. def button_clicked():
  107.     mail=text1.get()
  108.     pas=text2.get()
  109.     session = vk.AuthSession(app_id='5984408',user_login=mail, user_password=pas,scope="photos,audio,video,docs,notes,pages,status,offers,questions,wall,groups,messages,email,notifications,stats,ads,offline,docs,pages,stats,notifications")
  110.     api = vk.API(session)
  111.     ll = open('lastlogin.txt','w')
  112.     lp=open('lastpas.txt','w')
  113.     ll.write(mail)
  114.     lp.write(pas)
  115.     ll.close()
  116.     lp.close()
  117.     t=api.users.get(user_id=0)
  118.     text1.destroy()
  119.     text2.destroy()
  120.     button1.destroy()
  121.     buttondelreq = Button(root,text=u"Оставить все заявки в подписчиках",command=delreq)
  122.     buttondelreq.pack()
  123.     buttongetfr= Button(root,text=u"Удалить друзей",command=getfr)
  124.     buttongetfr.pack()
  125.     buttonqg= Button(root,text=u"Выйти из всех групп",command=quitg)
  126.     buttonqg.pack()
  127.     global buttonspam
  128.     buttonspam= Button(root,text=u"Спам по группам",command=spam)
  129.     buttonspam.pack()
  130.     print(t['uid'])
  131.     if  '[{' in t:
  132.         print("true")
  133.     else:
  134.         label['text']=t
  135. l1 = ll.read()
  136. l2 = lp.read()
  137. root=Tk()
  138. root.title(u"vk bot")
  139. root.geometry('250x300+300+200')
  140. label = Label(root, text="Вход не выполнен")
  141. label.pack()
  142. text1=Entry(root,width=20)
  143. text1.insert(0,l1)
  144. text1.pack()
  145. text2=Entry(root,width=20 ,show='*')
  146. text2.insert(0,l2)
  147. text2.pack()
  148. button1 = Button(root, text=u"Вход", command=button_clicked)
  149. button1.pack()
  150. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement