Advertisement
overloop

nmap.php

Nov 6th, 2013
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4. if (isset($_POST['ip'])) {
  5.     $ip = $_POST['ip'];
  6.     $q = "nmap " . escapeshellarg($ip);
  7.     $outp = [];
  8.     exec($q,$outp);
  9.     echo implode("<br/>",$outp);
  10. } else {
  11.     page();
  12. }
  13.  
  14. function page() {
  15. ?>
  16. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  17. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  18. <head>
  19.     <title>nmap</title>
  20.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  21.     <meta name="description" content="" />
  22.     <meta name="keywords" content="" />
  23.     <meta name="robots" content="index,follow" />
  24.     <!-- <link rel="stylesheet" type="text/css" href="styles.css" /> -->
  25.     <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
  26.    
  27. <script type="text/javascript">
  28.  
  29. function nmap_ip(ip) {
  30.     $.ajax({ type: 'post',
  31.              url:'nmap.php',
  32.              data: {ip: ip},
  33.              beforeSend: function() { $('#result').html('<img src="ajax_wait.gif"/>'); },
  34.              success: function(data){ $('#result').html(data); }
  35.     });
  36. }
  37.  
  38. $(document).ready( function() {
  39.     $( "form:first" ).submit(function( event ) {
  40.         event.preventDefault();
  41.         nmap_ip($('#ip').val());
  42.     })
  43. });
  44.  
  45. </script>
  46.    
  47. </head>
  48. <body>
  49.  
  50. <form name="main">
  51. <input type="text" name="ip" value="" id="ip" maxlength="30" />
  52. <input type="submit" value="nmap"/>
  53. </form>
  54.  
  55. <div id="result"> </div>
  56.  
  57. </body>
  58. </html>
  59. <?php
  60. }
  61.  
  62.  
  63. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement