Anyone up for some *Nix Puzzle games?

General questions regarding Linux.

Moderators: Terry, FWLUG Administrator

Would you play this game?

Poll ended at Fri Feb 13, 2009 4:07 pm

Yes
1
33%
No
0
No votes
Regular expressions are the bane of my existence! Why do you hate me so?
2
67%
Whatever. I saw the word Beer and I'm in.
0
No votes
 
Total votes : 3

Anyone up for some *Nix Puzzle games?

Postby stack » Fri Jan 30, 2009 4:07 pm

So I have been trying to wrap my head around a bunch of regular expressions recently. Anyone who has to do this on a regular basis knows that this can be quite...well, lets put it this way it's best not to have the monitor within punching range and sharp objects on the desk are a big no-no. :lol:

Anyway, as I am getting more and more involved I am finding some are just fun to play with and some that are so complex and confusing that if they had been around back in the day in Boston they surely would have been burned at the stake for witchcraft. I am even finding a few that are absolutely works of art that I think should be hung in a museum (these expressions tell me "OK. Back away from the keyboard. Time to go outside." ).

I have been writing down a bunch that I think are fun and intriguing and I am thinking of starting a monthly game at the meetings. I will go through a short description of my game and if you guys are interested I will present the first puzzle this month.

So here is the game.
At 10:00am (meeting start time) I will present a message and/or a regular expression.
Message: Stack's Puggles!
Key: 's/g/z/g'

I will present 2 boxes/hats/piles/whatever (I will just say groups). The first is for the decrypted key, the command that matches the appropriate expression, and the explanation behind it. The second is just for the command that decrypts the message. People fill out what they think is the answer and place it into the proper location.

In this example group #1 would have peoples responses like:
Name: stack
Message: Stack's Puzzles!
Command used: sed
The expression searches (s/) the string for the letter g and replaces the matches with z for all instances (/g) of the matching letter.

The second would just have:
Name: stack
Message: Stack's Puzzles!
Command used: sed

