Hak5
Save 10% at GoDaddy.com with coupon code HAK

Episode 1x05

From Hak5

Jump to: navigation, search

Synopsis

In this episode of Hak5 Wess finishes up his sub-$100 mini arcade cabinet, Darren talks streaming audio and video, Jon dives into AJAX, and Harrison plays with Metasploit. Plus the Microshaft Jackhammer 5160, special guest star Frank Linhares, guest intro by Mike Lazazzera, music by Ashley Witt, and a not-so-friendly server.

MOD: Arcade Cabinet for under $100 (US)

Components:

  • Celeron 400 Passive Cooling
  • Rage 128 Pro Integrated
  • IBM 7GB HDD
  • USB Hub
  • 90Watt Power Supply

Materials:

  • 4' x 8' sheet of MDF
  • hinges (design of your choice)
  • latch (design of your choice)
  • box
  • wood screws
  • sheet plexiglass (cut to size)
  • 'L' brackets

Tools:

  • Rotary tool
  • Power saw
  • Screw gun/drill
  • Pencil/writing untencil
  • Hole saw (1 1/8")

The plan (Bitmap and DWG) Mame 32 Download (Windows) Mame on Linux

Streaming Audio

Streaming Video

Jon Dives into AJAX

Ensure you are running this through a web server such as Apache.

Sample1.xml

<?xml version="1.0" encoding="iso-8859-1"?>
<root>
No
</root>

index.html

<html>
<head>
<title>Ajax Testing</title>
</head>
<script language="javascript">

   //Set default http_request to false for initiation
   var http_request = false;

   function request(url)
   {
      http_request = false;
      
      // Mozilla, Safari, Opera and all other browsers use this request
      if (window.XMLHttpRequest)
      {
         http_request = new XMLHttpRequest();
         /*
         NOTE:
            Some versions of the mozilla browsers won't work if the response from the **Missing comment**
            In order to fix this, we can use an extra function to override the header **missin comment**
         */
         if (http_request.overrideMimeType)
         {
            http_request.overrideMimeType('text/xml');
         }
      }//Only IE uses this, NOTE: Active X Object
      else if (window.ActiveXObject)
      {
         try
         {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         }
         catch (e)
         {
            try
            {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {}
         }
      }
      //if still false, then XMLHTTP instance is not created
      if (!http_request)
      {
         alert('Cannot create an XMLHTTP instance');
         return false;
      }

      http_request.onreadystatechange = readyState;
      http_request.open('GET', url, true);
      http_request.send(null);
   }

   function readyState()
   {
      //Displaying all http_request.readyState
      if(http_request.readyState == 1)
      {
         alert("1 (loading)");
      }
      if(http_request.readyState == 2)
      {
         alert("2 (loaded)");
      }
      if(http_request.readyState == 3)
      {
         alert("3 (interactive)");
      }
      if(http_request.readyState == 4)
      {
         if (http_request.status == 200)
         {
            var xmldoc = http_request.responseXML;
            var root_node = xmldoc.getElementsByTagName('root').item(0);
            alert(root_node.firstChild.data);
         }
         else
         {
            alert('Error with request');
         }
      }
   }
</script>
<body>
<table width="200" border="0" align="center">
<tr><td>
<span style="text-decoration: underline" onClick="request('sample1.xml')">Request XML</span>
</td></tr>
</table>
</body>
</html>