{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "updated ../phases_index.md\n",
      "updated ../tactics_index.md\n",
      "updated ../techniques_index.md\n",
      "updated ../tasks_index.md\n",
      "updated ../responsetype_index.md\n",
      "updated ../metatechniques_index.md\n",
      "updated ../actors_index.md\n",
      "updated ../detections_index.md\n",
      "updated ../counters_index.md\n",
      "updated ../incidents_index.md\n",
      "updated ../amitt_red_framework.md\n",
      "updated ../amitt_blue_framework.md\n",
      "updated ../amitt_red_framework_clickable.html\n",
      "Writing ../counter_tactics/TA01counters.md\n",
      "Writing ../counter_tactics/TA02counters.md\n",
      "Writing ../counter_tactics/TA03counters.md\n",
      "Writing ../counter_tactics/TA04counters.md\n",
      "Writing ../counter_tactics/TA05counters.md\n",
      "Writing ../counter_tactics/TA06counters.md\n",
      "Writing ../counter_tactics/TA07counters.md\n",
      "Writing ../counter_tactics/TA08counters.md\n",
      "Writing ../counter_tactics/TA09counters.md\n",
      "Writing ../counter_tactics/TA10counters.md\n",
      "Writing ../counter_tactics/TA11counters.md\n",
      "Writing ../counter_tactics/TA12counters.md\n",
      "updated ../tactics_by_responsetype_table.md\n",
      "Writing ../metatechniques/cleaningcounters.md\n",
      "Writing ../metatechniques/countermessagingcounters.md\n",
      "Writing ../metatechniques/data pollutioncounters.md\n",
      "Writing ../metatechniques/daylightcounters.md\n",
      "Writing ../metatechniques/dilutioncounters.md\n",
      "Writing ../metatechniques/diversioncounters.md\n",
      "Writing ../metatechniques/frictioncounters.md\n",
      "Writing ../metatechniques/metatechniquecounters.md\n",
      "Writing ../metatechniques/reduce resourcescounters.md\n",
      "Writing ../metatechniques/removalcounters.md\n",
      "Writing ../metatechniques/resiliencecounters.md\n",
      "Writing ../metatechniques/scoringcounters.md\n",
      "Writing ../metatechniques/targetingcounters.md\n",
      "Writing ../metatechniques/verificationcounters.md\n",
      "updated ../metatechniques_by_responsetype_table.md\n",
      "Writing ../resources_needed/counters.md\n",
      "Writing ../resources_needed/DHScounters.md\n",
      "Writing ../resources_needed/NGOcounters.md\n",
      "Writing ../resources_needed/activistscounters.md\n",
      "Writing ../resources_needed/adtechcounters.md\n",
      "Writing ../resources_needed/civil_societycounters.md\n",
      "Writing ../resources_needed/community_groupscounters.md\n",
      "Writing ../resources_needed/companiescounters.md\n",
      "Writing ../resources_needed/content_creatorscounters.md\n",
      "Writing ../resources_needed/data_scientistcounters.md\n",
      "Writing ../resources_needed/datastreamscounters.md\n",
      "Writing ../resources_needed/developerscounters.md\n",
      "Writing ../resources_needed/educatorscounters.md\n",
      "Writing ../resources_needed/elvescounters.md\n",
      "Writing ../resources_needed/factcheckerscounters.md\n",
      "Writing ../resources_needed/fundingcounters.md\n",
      "Writing ../resources_needed/gamesdesignerscounters.md\n",
      "Writing ../resources_needed/governmentcounters.md\n",
      "Writing ../resources_needed/government:policymakerscounters.md\n",
      "Writing ../resources_needed/influencerscounters.md\n",
      "Writing ../resources_needed/influencers:trusted_authoritycounters.md\n",
      "Writing ../resources_needed/infoseccounters.md\n",
      "Writing ../resources_needed/librariescounters.md\n",
      "Writing ../resources_needed/mediacounters.md\n",
      "Writing ../resources_needed/militarycounters.md\n",
      "Writing ../resources_needed/moneycounters.md\n",
      "Writing ../resources_needed/platform_admincounters.md\n",
      "Writing ../resources_needed/platform_admin:adtechcounters.md\n",
      "Writing ../resources_needed/platform_admin:fundingsitescounters.md\n",
      "Writing ../resources_needed/platform_admin:socialmediacounters.md\n",
      "Writing ../resources_needed/platform_algorithmscounters.md\n",
      "Writing ../resources_needed/platform_outreachcounters.md\n",
      "Writing ../resources_needed/platformscounters.md\n",
      "Writing ../resources_needed/publiccounters.md\n",
      "Writing ../resources_needed/public:account_ownerscounters.md\n",
      "Writing ../resources_needed/religious_organisationscounters.md\n",
      "Writing ../resources_needed/schoolscounters.md\n",
      "Writing ../resources_needed/server_admincounters.md\n",
      "updated ../resources_by_responsetype_table.md\n"
     ]
    }
   ],
   "source": [
    "from generate_amitt_ttps import Amitt\n",
    "amitt = Amitt()\n",
    "amitt.generate_and_write_datafiles()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "vars(amitt)['tactics']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "vars(amitt).keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "###. TEST AREA"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Aaaa'"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"aaaa\".capitalize()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "cols = ['name', 'type', 'Year Started', 'To country', 'Found via']\n",
    "\n",
    "h2 = "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'
name\\n | type\\n | Year Started\\n | To country\\n | Found via\\n'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "html =''\n",
    "for col in cols:\n",
    "    html += ' | {}\\n'.format(col)\n",
    "html"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "html == h2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'# AMITT Incidents:\\n\\n | \\n\\n| id\\n | name\\n | type\\n | Year Started\\n | To country\\n | Found via\\n | 
\\n\\n| I00001\\n | Blacktivists facebook group\\n | incident\\n | 2016\\n | USA\\n | nan\\n | 
\\n\\n| I00002\\n | #VaccinateUS\\n | campaign\\n | 2014\\n | World\\n | nan\\n | 
\\n\\n| I00003\\n | Beyonce protest rallies\\n | incident\\n | 2016\\n | USA\\n | nan\\n | 
\\n\\n| I00004\\n | #Macrongate\\n | incident\\n | 2017\\n | France\\n | nan\\n | 
\\n\\n| I00005\\n | Brexit vote\\n | campaign\\n | 2016\\n | UK\\n | nan\\n | 
\\n\\n| I00006\\n | Columbian Chemicals\\n | incident\\n | 2014\\n | USA\\n | nan\\n | 
\\n\\n| I00007\\n | Incirlik terrorists\\n | incident\\n | 2016\\n | USA\\n | nan\\n | 
\\n\\n| I00008\\n | Bujic\\n | incident\\n | 2017\\n | Serbia\\n | nan\\n | 
\\n\\n| I00009\\n | PhilippinesExpert\\n | incident\\n | 2017\\n | Philippines\\n | nan\\n | 
\\n\\n| I00010\\n | ParklandTeens\\n | incident\\n | 2018\\n | USA\\n | nan\\n | 
\\n\\n| I00011\\n | CovingtonTeen\\n | incident\\n | 2019\\n | USA\\n | nan\\n | 
\\n\\n| I00012\\n | ChinaSmog\\n | incident\\n | 2011\\n | China\\n | nan\\n | 
\\n\\n| I00013\\n | FranceBlacktivists\\n | incident\\n | 2014\\n | France\\n | nan\\n | 
\\n\\n| I00014\\n | GiletsJaunePileon\\n | incident\\n | 2018\\n | France\\n | nan\\n | 
\\n\\n| I00015\\n | ConcordDiscovery\\n | incident\\n | 2019\\n | USA\\n | nan\\n | 
\\n\\n| I00016\\n | LithuanianElves\\n | campaign\\n | 2014\\n | Lithuania\\n | nan\\n | 
\\n\\n| I00017\\n | US presidential elections\\n | campaign\\n | 2016\\n | USA\\n | OII\\n | 
\\n\\n| I00018\\n | DNC email leak incident\\n | tactic\\n | 2016\\n | USA\\n | OII\\n | 
\\n\\n| I00019\\n | MacronTiphaine\\n | incident\\n | 2017\\n | France\\n | OII\\n | 
\\n\\n| I00020\\n | 3000 tanks\\n | incident\\n | 2017\\n | World\\n | OII\\n | 
\\n\\n| I00021\\n | Armenia elections\\n | campaign\\n | 2017\\n | Armenia\\n | OII\\n | 
\\n\\n| I00022\\n | #Macronleaks\\n | incident\\n | 2017\\n | France\\n | OII\\n | 
\\n\\n| I00023\\n | #dislikemacron\\n | incident\\n | 2017\\n | France\\n | OII\\n | 
\\n\\n| I00024\\n | #syriahoax\\n | incident\\n | 2017\\n | USA\\n | OII\\n | 
\\n\\n| I00025\\n | EU Army\\n | incident\\n | 2018\\n | EU\\n | OII\\n | 
\\n\\n| I00026\\n | Netherlands referendum on Ukraine\\n | incident\\n | 2016\\n | Netherlands\\n | OII\\n | 
\\n\\n| I00027\\n | crucifiedboy\\n | incident\\n | 2014\\n | Ukraine\\n | OII\\n | 
\\n\\n| I00028\\n | mh17 downed\\n | incident\\n | 2014\\n | Ukraine\\n | OII\\n | 
\\n\\n| I00029\\n | MH17 investigation\\n | campaign\\n | 2016\\n | Ukraine\\n | OII\\n | 
\\n\\n| I00030\\n | LastJedi\\n | incident\\n | 2018\\n | World\\n | OII\\n | 
\\n\\n| I00031\\n | antivax\\n | apt\\n | 2018\\n | World\\n | OII\\n | 
\\n\\n| I00032\\n | Kavanaugh\\n | incident\\n | 2018\\n | USA\\n | OII\\n | 
\\n\\n| I00033\\n | China 50cent Army\\n | apt\\n | 2014\\n | China\\n | OII\\n | 
\\n\\n| I00034\\n | DibaFacebookExpedition\\n | incident\\n | 2016\\n | Taiwan\\n | OII\\n | 
\\n\\n| I00035\\n | Brazilelections\\n | campaign\\n | 2014\\n | Brazil\\n | OII\\n | 
\\n\\n| I00036\\n | BrazilPresDebate\\n | incident\\n | 2014\\n | Brazil\\n | OII\\n | 
\\n\\n| I00037\\n | Rioelections\\n | incident\\n | 2016\\n | Brazil\\n | OII\\n | 
\\n\\n| I00038\\n | Brazilimpeachment\\n | incident\\n | 2016\\n | Brazil\\n | OII\\n | 
\\n\\n| I00039\\n | MerkelFacebook\\n | incident\\n | 2017\\n | Germany\\n | OII\\n | 
\\n\\n| I00040\\n | modamaniSelfie\\n | incident\\n | 2015\\n | Germany\\n | OII\\n | 
\\n\\n| I00041\\n | Refugee crime map\\n | incident\\n | 2017\\n | Germany\\n | OII\\n | 
\\n\\n| I00042\\n | Saudi/Qatar bot dispute\\n | incident\\n | 2017\\n | Qatar\\n | MIS\\n | 
\\n\\n| I00043\\n | FCC comments\\n | incident\\n | 2017\\n | USA\\n | MIS\\n | 
\\n\\n| I00044\\n | JadeHelm exercise\\n | incident\\n | 2015\\n | USA\\n | MIS\\n | 
\\n\\n| I00045\\n | Skripal\\n | incident\\n | 2018\\n | UK\\n | nan\\n | 
\\n\\n| I00046\\n | North Macedonia\\n | incident\\n | 2018\\n | Macedonia\\n | nan\\n | 
\\n\\n| I00047\\n | Sea of Azov\\n | incident\\n | 2018\\n | World\\n | nan\\n | 
\\n\\n| I00048\\n | White Helmets\\n | campaign\\n | 2015\\n | World\\n | nan\\n | 
\\n\\n| I00049\\n | White Helmets: Chemical Weapons\\n | incident\\n | 2017\\n | World\\n | nan\\n | 
\\n\\n| I00050\\n | #HandsOffVenezuela\\n | incident\\n | 2019\\n | World\\n | nan\\n | 
\\n\\n| I00051\\n | Integrity Initiative\\n | incident\\n | 2018\\n | World\\n | nan\\n | 
\\n\\n| I00052\\n | China overiew\\n | campaign\\n | 2015\\n | World\\n | nan\\n | 
\\n\\n| I00053\\n | China Huawei CFO Arrest\\n | incident\\n | 2018\\n | World\\n | nan\\n | 
\\n\\n| I00054\\n | China Muslims\\n | incident\\n | 2018\\n | World\\n | nan\\n | 
\\n\\n| I00055\\n | 50 Cent Army\\n | campaign\\n | 2008\\n | World\\n | nan\\n | 
\\n\\n| I00056\\n | Iran Influence Operations\\n | campaign\\n | 2012\\n | World\\n | nan\\n | 
\\n\\n| I00057\\n | Mexico Election\\n | incident\\n | 2018\\n | Mexico\\n | nan\\n | 
\\n\\n| I00058\\n | Chemnitz\\n | incident\\n | 2018\\n | Germany\\n | nan\\n | 
\\n\\n| I00059\\n | Myanmar - Rohingya\\n | campaign\\n | 2014\\n | Myanmar\\n | nan\\n | 
\\n\\n| I00060\\n | White Genocide\\n | campaign\\n | 2018\\n | World\\n | nan\\n | 
\\n\\n| I00061\\n | Military veterans Targetting\\n | campaign\\n | 2017\\n | US\\n | nan\\n | 
\\n\\n| I00062\\n | Brexit/UK ongoing\\n | campaign\\n | 2015\\n | UK\\n | nan\\n | 
\\n\\n| I00063\\n | Olympic Doping Scandal\\n | campaign\\n | 2016\\n | World\\n | nan\\n | 
\\n
\\n'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "objectname = 'incidents'\n",
    "objectcols = ['name', 'type', 'Year Started', 'To country', 'Found via']\n",
    "dfobject = amitt.df_incidents\n",
    "outfile='../incidents_list.md'\n",
    "\n",
    "html = '''# AMITT {}:\n",
    "\n",
    "\n",
    "\n",
    "'''.format(objectname.capitalize())\n",
    "\n",
    "# Create header row\n",
    "html += '| {}\\n'.format('id')\n",
    "html += ''.join([' | {}\\n'.format(col) for col in objectcols])\n",
    "html += ' | 
\\n'\n",
    "\n",
    "# Add row for each object\n",
    "for index, row in dfobject[dfobject['name'].notnull()].iterrows():\n",
    "    html += '\\n'\n",
    "    html += '| {1}\\n'.format(objectname, row['id'])\n",
    "    html += ''.join([' | {}\\n'.format(row[col]) for col in objectcols])\n",
    "    html += ' | 
\\n'\n",
    "html += '
\\n'\n",
    "html"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'# AMITT Incidents:\\n\\n\\n\\n| id\\n | name\\n | type\\n | Year Started\\n | To country\\n | Found via\\n | 
\\n\\n| I00001\\n'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "html"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
} |