Lab 7a - Saving the world from EVIL


Due Date: Wed 7 Apr 2010 by 23:59


Justin Carlson


Background

Disaster!

It happened late last Wednesday. You were working on your final project for the class 15-913 (Special Topics: Independent study in gratuitously unethical technologies) You had just squashed your final bug in a program which would cause all computers in the world to simultaneously become self-aware and attempt to kill their users.

Of course, you had written this program just to prove it could be done, and had no intention of showing it to anyone (except to your professor, who expressed doubt in your ability to create such a program, the witless fool). You left yourself logged in for 5 minutes while you went to get some coffee. When you came back, you found your desk slightly disturbed. You typed history at your terminal and came across this:

  487  scp -r 15913_final_project unix7.evilcorp.com:/home/bovik/muhahaha

That sneaky, low-down dirt bag Harry Bovik stole your code! Harry interned last summer at Electronic Virtual Idea Lab, apparently he took advantage of your coffee break to send your program to his account on EVILcorp's servers. You are sure the company will use it to blackmail the world governments for untold sums of money.

Robot picture
A server robot1

Luckily, the Office of Professional Development arranged a tour of EVILcorp a month ago, and while there, you took lots of pictures. EVILcorp stores data in highly automated server rooms. Each server room has three mobile robots in it, which are responsible for maintaining the systems storing the company data.

You are sure the data is stored in one of those server rooms. E.V.I.L. stores 9 redundant copies of all of its data, but has not yet implemented off-site backups. In short, if you can erase the data from the server room, you're sure they won't be able to find another copy, and you'll save the world (and your final grade in 15-913).

To erase the data, you'll need to take over control of one or more of the robots. More on that later.

The Mole

Fortunately, you have a contact, "Mr. X". on the inside of EVIL. Mr. X maintains a innocent looking webserver, which can be found here. The webserver serves up pages which seem to be filled with nonsensical text: Mr. X claims the webserver is a part of hobby: he likes to experiment with random communications. However, steganographically hidden in the content of the webserver is the information you need to take over the facility robots and delete the stolen files.

When connected to, the webserver serves up a simple page with random words. Most of these words are exactly what they seem, but some are not. Some words are special, and hide information that you must extract. Some words have unusual capitalization: they have a lowercase first letter but one or more uppercase letters inside the word. So, for example, BAR, Bar, and bar are not words, but bAr is a special word. These words are number words: the hidden number is the number of letters in the word minus one. Continuing in the previous example, the word bAr would represent the number 2. Words may be separated by spaces, punctuation, or any non-letter character.

Furthermore, the word "space" is a delimiter word regardless of how it is capitalized.

When extracted from the webserver, the values of number words are added until a delimiter word or the end of the file is encountered. The sum of the number words is one of the numbers in the hidden message.

For example, take a look at this text. The special words are in red.

Either tHe well deeP, space or she fell Very slOWLy, for she hAd

        |        |      |                       |             | 
2 + 3 delimiter 5 + 2

The hidden numbers in this message are the numbers 5 and 7.

The numbers Mr. X hides in his webserver represent the following things in the following order:

  1. A four-number access code needed to remotely access the robot control server
  2. The width and height of the server room
  3. 3 robots, each of which has an X, Y, and Direction number. The X and Y numbers are cartesian coordinates, while the Direction should be interpreted as follows:
    • 1 means the robot is facing in the positive X direction (right)
    • 2 means the robot is facing in the negative Y direction (up)
    • 3 means the robot is facing in the negative X direction (left)
    • 4 means the robot is facing in the positive Y direction (down)
  4. The X and Y coordinates of the disks containing copies of your program
  5. The X and Y coordinates of all obstacles in the room

You should assume that the outer edge of the room is surrounded by a wall.

For example, consider the following message from Mr X. (Comments have been added for clarity:

19 205 91 7
10 11
8 4 2
6 5 1
2 9 1
3 1
2 3
3 3
1 4
1 5
2 5
2 6
1 8
7 9
4 1
2 2
4 2
5 2
4 4
5 4
8 5
5 6
6 6
1 7
8 7
3 8
4 8
6 8
1 9
4 9
5 9
# Access code
# Server room width and height
# Robot position 1
# ...
# Robot position 3
# File Location 1
# .
# .
# .
# .
# .
# .
# .
# File Location 9
# First Obstacle Location
# .
# .
# .
# .
# .
# .
# .
# .
# .
# .
# .
# .
# .
# .
# .
# Last Obstacle Location

This would correspond to the following floor plan:

  0123456789
 0##########
 1#  F#    #
 2# # ##   #
 3# FF     #
 4#F  ##  ^#
 5#FF   > ##
 6# F  ##  #
 7##      ##
 8#F ## #  #
 9##> ## F #
10##########

Where #'s represent walls and obstacles, arrows show the locations and orientations of the robots, and the F's show the locations of the file in the server room. The digits around the edge are there to help show row and column numbering.

As an ace perl programmer, we are sure you will have no trouble grabbing Mr. X's message and extracting the information we need to finish the mission.

The planner

Once you have revealed the information from Mr. X, you'll need to create a plan for data erasure. Erasing the data is going to involve directing one or more robots to each of the places your program is stored so they can remove and destroy the relevant disks.

Your interface into EVILcorp's servers is in the form of a java library. Because run-time speed of your planner is not of paramount concern, your planner can (read: must) be written in java as well.

In this portion of the lab, your planner must take the uncovered message from Mr. X and do two things:

  1. Print out a text representation of the layout of the server room, as shown above
  2. Create and print a series of robot commands (a plan) which will result in erasure of your program from the server.

The commands you can give the robots should be printed in the following form:

For example - The robot at (7,4) can erase the file at (6,3) by given the commands: L3 M3 R3 M3 E3

Commands should be separated by whitespace (or newlines). A correct plan will result in all of your data files being erased, no extra files being erased, and no collisions between the robot and the environment.

Note that robots are smart enough not to collide with other robots; for the purpose of the plan, you may assume that robots effectively pass through each other.

A simple plan would involve just moving one robot to each of the data-points in turn and ignoring the other two robots. However, this is a slow process, and when EVILcorp notices that data is disappearing, they will certainly send someone to investigate. To increase your probability of success, it would be better to use all three robots simultaneously to finish the task as quickly as possible.

The Control Script

Finally, we need a shell script to take care of invoking the perl script and then starting the java program to generate the plan. Running the shell script should result in a smooth process of fetching the web page, extracting the data, and generating the plan and map.

Next time

In next weeks' lab, we will install a trojan on EVILcorp's servers which will let us execute our plan and delete the files!

Hand in your Solution

Using the same process as previous labs, copy your Perl(.pl), Java(.java), Shell Script and Design Document to the handin directory: ~yeng/15123-handin/andrew_id/L7a/.

Early submission is Tuesday midnight (+10% bonus), Wednesday midnight is on time, Thursday midnight is the end of the late period (-10% bonus).


References:

1 Image from http://www.flickr.com/photos/firepile/ / CC BY 2.0