{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "initial_id",
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "df = pd.read_pickle(\"../echo-dot-attack.pickel\")"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "36cbb373e91e7b86"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "# get unique src ip addresses, drop nans\n",
    "ip_addresses = df[\"ip/ip.src\"].unique()\n",
    "ip_addresses = ip_addresses[~pd.isnull(ip_addresses)]\n",
    "ip_addresses"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "737d862bee140f41"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "# get associated mac addresses\n",
    "associated_mac_addresses = list(set(\n",
    "    [df[df[\"ip/ip.src\"] == ip][\"eth/eth.src\"].unique()[0] for ip in ip_addresses]))\n",
    "associated_mac_addresses"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "f5f01e284c2fd677"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "# get unique mac addresses, drop nans\n",
    "mac_addresses = set(df[\"eth/eth.src\"].unique()).union(set(df[\"eth/eth.dst\"].unique()))\n",
    "mac_addresses = [mac for mac in mac_addresses if not pd.isnull(mac)]\n",
    "mac_addresses"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "ba1b9681e60d31b7"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "# check if all mac addresses are associated with an ip address\n",
    "for mac in mac_addresses:\n",
    "    if mac not in associated_mac_addresses:\n",
    "        print(f\"mac address {mac} is not associated with an ip address\")"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "f6251b2b6b4f71cf"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "# create new columns in dataframe called ip/ip.dst with ip address associated to destination mac"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "1c5d264aff0955cc"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
