Advertisement
metalx1000

Android Poor Man's VNC

May 5th, 2016
657
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #on phone:
  2. while [ 1 ];do screencap -p 1.png;mv 1.png 2.png;done
  3.  
  4. #while running that also startup httpd
  5. busybox httpd -v -p 9999
  6.  
  7. #client code
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
  12. <script>
  13.   var url = "http://192.168.1.101:9999/2.png";
  14.  
  15.   $(document).ready(function(){
  16.     //setInterval(loadimg,500);
  17.     loadimg();
  18.   });
  19.  
  20.  
  21.   function loadimg(){
  22.     var stamp = new Date().getTime();
  23.     var image = new Image();
  24.     image.onload = function () {
  25.       //console.info("Image loaded:" + cam + "!");
  26.       $("body").html(image);
  27.       setTimeout(loadimg,1000);
  28.     }
  29.     image.onerror = function () {
  30.       console.error("Cannot load image");
  31.       setTimeout(loadimg,1000);
  32.     }
  33.  
  34.     image.src = url + "?count=" + stamp;
  35.   }
  36. </script>
  37. </head>
  38. <body>
  39.   <img id="screen">
  40. </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement