@app.route('/read') def read(): try: url = request.args.get('url') m = re.findall('^file.*', url, re.IGNORECASE) n = re.findall('flag', url, re.IGNORECASE) if m or n: return 'No Hack' res = urllib.urlopen(url) return res.read() except Exception as ex: print str(ex) return 'no response'
@app.route('/flag') def flag(): if session and session['username'] == 'fuck': return open('/flag.txt').read() else: return 'Access denied'
if __name__=='__main__': app.run( debug=True, host="0.0.0.0" )
andom指定了seed那么生成的随机数是固定的
/sys/class/net/eth0/address 获得mac地址
1 2 3 4 5 6 7 8 9 10 11 12
import uuid import random
mac = "e6:5c:db:61:4f:fb" temp = mac.split(':') temp = [int(i,16) for i in temp] temp = [bin(i).replace('0b','').zfill(8) for i in temp] temp = ''.join(temp) mac = int(temp,2) random.seed(mac) randStr = str(random.random()*233) print(randStr)