11
\$\begingroup\$

This is the robbers' thread for 'Almost Illegal Strings'.

See the cop's thread for information on participating. A section from the post is included here for convenience.

The Robbers' Challenge

Find an uncracked answer. Write a program in the language specified that contains as a contiguous substring the almost illegal string specified and does not error. Your program may not use any character in the set of banned characters, unless it is part of the almost illegal string. Your program does not need to be exactly what the cop had in mind. Post an answer to the robber's thread and leave a comment on the cops' answer to crack it.

\$\endgroup\$
0

25 Answers 25

11
\$\begingroup\$

Python 2, 7 bytes, cracks xnor's post

0xbin()

Try it online!

The answer is easy to understand if syntax highlighting for above snippet works correctly.

So bad. The syntax highlighting did work correctly. But SO changed their render library... Anyway, above code is:

0xb in ()
\$\endgroup\$
1
  • 5
    \$\begingroup\$ The syntax highlighting is working correctly :D \$\endgroup\$
    – Bubbler
    Nov 6 '20 at 2:31
7
\$\begingroup\$

R, cracks Robin Ryder's challenge

try(x %'"% y,T)

Try it online!

The 'almost illegal' string we're trying to use is '".

try attempts to run the code contained in its first argument. The second argument, silent (not explicitly named here) is set to TRUE to prevent output if the result is an error.

The first argument here attempts to apply the (nonexistant) %'"% function to (nonexistant) variables x and y.
The %...% notation - known as SPECIAL in R - allows us to incorporate characters that are usually forbidden for variables and function names, like '" in this case.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Very nice; I had looked at %'"% before (remembering the original illegal string challenge) but didn't try it :-) \$\endgroup\$
    – Giuseppe
    Nov 14 '20 at 1:35
6
\$\begingroup\$

Haskell, doge doge's answer, 26 bytes

main=print()where{3
#""=3}

Try it online!

The idea here is that within a {} block whitespace rules are weakened a good deal. With that we can turn #" into the declaration of an infix function and write the rest of our program with no issues. From there we use where attached to our main function to start the block.

I don't really know why these blocks have weaker rules. I am just learning about this now as well. But for some reason I had a suspicion it might work and it does.

\$\endgroup\$
5
\$\begingroup\$

Jelly, 6 bytes, cracks caird coinheringaahing's

“

«{”

Try it online!

EDIT

I actually don't know why this works lmao

\$\endgroup\$
4
\$\begingroup\$

Jelly, 6 bytes, cracks caird coinheringaahing's



«{0¡

Try it online!

Instead of string literal weirdness, this uses the fact that arity mismatches don't cause errors until things are actually evaluated--{ doesn't try to turn a monad into a dyad so much as it calls a Python lambda assumed to have one argument from a Python lambda with two arguments, and repeats it zero times.

\$\endgroup\$
3
\$\begingroup\$

Julia, 12 bytes, cracks @binarycat's answer

`\?""":"`

Try it online!

Backticks in Julia delimit shell commands, as in Perl or Ruby. But unlike Perl or Ruby, the command isn't actually executed; rather, a Cmd object representing the command is created. Hence it doesn't matter that \?""":" isn't a valid shell command.

\$\endgroup\$
1
  • \$\begingroup\$ Nice! This is actually really close to my intended solution, which was to write a custom command macro, but apparently you can just put a backslash in front, probably should have tried that. \$\endgroup\$
    – binarycat
    Nov 15 '20 at 15:22
3
\$\begingroup\$

Python 3, cracks qwatry's challenge

Illegal text: int(A,B,C), with all ASCII but ~+2() and newlines banned.

𝔢𝔵𝔢𝔠(𝔠𝔥𝔯(22+22+22+~2+2)+𝔠𝔥𝔯(22+22+22+~2+2+~2+~2+2)+𝔠𝔥𝔯(22+22+22)+𝔠𝔥𝔯(22+22+22+~2+2+~2+~2+2)+𝔠𝔥𝔯(22+22+22+2+2+~2)+𝔠𝔥𝔯(22+22+22+~2+2+~2+~2+2)+𝔠𝔥𝔯(22+22+2+2))
𝔭𝔯int(A,B,C)

Try it online!

Python 3 normalizes Unicode identifiers, so "𝔣𝔞𝔫𝔠𝔶 𝔲𝔫𝔦𝔠𝔬𝔡𝔢" is turned into "fancy unicode".

This turns it into

exec(chr(22+22+22+~2+2)+chr(22+22+22+~2+2+~2+~2+2)+chr(22+22+22)+chr(22+22+22+~2+2+~2+~2+2)+chr(22+22+22+2+2+~2)+chr(22+22+22+~2+2+~2+~2+2)+chr(22+22+2+2))
print(A,B,C)

And when we expand the chr statements, we get 'A=B=C=0':

exec('A=B=C=0')
print(A,B,C)

And you can figure it out from there.

I would love to say I discovered it, but nah. This isn't the first time normalization memes have been posted here.

Also, I brute forced the ASCII arithmetic instead of calculating it, so it is not optimized. 😂

\$\endgroup\$
2
\$\begingroup\$

Ruby, 21 bytes, cracks @dogedoge's first answer

%q(=end
#{"""'}
=end)

Try it online!

Wraps the almost illegal string in a single-quoted string (which doesn't allow interpolation).


Ruby, 23 bytes, cracks @dogedoge's first and second answers

/#{'}=end
#{"""'}
=end/

Try it online!

Here's an alternative that doesn't use % (in response to a comment). This time we wrap in a regexp, interpolating a single quote to close the """' sequence that occurs later.


Ruby, 28 bytes, cracks @dogedoge's third answer

<<S
#{'}=end
#{/"""'}
=end
S

Try it online!

Now the wrapper is a here doc. This approach also works for the first two cops (which don't include the /).

\$\endgroup\$
2
  • \$\begingroup\$ Nice! but can you do it without %? \$\endgroup\$
    – binarycat
    Nov 6 '20 at 23:52
  • \$\begingroup\$ @dogedoge Yep :) \$\endgroup\$
    – Dingus
    Nov 7 '20 at 0:18
2
\$\begingroup\$

Julia, 12 bytes, cracks @dogedoge's answer

"""?"""::Any

Try it online!

Define a (triple-quoted) string and assert it to be of type Any (String also works).

\$\endgroup\$
2
\$\begingroup\$

Desmos, 5 bytes, cracks Aiden Chow's answer


\{\}
\$\endgroup\$
3
  • \$\begingroup\$ Yes the second one is the intended answer. \$\endgroup\$
    – Aiden Chow
    Nov 10 '20 at 1:47
  • \$\begingroup\$ The first one uses alphanumeric characters so it's not a valid answer. \$\endgroup\$
    – Aiden Chow
    Nov 10 '20 at 1:50
  • \$\begingroup\$ @AidenChow Ok, I removed it. \$\endgroup\$
    – PkmnQ
    Nov 10 '20 at 1:55
2
\$\begingroup\$

Python 3, cracks qwatry's revised answer

x: 1=2

Try it online!

or

x: 1+1=2

Try it online!

(not entirely sure which it's supposed to be but it works either way).

I completely forgot how flexible type hints are until I cheated searched the grammar for the = character.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Yep, that's the essentially solution the solution I had! \$\endgroup\$
    – qwatry
    Feb 22 at 17:05
2
\$\begingroup\$

Desmos, to crack HitchHacker's cop

There is in fact a way to crack this answer without using notes. Type the closing parenthesis ) after the expression, then go back one character and type the closing bracket ]. The result, sort(3,2]), should be interpreted as sort([3,2]).

enter image description here

\$\endgroup\$
1
2
\$\begingroup\$

JavaScript, cracks Etheryte's answer

void$=Array();console.log(...void$)

Try it online!

This seems way too easy... Uses spread syntax ...expression to use the elements of void$ (initialized to Array(), an empty array []) as separate arguments to console.log. Since it's empty, it uses no arguments, which is perfectly valid as well; it just calls console.log().

\$\endgroup\$
2
\$\begingroup\$

JavaScript, cracks Etheryte's revised answer

eval(...void 0||Array())

Try it online!

\$\endgroup\$
2
\$\begingroup\$

Desmos, cracks HitchHacker's answer

\sort(3,2

Desmos programs are normally scored based on the text pasted into the textbox. Pasting in invalid-formatted text simply does nothing, which doesn't meet the error criteria of showing a "danger sign" laid out by HitchHacker. The easiest way to do this is by using a \ before sort. Desmos doesn't recognize "sort" as an escapable sequence like \left or \operatorname or even \sin so it simply ignores the whole program.

\$\endgroup\$
1
  • \$\begingroup\$ I wonder if there is another copy-pasteable solution that doesn't silently error? Currently looking for one. \$\endgroup\$
    – Cloudy7
    Mar 18 at 3:19
2
\$\begingroup\$

Python 3, cracks Makonede's answer

Code contains unprintable characters, so is provided as a hexdump:

00000000: 2300 0400 040a 3f22 2222 3f27 2727 3f    #.....?"""?'''?

Derived from feersum's comment on an identical Python answer to the original find an illegal string challenge. I made it slightly shorter and adjusted it to the banned characters in this challenge, but have no idea how or why this works.

Try it online!

\$\endgroup\$
0
1
\$\begingroup\$

Desmos, cracks HitchHacker answer

The solution is in the answer, note is the key: instead of evaluating it as an expression the illegal string is put in a note ¯\_(ツ)_/¯

enter image description here

\$\endgroup\$
2
  • \$\begingroup\$ Technically, the answer would be "sort(3,2. \$\endgroup\$
    – Makonede
    Feb 17 at 20:49
  • \$\begingroup\$ Dang it i just came up with this then found ur answer lol \$\endgroup\$
    – Seth
    Feb 22 at 19:36
1
\$\begingroup\$

Rust -Z unstable-options --pretty normal, cracks @Deadbeef's answer

const x:! =1;

Not sure if this is the intended interpretation of "you may pass any flags to rustc if you like." or a loophole.

I could just do --help but this one actually parses the file and needs a sorta valid Rust program.

Specifically, the --pretty option on Nightly will just format the code instead of compiling it.

\$\endgroup\$
0
1
\$\begingroup\$

Python 3, cracks Makonede's challenge


raiser=3

Try it online!

Should've banned =...

\$\endgroup\$
1
\$\begingroup\$

Python 3, cracks Makonede's second challenge


raiseTABSystemExit

Try it online!

I am sure this is another unintended loophole…

\$\endgroup\$
2
  • \$\begingroup\$ sigh... this sucks \$\endgroup\$
    – Makonede
    Feb 18 at 18:47
  • \$\begingroup\$ oops deny that edit please i didn't know SE converts tabs to spaces lol \$\endgroup\$
    – Makonede
    Feb 18 at 18:51
1
\$\begingroup\$

Python 3, cracks Makonede's revised second challenge


raiser:str

Try it online!

Uses a type annotation. I think this is the actual solution you meant. 😏

\$\endgroup\$
1
  • \$\begingroup\$ Nope. Not quite. \$\endgroup\$
    – Makonede
    Feb 18 at 21:13
1
\$\begingroup\$

Python 3, cracks qwatry's answer

foo1=2

Try it online!

The string to crack is 1=2.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Not exactly the intended solution. Can't believe I missed this... I'll probably edit my answer a bit to avoid this loophole. LOL \$\endgroup\$
    – qwatry
    Feb 22 at 15:14
1
\$\begingroup\$

Zsh, cracks pxeger's post, cracked after being safe.

Did I get the rules correctly?

a=1;: " 
#include <cstdlib> 
#include <iostream> 
 
int main() { 
    srand(time(NULL)); 
    hello(); 
    return rand() % 2; 
} 
 
/* 
  main 
  a=0 
  \ 
  print "$((1/$a))" 
*/ 
 
void hello() std::cout << "Hello, World!" << std::endl; 
 "

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Vim, 6 bytes, cracks Aaron Miller's

<C-w>n<Esc><Esc>ZQ

What it does

  • Make a new window first.
  • Close it by last four keys.

Vim, 5 bytes, cracks Aaron Miller's

<C-w>n<Esc>ZQ

Same as above.

\$\endgroup\$
1
\$\begingroup\$

Vyxal, 16 bytes, Cracks A Username's answer

Q
«Wi«»Wi»`Wi`Wi

Try it Online!

Ez. Just quit before you get to the unavoidable stuff.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.