Skip to content

ezequiel9/ESP8266-Arduino-Sniffer---POST-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Create a mac sniffer using arduino ESP8266 / Wemos d1 mini / Wemos d1 mini pro.

Promiscuous fake ssid

Post data collected in a json to a http server

Example to receive it with PHP - Laravel

Route api:

  Route::apiResource('nodes', 'NodeController');

Node Model

  class Node extends Model
  {
      protected $fillable = [
          'read_at',
          'cluster_id',
          'rssi',
          'mac',
      ];


      public function cluster(){
          return $this->belongsTo(Cluster::class); // maybe create the cluster info? 
      }

  }

Cluster Model

  class Cluster extends Model
  {
      protected $fillable = [
          'name'
      ];


      public function cluster(){
          return $this->hasOne(Node::class);
      }
  }

Node Controller

  /**
   * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
   */
  public function index()
  {
      return NodeResource::collection(Node::with('cluster')->paginate(25));
  }
  

  /**
   * @param Request $request
   * @return NodeResource
   */
  public function store(Request $request)
  {
      if(!empty($request->probes)){
          foreach ($request->probes as $item){
              Node::create([
                  'cluster_id' => $item['cluster_id'],
                  'rssi' => $item['rssi'],
                  'mac' => $item['mac'],
                  'read_at' => Carbon::now()->format('Y-m-d H:i:s'),
              ]);
          }
          return response()->json('Bulk data posted.', 200);
      }
      return response()->json('empty', 200);
  }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages