lorun在沙箱环境中运行程序的核心技术
Loco程序运行器核心使用了这个python-c库,在类似沙箱的环境中运行程序。有了它,我们可以准确地知道程序的资源使用情况,并限制其资源使用,包括系统调用中断。
用法:
要在不跟踪的情况下运行程序:
runcfg = { 'args': ['./m'], 'fd_in': fin.fileno(), 'fd_out': ftemp.fileno(), 'timelimit': 1000, #in MS 'memorylimit': 20000, #in KB }
rst = lorun.run(runcfg)
检查输出:
ftemp = file('temp.out')
fout = file(out_path)
crst = lorun.check(fout.fileno(), ftemp.fileno())
下载地址
用户评论