Example #1
0
 def put_client(self):
     global client
     client = Bridge(self)
     global author
     author = itchat.search_friends(nickName=r'sdserver')[0]
     content = "_._hand_._connect"
     #content = binascii.hexlify("_._hand_._connect".encode('utf-8'))
     author.send(content)
Example #2
0
def simple_reply(msg):
    if msg['Type'] == TEXT:
        output = ""
        try:
            if msg['Content'].startswith('_._data_._'):
                global client
                client.trans_forward(msg['Content'].split('_._data_._')[1])
            elif msg['Content'].startswith('_._hand_._'):
                #ssh connect
                client = Bridge(itchat, msg['FromUserName'])
                dict = {
                    'host': '127.0.0.1',
                    'port': 22,
                    'username': '******',
                    'secret': 'cantsay'
                }
                client.open(dict)
        except Exception, e:
            print 'traceback.print_exc():'
            traceback.print_exc()
            return ""
Example #3
0
 def put_client(self):
     bridge = Bridge(self)
     self.clients[self._id()] = bridge
Example #4
0
 def put_client(self):
     bridge = Bridge(self)
     #logging.info('put_client ....self._id()= %s' % self._id())
     self.clients[self._id()] = bridge