daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Jan 25th, 2016 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php  
  2.     $data = json_decode($_POST['data'], true);
  3.  
  4.     $dbhost = "localhost";
  5.     $dbname = "scrapi";
  6.     $dbusername = "root";
  7.     // $dbpassword = "";
  8.     $dbpassword = "run3scap3";
  9.  
  10.     $link = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbusername,$dbpassword);
  11.  
  12.  
  13. foreach ($data['stations'] as $key => $st) {
  14.  
  15.     if(empty($st['Station MAC'])){
  16.         echo "failed, no MAC\n";
  17.         break;
  18.     }
  19.  
  20.     if(empty($st['BSSID'])){
  21.         $st['BSSID'] = "";
  22.     }
  23.     if(empty($st['Probed ESSIDs'])){
  24.         $st['Probed ESSIDs'] = "";
  25.     }
  26.  
  27.  
  28.  
  29.     $statement = $link->prepare("INSERT INTO stations(MAC,firstseen,lastseen,BSSID,ESSID)
  30.         VALUES(:MAC,:firstseen,:lastseen,:BSSID,:ESSID)");
  31.     $statement->execute(array(
  32.         "MAC" => $st['Station MAC'],
  33.         "firstseen" => $st['First time seen'],
  34.         "lastseen" => $st['Last time seen'],
  35.         "BSSID" =>  $st['BSSID'],
  36.         "ESSID" => $st['Probed ESSIDs'],
  37.     ));
  38.  
  39.     echo "inserted: " . $st['Station MAC'] . "\n";
  40.  
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top