1 Star 0 Fork 3

潘一二三 / awd-platform

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
flag.py 979 Bytes
一键复制 编辑 原始数据 按行查看 历史
zhl2008 提交于 2018-07-20 16:55 . fix somebugs
#!/usr/bin/env python
import SimpleHTTPServer
import SocketServer
import hashlib
import time
'''
this script is supposed to run on the gamebox, it record the flag sent
by the server, and record it to local file system, the normal request
should be looks like /you_should_not_guess_the_key/04df0f74b98693195d93ac695d51e837
'''
PORT = 9999
key = 'you_should_not_guess_the_key'
flag_path = '/flag'
time_span = 2 * 60
class my_handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
request = self.path.split('/')
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
if len(request) == 3 and request[1] == key and len(request[2]) == 32:
flag = request[2]
open(flag_path,'w').write(flag)
self.wfile.write('hello haozigege!')
else:
self.wfile.write('get out! hacker!')
Handler = my_handler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at port", PORT
httpd.serve_forever()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Cl0udG0d/awd-platform.git
git@gitee.com:Cl0udG0d/awd-platform.git
Cl0udG0d
awd-platform
awd-platform
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891