prey / prey-bash-client

DEPRECATED - Project no longer supported, please consider using https://github.com/prey/prey-node-client instead
GNU General Public License v3.0
868 stars 135 forks source link

Prey fails to send report when maps.googleapis.com returns an error #395

Closed christianberg closed 5 years ago

christianberg commented 11 years ago

Prey didn't send any reports during my first test on my MacBook (Mac OS X 10.8). I discovered this was due to an error being returned by the Google Maps API. The API gave the following response:

<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 414 (Request-URI Too Large)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:u
rl(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){
body{background:none;margin-top:0;max-width:none;padding-right:0}}
  </style>
  <a href=//www.google.com/><img src=//www.google.com/images/errors/logo_sm.gif alt=Google></a>
  <p><b>414.</b> <ins>That’s an error.</ins>
  <p>The requested URL <code>/maps/api/browserlocation/json</code>... is too large to process.  <ins>That’s all we know.</ins>

Prey attempts to parse the geo-location from this, causing some variables to be set incorrectly. Excerpt:

trace_list='\n -F geo[lat]=<%21DOCTYPE\n -F geo[lng]=<%21DOCTYPE\n -F geo[accuracy]=<%21DOCTYPE\n

This ultimately leads to the following error when the sending of the report is attempted:

 -- The response we got was:

HTTP/1.1 404 Not Found
Content-Type: application/xml
X-Proxied: true
Connection: keep-alive
Transfer-Encoding: chunked

curl: (26) couldn't open file "%21DOCTYPE"

It would be great if the report was sent even when the maps API returns an error. I'll open a separate issue for the cause of the API error.

MagerValp commented 11 years ago

https://github.com/prey/prey-bash-client-modules/pull/12