http://www.mapquest.com/cgi-bin/mqtrip?link=btwn%2Ftwn-ddir_na_basic_form_latw_jp
&uid=uu9c09rws4o7iave%3Ab09wblg08&ADDR_ORIGIN=123+some+st&CITY_ORIGIN=somewhere
&STATE_ORIGIN=xx&ZO=43227&OCC=US&ADDR_DESTINATION=1313+mockingbird+ln
&CITY_DESTINATION=anywhere&STATE_DESTINATION=xx&ZD=12345-6789&DCC=US
&dir=Get+Directions&POIRad=2.0
Ick. Lots of stuff, but this provides useful information about what's going on at
the other side. The /cgi-bin/ (along with the mqtrip? section) clues us into this
being a CGI script. Here's where knowing a little Perl comes in handy. Each & is
actually the beginning of a variable processed by the script. If we change the
values of some of the variables, we can get some interesting effects.
Let's look at the URL a little differently.
http://www.mapquest.com/cgi-bin/mqtrip? link=btwn%2Ftwn-ddir_na_basic_form_latw_jp &uid=uu9c09rws4o7iave%3Ab09wblg08 &ADDR_ORIGIN=123+some+st &CITY_ORIGIN=somewhere &STATE_ORIGIN=xx &ZO=54321 &OCC=US &ADDR_DESTINATION=1313+mockingbird+ln &CITY_DESTINATION=anywhere &STATE_DESTINATION=xx &ZD=12345-6789 &DCC=US &dir=Get+Directions&POIRad=2.0Now it starts to make sense...Playing around a little with a URL after we've done a search, and we get much, much more than this:
link=btwn%2Ftwn-ddir_options_jumppage&avoid_mj_hwy=&avoid_mn_hwy=&avoid_thruways=
&avoid_local=&avoid_frontage=&avoid_ramps=&avoid_allfire=&avoid_ferry=
&avoid_walk=&avoid_lmTD_access=&avoid_toll_roads=&route_type=&ADDR_ORIGIN=
123+some+st&CITY_ORIGIN=somewhere&STATE_ORIGIN=xx&ADDR_DESTINATION=1313+mockingbird+
ln&CITY_DESTINATION=anywhere&STATE_DESTINATION=xx&quest_mode=&results_display_mode=
overview&OPC=&OPL=&DPC=&DPL=&OSAL=&OCAL=&DSAL=&DCAL=&ZO=12345&ZD=12345
&OCC=US&DCC=US&OLL=&DLL=&ORIGIN_NAME=&DEST_NAME=&ORIGIN_STREET_AMBIG_LIST=
&ORIGIN_CITY_AMBIG_LIST=&DEST_STREET_AMBIG_LIST=&DEST_CITY_AMBIG_LIST=&uid=
uu9c09rws4o7iave%3Ab09wblg08&POIRad=2.0&LangOpt=&AB_LABELS=&OAB=&DAB=&MPOICAT1=
&MPOICAT2=&MPOICAT3=&MPOICAT4=&MPOICAT5=&MPOICAT6=
&MPOICAT7=&MPOICAT8=&MPOICAT9=&MPOICAT10=&MPOICAT11=&MPOICAT12=&MPOICAT13=&MPOICAT14=
&MPOICAT15=&MPOICAT16=&MPOICAT17=&MPOICAT18=&MPOICAT19=&MPOICAT20=&MPOICAT21=&MPOICAT22=
&MPOICAT23=&MPOICAT24=&MPOICAT25=&MPOICAT26=&MPOICAT27=&MPOICAT28=&MPOICAT29=&MPOICAT30=
&MPOICAT31=&MPOICAT32=&MPOICAT33=&MPOICAT34=&MPOICAT35=&MPOICAT36=&MPOICAT37=&MPOICAT38=
&MPOICAT39=&MPOICAT40=&MPOICAT41=&MPOICAT42=&MPOICAT43=&MPOICAT44=&MPOICAT45=&MPOICAT46=
&MPOICAT47=&printer.x=77&printer.y=4
It makes sense that a "big" company (compared to us peons) uses big complex CGIs, but this
is absurd. If you look closely at the above listing, there's a lot of
&something=&somethingelse= stuff. These are vars which aren't assigned a value. *Stuff to
play with* Now that we have some things to figure out how they work and what
they do. *evil grin*
CGI scripts, unless done _very_ carefully, tend to give the smarter-than-the-average-user
more info than they bargain for. If one simply goes to the Driving Directions page and looks
at the source (ugly as it is), there are some useful clues and outright answers to our
questions. If we search for all this MPOICAT jazz, we find this (names changed to protect the
guilty):
< INPUT type="checkbox" name="MPOICAT9" value="11158">< IMG
/loadimage?http://mqgraphics.mapquest.com/gif/mb-button-lennys2.gif" width=72 height=15
border=0 alt="Lenny's Restaurant">
Lovely. An ad. Well, we know that all that stuff is junk for our purposes - a lean method
for getting directions. Other tags are blatantly obvious (STATE_DESTINATION, etc.), so let's
pick the real juicy one: the printer friendly page.
. -more code here- . mqgraphics.mapquest.com/gif/printer.gif . -more code here- .This doesn't look like anything useful, but sniffing around it gives us this:
FORM method=get action="/cgi-bin/mqtrip" INPUT type=hidden name=link value=btwn/twn-ddir_options_jumppage ! Opening ../../html/bglobal/ddir-route_form.html INPUT TYPE=HIDDEN NAME="avoid_mj_hwy" VALUE=""Interesting... the link= value changes - we change CGI scripts! A nugget of VERY useful information. If we came up with a form that, say, never requested anything but this form, we would have something wouldn't we?