api.py 文件源码

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

项目:HBCTF 作者: osteth 项目源码 文件源码
def Player_Checkin():
    '''Accepts json formatted request containing the teams TeamID, IP, and Port and pushes the info over to CheckinUpdate to be stored in the DB
    json data should be in format {"TeamID": "Mudkips","IP": "192.168.0.1","Port": "5001"}
    Example: 
    curl -H "Content-Type: application/json" -X POST -d '{"TeamID": "Mudkips","IP": "192.168.0.1","Port": "5001"}' http://localhost:5001/checkin/
    '''
    try:
        checkin_resp = request.data
        IP = checkin_resp.get('IP')
        Port  = checkin_resp.get('Port')
        TeamID  = checkin_resp.get('TeamID')
        if IP and Port and TeamID is not None:
            Token, key = CheckinUpdate(IP, Port, TeamID)
            return {'Score Token': Token,
                    'Key': key}
        else:
            return {'Invalid': 'request'}
    except:
        return {'Invalid': 'request'}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号