31
3
Inspired by this comment...
Thanks to users Step Hen, Wheat-Wizard, and Dennis for helping my solidify the specification of this challenge before posting it!
This is the Robber's thread! For the Cops' thread, go here
In this challenge, you are tasked with running some code that makes it so that your language no longer satisfies our criteria of being a programming language. In that challenge, that means making it so that the language can no longer...
Take numerical input and output
Add two numbers together
Test if a certain number is a prime or not.
This is a cops-and-robbers challenge, where there are two different challenges with two different objectives: The Cops will try to write some code that makes the language mostly unusable, and the robbers will try to find the hidden workaround that allows the cops to recover their language.
The cops will write two snippets of code:
One that makes their language mostly unusable, e.g. by removing built in functions for taking input/output and numerical operations. This code is not allowed to crash or exit. It should be possible to add code to the end of this snippet, and that code will get evaluated. And
A snippet of code that takes two numbers as input, adds them together, and outputs their sum. This snippet must still correctly function even after running the first snippet. When the two snippets are combined together, they must form a full program that adds two numbers, or define a function that adds two numbers. This snippet will probably rely upon obscure behavior, and be hard to find.
The cops will also choose any standard method of input and output. However, they must reveal exactly which format (input and output) they are using. For you to crack their answer, you must follow the same input/output format, or your crack does not count.
A cops answer will always reveal
The first snippet (obviously not the second).
Language (including minor version, since most submissions will probably rely on strange edge-cases)
IO format, including whether it's a function or full program. Robbers must use the same format to be a valid crack.
Any strange edge cases required for their answer to work. For example, only runs on linux, or requires an Internet connection.
As a robber, you must look at one of the cops submissions, and attempt to crack it. You may crack it by writing any valid snippet that could work as snippet 2 (adding two numbers together after the language is made mostly unusable). This does not have to be the same snippet that the cop originally wrote. Once you have an answer cracked, post your code as an answer on this thread, and post a link to your answer as a comment on the cop's answer. Then, that post will be edited to indicate is has been cracked.
Here's an example. For the first snippet, you might see the following python 3 program as a cops answer:
Python 3
print=None
Takes input from STDIN and output to STDOUT
A valid second snippet could be
import sys
a,b=int(input()),int(input())
sys.stdout.write(a+b)
This is valid because it will take two numbers as input, and output their sum even if you join the two snippets together, e.g.
print=None
import sys
a,b=int(input()),int(input())
sys.stdout.write(a+b)
This is a valid crack to their answer.
If a cop's answer remains uncracked for one whole week, they may edit in their second snippet, and indicate that their answer is now safe. Once it is edited to be safe, you may no longer attempt to crack it. If they do not edit it as safe, you may continue to try to crack it until they do.
The winner of the robber's thread is the user who has cracked the most answers, with the tie-breaker being the time they reached N cracks. (so if two different users each have 5 cracks for example, the user who posted their 5th crack first is the winner) After sufficient time has passed, I will accept the winner's answer with the most votes.
Have fun!
Rule clarifications
The first snippet must run correctly without taking any input. It may output whatever you like, and this output will be ignored. As long as after the snippet is done, the second snippet runs correctly.
The second snippet must actually be executed for your answer to be valid. This means an answer like
import sys sys.exit()
is not valid because it doesn't break the language. It simply quits.
After being safe, your score is the byte count of both snippets.
This goes back to Please reveal any strange edge cases required for your answer to work... Your submission must contain enough information before being revealed to be reproducible after being revealed. This means that if your answer becomes safe, and then you edit in: Here's my answer. Oh ya, BTW this only works if you run it on Solaris, jokes on you! your answer is invalid and will be deleted and not considered eligible for winning.
The second snippet is allowed to crash after outputting the sum. As long as the output is still correct (for example, if you choose to output to STDERR, and then you get a bunch of crash information, this is invalid)
Leaderboard
Here is a list of every user with at least one crack, ordered by score and then name (alphabetical). If you submit a crack, please update your score accordingly.
#User #Score
Ilmari Karonen 8
Dennis 5
Olivier Grégoire 4
Sisyphus 3
Veedrac 3
Arnold Palmer 2
Bruce Forte 2
DJMcMayhem 2
Dom Hastings 2
ppperry 2
1bluston 1
2012rcampion 1
Ben 1
BlackCap 1
Christian Sievers 1
Cody Gray 1
HyperNeutrino 1
Joshua 1
Kaz 1
Mark 1
Mayube 1
Xnor 1
zbw 1
Nice job! I tried this, but couldn't find a
SecurityManager
that was in scope... You could also read fromSystem.in
at this point, though, because it's not closed yet. – zbw – 2017-07-20T21:12:38.597Sorry, this is a platform-dependant answer on two regards: both
– Olivier Grégoire – 2017-07-20T22:22:33.573sun.awt.SecurityManager
and"sun.awt.command"
are platform dependant and are not part of Java.Yep, cracked! :) The intended solution was to go through the
System.getProperties().get("blah")
(since I only blocked the access toSystem.getProperty
, notSystem.getProperties
), but this is good enough! Well done! – Olivier Grégoire – 2017-07-21T12:23:58.300