After like 30 minutes (hour? don't want it to be too late for those who have to leave early but don't want it to be so early that those who are late can't play either) I randomly draw a name out of the first group. If they get it correct, they win! If not, I draw again.

So why the second group? Because some of the expressions I have dug out are not exactly easy. In fact some of them are downright hard to explain. However, while someone might not be able to explain it, there might be many people who know that the 'sed' command could be used (in this example). So if no one puts an answer in the first group (or the first group all get it wrong), then I draw a name from the second group. Whoever has the right answer there will win!

My thinking is that on the tough ones, the second group gives most people a decent chance to find an answer that decodes the message even if they don't understand why it works. So while they are at a disadvantage for not knowing, they still have a chance if no one else knows either. I am also OK with someone who knows that it is sed, putting their answer in the second group, then taking a wild guess for the first group (where they could be right). I am hoping this will encourage people to play and not discourage an attempt simply because they can't explain the entire expression.

Maybe to encourage people to play I will buy the winner a beer/coke/beverage o' choice (Within reason! No 100$ wines. :wink: ).

So, what do you guys think? Anyone willing to step up to the challenge? Or is this a bad idea? Suggestions/Questions/Flames on the rules?

~Stack~

[edit #1] fixed a grammar issue
[edit #2] I have also been posting a bunch of these to my AIM account as away messages when I find them. So for those of you who see/have my AIM account, I am not doing those ones over again. Anyway, I just stumbled across one that is also the same as the example here and that I have used before. So this is a much better example of the puzzle that I would post for those interested.
Message:
zpldgmpeqt dgkupvxzsy pzsexjked
kkwkvhzdod cadmngdzyq qbzruktde
fkojrcgdez vxtkhisgyk zydmoneyz

Key:
's/[^a-cefhilnor-uw ]//g'

If you can't guess the program.... :? seriously...
The expression should, at least part of the expression should, be evident from my post as well. But does everyone know what the expression inside the match does? This would be a prime example of the detail I would expect in the answers in the first group. Again, comments, questions, (relevant) flames welcome.
User avatar
stack
 
Posts: 268
Joined: Sat Jul 14, 2007 2:11 pm
Location: Fort Worth, Texas

Re: Anyone up for some *Nix Puzzle games?

Postby David Miller » Sat Jan 31, 2009 9:25 pm

yeah regexp's can drive you crazy.

Let me make sure I understand.

This really just boils down to an "explain the regexp" contest?

So with the example you gave I would just say something like, the regular expression matches a characters that are not in the class [a-cefhilnor-uw ] and removes them, effectively removing the letters dgjkmpqvxyz, which leaves behind the intended message.

Couldn't everyone be able to get the "decrypted" message? I don't really see the competition in that part of it. I also don't understand the business about naming which program you use as it doesn't really matter if I do the regexp in sed or in vi or with perl.
David Miller
 

Re: Anyone up for some *Nix Puzzle games?

Postby stack » Sun Feb 01, 2009 5:56 pm

David Miller wrote:This really just boils down to an "explain the regexp" contest?

Ummm...yeah.

David Miller wrote:So with the example you gave I would just say something like, the regular expression matches a characters that are not in the class [a-cefhilnor-uw ] and removes them, effectively removing the letters dgjkmpqvxyz, which leaves behind the intended message.

yup!

David Miller wrote:Couldn't everyone be able to get the "decrypted" message? I don't really see the competition in that part of it.

Possibly. From my perspective of the users in the group some would have an easier time then others. The example I gave was one of the easy ones to kick it off. The third* one I was planning on posting is quite the bear. I don't expect many to get it (though I would love to be proven wrong). I just have a feeling that the nature of regular expressions will lend it self to intriguing some people and educating others. I think that will spark some competition. I am just using the piles as a way to even out the chances for those who come in late (instead of doing a first person who posts the correct answer). Better ideas on how to do it?

David Miller wrote: I also don't understand the business about naming which program you use as it doesn't really matter if I do the regexp in sed or in vi or with perl.

Well in this example, you are correct. This could be easily 'brute forced' as I say in the message or could be used in a number of programs. I am almost certain that the third expression only has one program that will properly decrypt it. :twisted:

* Sed being the first expression used in the example.
The second being announced at the next meeting.
The third being the march meeting if people are still interested.
User avatar
stack
 
Posts: 268
Joined: Sat Jul 14, 2007 2:11 pm
Location: Fort Worth, Texas

Re: Anyone up for some *Nix Puzzle games?

Postby stack » Sat Feb 14, 2009 11:04 am

Jan 14th Meeting Puzzle!

OK, this tidbit is much older then most peoples Linux experience. There are countless warnings about this and recently I have been seeing it pop up again.
So I am going to do a bit of a security warning for the first puzzle.

So here it is:
Explain why this bit of code is so dangerous.
Code: Select all
:( :|:& );:


I will buy the winner a drink!

{EDIT] Don't post in the forum! I have a pad for the results. I will post the answer to the forum later.
Product Keys? Imaginary Property rights? Digital Restriction Management?
These things confuse me and I have no need for them for I run Debian Linux!
User avatar
stack
 
Posts: 268
Joined: Sat Jul 14, 2007 2:11 pm
Location: Fort Worth, Texas

Re: Anyone up for some *Nix Puzzle games?

Postby stack » Sat Feb 14, 2009 8:10 pm

OK. So now the answer!

The first : is interpreted as a function name that takes no parameters defined by the (). What the function does is enclosed by the { }. It calls itself twice and sends the call into the background with the &. The ; separates the end of the function from the rest of the code and the last : runs the function.

In short, it is an endless program that spawns 2 more of itself before exiting. Those children in turn create 2 more and so forth and so on.

As we discovered at the meeting, it completely drains the computer of resources until the computer completely freezes up.

So Beware of Running Code You Don't Understand!!
User avatar
stack
 
Posts: 268
Joined: Sat Jul 14, 2007 2:11 pm
Location: Fort Worth, Texas

Re: Anyone up for some *Nix Puzzle games?

Postby stack » Sat Mar 14, 2009 9:06 am

I know it is a little early, but...here we go. Here is the puzzle for March 14th meeting!
Get the correct answer, and win a free drink!

What program should sit on the other side of the | to decrypt the hidden message? Why does the program work?
Code: Select all
echo '[q]sa[ln0=aln100%Pln100/snlbx]sb103387847032718279467185768770snlbxq' |


Remember, there are two groups of answers I am looking for. The program and the description of why the program works. Even if you don't know why the program works, you can still win a shot at a free drink! Last month the only person to participate, won. Why not give him some competition this time ;)

[EDIT] one of these days I will learn to type...fixed a few misspellings.
Product Keys? Imaginary Property rights? Digital Restriction Management?
These things confuse me and I have no need for them for I run Debian Linux!
User avatar
stack
 
Posts: 268
Joined: Sat Jul 14, 2007 2:11 pm
Location: Fort Worth, Texas

Re: Anyone up for some *Nix Puzzle games?

Postby stack » Mon Mar 16, 2009 1:16 pm

No one took me up on the puzzle!
So I will buy the the first poster to answer with the decoded message a drink at the next meeting. If no one has answered by the start of the meeting, I will post the answer.
Product Keys? Imaginary Property rights? Digital Restriction Management?
These things confuse me and I have no need for them for I run Debian Linux!
User avatar
stack
 
Posts: 268
Joined: Sat Jul 14, 2007 2:11 pm
Location: Fort Worth, Texas

Re: Anyone up for some *Nix Puzzle games?

Postby Davemon » Tue Mar 17, 2009 3:02 pm

These puzzles make my head hurt.





Davemon
User avatar
Davemon
 
Posts: 247
Joined: Sat Feb 10, 2007 2:42 pm

Re: Anyone up for some *Nix Puzzle games?

Postby stack » Sat Apr 11, 2009 10:31 am

The answer to the puzzle!

Code: Select all
$ echo '[q]sa[ln0=aln100%Pln100/snlbx]sb103387847032718279467185768770snlbxq' | dc
FWLUG.ORG FTW!
Product Keys? Imaginary Property rights? Digital Restriction Management?
These things confuse me and I have no need for them for I run Debian Linux!
User avatar
stack
 
Posts: 268
Joined: Sat Jul 14, 2007 2:11 pm
Location: Fort Worth, Texas


Return to FWLUG General Discussions

Who is online

Users browsing this forum: No registered users and 45 guests