Advertisement
Guest User

[script]Last seen by yowsup

a guest
Sep 20th, 2014
1,383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.42 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. #!/usr/bin/python
  3.  
  4. #Por Rodrigo Avila - @el_rodrix
  5. #rodrigo398@hotmail.com
  6.  
  7. import argparse, sys, os, csv
  8. from Yowsup.Common.utilities import Utilities
  9. from Yowsup.Common.debugger import Debugger
  10. from Yowsup.Common.constants import Constants
  11. from Yowsup.Contacts.contacts import WAContactsSyncRequest
  12. from Yowsup.connectionmanager import YowsupConnectionManager
  13.  
  14. import threading,time, base64
  15.  
  16. #.....................config.......................
  17.  
  18. nickname = "549XXXXXXXXXX" #Agregar numero movil
  19. username = "549XXXXXXXXXX" #Agregar usuario
  20. password = "XXXXXXXXXXXXXX" #Agregar pass
  21. target = ["549xxxxxxx", "549xxxxxxxx"] #Ingresar los numeros a verificar en esta lista
  22.  
  23. #....................................................................
  24.  
  25. password = base64.b64decode(bytes(password.encode('utf-8')))
  26. jid = range(len(target))
  27. for x in range(0, len(target)):
  28.     jid[x] = "%s@s.whatsapp.net" % target[x]
  29.     print jid[x]
  30. Debugger.enabled = True if '-d' in sys.argv else False
  31.  
  32. def login(username, password):
  33.     print "[] Autenticado como: %s (%s)\n" % (nickname, username)
  34.     methodsInterface.call("auth_login", (username, password))
  35.  
  36. def send(jid, msg):
  37.     methodsInterface.call("message_send", (jid, msg))
  38.  
  39. def onAuthSuccess(username):
  40.     print("Autenticado!!\n\n")
  41.     methodsInterface.call("ready")
  42.     methodsInterface.call("presence_sendAvailableForChat", (nickname,))
  43.     methodsInterface.call("presence_sendAvailable")
  44.     for x in range(0, len(target)):
  45.         methodsInterface.call("presence_request", (jid[x],))
  46.         time.sleep(2)
  47.     t = 5
  48.     i = 0
  49.     while i < t:
  50.         time.sleep(0.5)
  51.         i=i+1
  52.  
  53. def onAuthFailed(username, err):
  54.     print("Auth Failed!")
  55.  
  56. def onPresenceUpdated(jid, lastSeen):
  57.     print time.strftime("Ultima vez en linea hace: %H horas %M minutos", time.gmtime(lastSeen))
  58.  
  59.  
  60. ########################### EVENTOS #############################  
  61. connectionManager = YowsupConnectionManager()
  62. signalsInterface = connectionManager.getSignalsInterface()
  63. methodsInterface = connectionManager.getMethodsInterface()
  64. connectionManager.setAutoPong(True)
  65.  
  66. signalsInterface.registerListener("auth_success", onAuthSuccess)
  67. signalsInterface.registerListener("auth_fail", onAuthFailed)
  68. signalsInterface.registerListener("presence_updated", onPresenceUpdated)
  69. #####################################################################
  70.  
  71. login(username, password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement