最近突发奇想,想对所掌握的python知识进行总结一下,目前其实还停留在python层面如何使用,还没有深入到虚拟机部分,如果下面有哪些错误,欢迎指出。
OJ(Online judge, 在线编程测评提交代码到后台运行检查)网站一般都允许各种各样的代码提交,其中很有可能包含python3,于是决定尝试通过python3的代码执行,进行沙箱逃逸,以及绕过各种限制。
我随便找了一个OJ网站,这个站点的python3有如下限制
| //go:cgo_import_dynamic libc_res_search res_search "/usr/lib/libSystem.B.dylib" |
Install OpenCV 4.1.2 on Raspbian Buster
$ chmod +x *.sh
$ ./download-opencv.sh
$ ./install-deps.sh
$ ./build-opencv.sh
$ cd ~/opencv/opencv-4.1.2/build
$ sudo make install| PseudoRandomDistribution = {} | |
| PseudoRandomDistribution.__index = PseudoRandomDistribution | |
| function PseudoRandomDistribution:New(nChance) | |
| local obj = { | |
| counter = 0, | |
| chance = nChance, | |
| const = self:CalculateConstant(nChance) | |
| } | |
| setmetatable(obj,self) |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.
You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.
| #This is psudocode, but should be an okay example... | |
| # Step 1: require rails' environment | |
| require 'path/to/config/environment' | |
| # Step 2: add rails app to cascade: | |
| run Rack::Cascade.new([ | |
| rack_app1, | |
| MyRailsApp::Application, # Place rails in the cascade where you need it |