1 Star 0 Fork 5

Jakieborn/awd-platform_1

forked from d3N00t/awd-platform 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
flag.py 979 Bytes
一键复制 编辑 原始数据 按行查看 历史
d3N00t 提交于 2020-06-03 09:37 . master
#!/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 = 5 * 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 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/jakieborn/awd-platform_1.git
git@gitee.com:jakieborn/awd-platform_1.git
jakieborn
awd-platform_1
awd-platform_1
master

搜索帮助