pwn2winctf / pte Goto Github PK
View Code? Open in Web Editor NEWPlatform Test Edition
Home Page: https://game.pwn2win.party/PTE
Platform Test Edition
Home Page: https://game.pwn2win.party/PTE
Currently, the setup instruction says this:
Please make sure you are using an Unicode locale, e.g.
export LC_ALL=en_US.UTF-8
Changing the default encoding could possibly break third party code, as described at Why sys.setdefaultencoding() will break code (at (1) Write once, change everything).
I suppose that's not a big issue in this project. Anyway, the consensus seems to be that we should explicitly convert input and output to/from unicode, always manipulating unicode inside our code, and always checking UnicodeEncodeError.
Just for reference, the env var PYTHONIOENCODING controls the encoding used by std{in,out,err}, so we don't need to use LC_ALL if we just want to set the stds' encoding.
So an alternative to the current setup, would be renaming ctf
to something like ctf.py
, and make ctf
a bash script calling something like: PYTHONIOENCODING=UTF-8 ./ctf.py "$@"
.
If we want to change the enconding inside the code, we could do the following (reference: Encoding of Python stdout):
if sys.stdout.encoding != 'UTF-8':
if PY2:
sys.stdout = codecs.getwriter('utf-8')(sys.stdout, 'strict')
else:
sys.stdout = codecs.getwriter('utf-8')(sys.stdout.buffer, 'strict')
Apparently the writer returned does not have the endline buffering like the default stdout (not tested), but this should be irrelevant. Everything else works as expected.
I'm not sure if exporting LC_ALL makes the terminal more likely to display unicode, if supported. Gnome-terminal seems to not allow pasting unicode symbols if LC_ALL=C, although it still displays them when printed from python code.
If we want to support Windows, we may need even more setup, changing even the default font of cmd. I've got some reference links if you want.
Hello,
Nice work with NIZKCTF. In my understanding, the scheme that uses digital signatures for proving the knowledge of sk_c
and sk_t
can be used in other cases too (except organizing CTFs). Since you are more familiar with the protocol, are there any use-cases that you can think of? Also, are there any examples on how to use the code?
Thanks in advance,
Dimitris Mouris
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.