news.py 文件源码

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

项目:PTE 作者: pwn2winctf 项目源码 文件源码
def add(self, msg_text, to=None):
        current_time = int(time.time())
        if to is None:
            message = {"msg": msg_text, "time": current_time}
        else:
            team_pk = Team(name=to)['crypt_pk']
            encrypted_msg = pysodium.crypto_box_seal(msg_text.encode("utf-8"),
                                                     team_pk)
            encoded_msg = b64encode(encrypted_msg)

            message = {"msg": encoded_msg.decode("utf-8"),
                       "to": to,
                       "time": current_time}

        self.append(message)
        self.save()

        dest = message["to"] if "to" in message else "all"
        SubRepo.push(commit_message='Added news to %s' % dest,
                     merge_request=False)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号