def theCLI(): client = Skype() client.Attach() if (len(sys.argv)<2) or (sys.argv[1] == "-o") or (sys.argv[1] == "--online"): for u in client.Friends: if u.OnlineStatus == 'ONLINE': print '\033[1;31mUser:\t\t\033[1;m', u.FullName print '\033[1;36mStatus:\t\033[1;m \t%s\n' % u.OnlineStatus elif (len(sys.argv)<2) or (sys.argv[1] == "-h") or (sys.argv[1] == "--help"): print ('\nUSAGE: %s -s [user] [message:] --> (--send) send encrypted message passing arguments') % (__file__) print '-o, --online --> print all users online' print '-v, --version --> print version and exit' print '-h, --help --> print this help\n' elif (len(sys.argv)<3) or (sys.argv[1] == "-c") or (sys.argv[1] == "--call"): user = sys.argv[2] client.PlaceCall(user) elif (len(sys.argv)<2) or (sys.argv[1] == "-v") or (sys.argv[1] == "--version"): print '\ncryptogpg-skype -- Version 0.01' print 'Developed by Simone Lombardi' print 'Released under the term of MIT License\n\n' elif (len(sys.argv)<2) or (sys.argv[1] == "-r") or (sys.argv[1] == "--retrieve"): client.OnMessageStatus = getMessage x = '' while not x == ":q": x = raw_input('') elif (len(sys.argv)<4) or (sys.argv[1] == "-s") or (sys.argv[1] == "--send"): user = sys.argv[2] message = ' '.join(sys.argv[3:]) gpg = getGPG() encrypted_data = gpg.encrypt(message, '*****@*****.**') client.SendMessage(user, encrypted_data) print 'Message sent: ', message print '\n\nEncrypted message: ', encrypted_data else: print 'No option selected'
class SkypePlugin(BasePlugin): def __init__(self): print "Attempting to connect to Skype API. If Python crashes, this" print "could mean that Skype isn't running at the moment." print "" print "(There's no way around this at present -- Skype's Python" print "libraries suck. It also this seems to crash all the time" print "on OSX.)" # connect to skype self.skype = Skype() # skype4py is quite un-pythonic, with it's method names. self.skype.Attach() # by now skype4py would crash if skype isn't running. def configure(self, c): # read in phone numbers we need self.numbers = [ x.strip() for x in c.get('skypesms', 'to').lower().split(',') ] def execute(self, msg, unit, address, when, printer, print_copies): # lets just send the whole message verbatim. sms = self.skype.CreateSms(smsMessageTypeOutgoing, *self.numbers) sms.Body = "%s: %s - %s" % (when.ctime(), msg, unit) sms.Send()
def skype_notify(pull_request_url=None): client = Skype() client.Attach() msg = PULL_REQUEST_NOTIFICATION_MESSAGE % (pull_request_url or '') for receiver in PULL_REQUEST_NOTIFICATION_RECEIVERS: client.SendMessage(receiver, msg)
def __init__(self): if platform.system() == 'Windows': skype = Skype() else: skype = Skype(Transport='x11') skype.Attach() self.chat = skype.Chat(SKYPE_CHAT) skype.OnMessageStatus = self.MessageStatus
def __init__(self): print "Attempting to connect to Skype API. If Python crashes, this" print "could mean that Skype isn't running at the moment." print "" print "(There's no way around this at present -- Skype's Python" print "libraries suck. It also this seems to crash all the time" print "on OSX.)" # connect to skype self.skype = Skype() # skype4py is quite un-pythonic, with it's method names. self.skype.Attach()
def send(self, queryset): try: queryset = queryset.order_by('user_id') except AttributeError: notification = queryset test_message = self.to_text(notification) test_user = slef.to_user(notification.user.skype) client = Skype(Transport='x11') client.Attach() client.SendMessage(test_user,test_message) return test_user
def __init__(self): self.contact = None self.skype = Skype() self.skype.OnMessageStatus = Handler.OnMessageStatus print('***************************************') print 'Connecting to Skype..' self.skype.Attach() self.contacts = dict( (user.FullName, user.Handle) \ for user in self.skype.Friends ) self.handles = set(self.contacts.values()) self.contact = None self.prev = None
def validation(string): while (1): if not re.match("^[A-Z][a-z]{2,15} [A-Z][a-z]{2,25} \d{4}.\d{2}.\d{2}", string): print('is incorrect') else: client = Skype(Transport='x11') client.Attach() user = '******' massage = 'string - Davit Sakanyan' client.SendMessage(user, massage) print('is correct') time.sleep(600) return
def run(command_args): Thread(target=start_skype).start() print output_api.INFO + 'Please, wait 2 seconds... (Press Ctrl + C to exit)' sleep(2) client = Skype() client.Attach() while True: try: client.SendMessage(command_args[1], random_all(50, 50)) print output_api.YES + 'Flood Sent!' sleep(int(command_args[2])) except KeyboardInterrupt: break
def get_skype(force_create=False, **kwargs): """return skype object. """ global _skype from Skype4Py import Skype options = get_skype_hook_options() options.update(kwargs) if _skype is None or force_create: _skype = Skype(**options) return _skype
def __init__(self): if platform.system() == 'Windows': skype = Skype() else: skype = Skype(Transport='x11') skype.Attach() self.chat = skype.Chat(SKYPE_CHAT)
def __init__(self, name="Skype Bot"): self.command_handler = CommandHandler() self.skype = Skype(Events=self) self.skype.FriendlyName = name
from Skype4Py import Skype import rstr import time client = Skype(Transport='x11') client.Attach() user = '******' while (True): message = rstr.xeger('[A-Z][a-z]{3,8} [A-Z][a-z]{3,8}yan (19\d\d|20[0-1][0-7])\nHi Armenuhi you are reseve message from Smbat') client.SendMessage(user, message) print message time.sleep(600)
def skype_call(user_name, message_text): client = Skype() client.Attach() client.PlaceCall(user_name)
def skype_message(user_name, message_text): client = Skype() client.Attach() client.SendMessage(user_name, message_text)
import platform from Skype4Py import Skype if platform.system() == 'Windows': skype = Skype() else: skype = Skype(Transport='x11') skype.Attach() for chat in skype.RecentChats: print '"%s" -> "%s"' % (chat.FriendlyName, chat.Name)
from Skype4Py import Skype from random import randint import rstr, time while (1): person = rstr.xeger( r'[A-Z][a-z]{3} [A-Z][a-z]{4}yan 19[4-9][0-9]|200[0-9]|201[0-7]') print person client = Skype() client.Attach() client.SendMessage("skype", person) time.sleep(600)
class Handler(object): def __init__(self): self.contact = None self.skype = Skype() self.skype.OnMessageStatus = Handler.OnMessageStatus print('***************************************') print 'Connecting to Skype..' self.skype.Attach() self.contacts = dict( (user.FullName, user.Handle) \ for user in self.skype.Friends ) self.handles = set(self.contacts.values()) self.contact = None self.prev = None @staticmethod def OnMessageStatus(Message, Status): if Status == 'RECEIVED': print('\n %s >> Me : %s' % (Message.FromHandle, Message.Body)) gHandler.prev = Message.FromHandle if gHeader: print gHeader, if Status == 'READ': return print "READ" print(Message.FromDisplayName + ': ' + Message.Body) if Status == 'SENT': return def parse_cmd(self, cmd): if not cmd: return allowed = {'.contacts', '.chat', '.exit', '.help', '.r', '.reply'} if cmd.startswith('.'): args = cmd.split()[1:] cmd = cmd.split()[0] if cmd not in allowed: print('This command is not allowed!\n' 'Allowed commands: %s' % ','.join(allowed)) if cmd == '.contacts': for i in self.contacts.iteritems(): print('%s : %s' % i) if cmd == '.help': print 'allowed commands:' % ','.join(allowed) if cmd == '.chat': if not len(args): print 'you should provide one target!' return target = ' '.join(args) if target in self.contacts: self.contact = self.contacts[target] elif target in self.handles: self.contact = target else: print 'I do not have %s as a contact!' % target if cmd == '.r' or cmd == '.reply': if self.prev is None: print 'No-one to reply!' self.skype.SendMessage(self.prev, ' '.join(args)) else: self.skype.SendMessage(self.contact, cmd)
class SkypeBot(object): __metaclass__ = ABCMeta """ Abstract Base Class to define the interactions of a SkypeBot Args: name (string, optional): Name given to the SkypeBot """ def __init__(self, name="Skype Bot"): self.command_handler = CommandHandler() self.skype = Skype(Events=self) self.skype.FriendlyName = name def MessageStatus(self, msg, status): """ Event handler for sending messages Args: msg (Skype4Py.SmsMessage): Skype Message status (int): status code """ if status == cmsReceived: msg.MarkAsSeen() user = msg.FromHandle reply_with = self.command_handler.handle(msg, status, user) if reply_with: self.__reply(msg, reply_with) def __reply(self, msg_client, msg): """ [Internal] Send message to chat via Skype Msg Module Args: msg_client (Skype4Py.Chat): Skype Chat client instance msg (Skype4Py.SmsMessage): Skype Message """ msg_client.Chat.SendMessage(msg) def bootstrap(self): """ Bootstraps the Bot config to run and attach to the skype client """ self.register_command_delimiter() self.register_command_owner() self.register_commands() self.skype.Attach() @abstractmethod def run(self): """ Method which will facilitate running the Bot. """ pass @abstractmethod def register_command_delimiter(self): """ Register the delimiter in which signifies a command is being sent. """ pass @abstractmethod def register_command_owner(self): """ Register the current bot name which will respond to commands in skype. """ pass @abstractmethod def register_commands(self): """ Register the bot commands. """ pass
#You must install rstr and Skype4Py from Skype4Py import Skype import sys import rstr message = rstr.xeger('[A-Z][a-z]{4} [A-Z][a-z]{3,6}yan \d{4}') client = Skype() client.Attach() user = "******" client.SendMessage(user, message)