secbot.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:secbot 作者: pagarme 项目源码 文件源码
def start(self):
        if self.mode == 'slacker':
            exit('Slacker mode is missing websocket for reading events... sorry!')
            if self.slack.rtm.connect().body.get('ok'):
                print("[+] SecBot connected and running!")
                ch_joiner = self.join_channels()
                while True:
                    channel, user, ts, message, at_bot = self.parse_slack_output(self.slack.rtm.read())
                    if message and channel:
                        self.executor.submit(self.handle_command, channel, user, ts, message, at_bot)
                        #self.handle_command(channel, user, ts, message, at_bot)
                    time.sleep(self.websocket_delay)


        if self.mode == 'slackclient':
            if self.slack.rtm_connect(no_latest=True, no_unreads=True, presence_sub=True):
                print("[+] SecBot connected and running!")
                ch_joiner = self.join_channels()
                while True:
                    channel, user, ts, message, at_bot = self.parse_slack_output(self.slack.rtm_read())
                    if message and channel:
                        self.executor.submit(self.handle_command, channel, user, ts, message, at_bot)
                        #self.handle_command(channel, user, ts, message, at_bot)
                    time.sleep(self.websocket_delay)
            else:
                print("[!] Connection failed. Invalid Slack token or bot ID?")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号