{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "updated ../amitt_red_framework.md\n", "updated ../amitt_blue_framework.md\n", "updated ../amitt_red_framework_clickable.html\n", "updated ../phases_index.md\n", "updated ../tactics_index.md\n", "Updating ../tactics/TA01.md\n", "Updating ../tactics/TA02.md\n", "Updating ../tactics/TA03.md\n", "Updating ../tactics/TA04.md\n", "Updating ../tactics/TA06.md\n", "updated ../techniques_index.md\n", "Updating ../techniques/T0001.md\n", "Updating ../techniques/T0002.md\n", "Updating ../techniques/T0006.md\n", "Updating ../techniques/T0007.md\n", "Updating ../techniques/T0008.md\n", "Updating ../techniques/T0009.md\n", "Updating ../techniques/T0012.md\n", "Updating ../techniques/T0013.md\n", "Updating ../techniques/T0014.md\n", "Updating ../techniques/T0015.md\n", "Updating ../techniques/T0019.md\n", "Updating ../techniques/T0022.md\n", "Updating ../techniques/T0023.md\n", "Updating ../techniques/T0027.md\n", "Updating ../techniques/T0043.md\n", "Updating ../techniques/T0047.md\n", "Updating ../techniques/T0048.md\n", "Updating ../techniques/T0051.md\n", "Updating ../techniques/T0055.md\n", "Updating ../techniques/T0056.md\n", "updated ../tasks_index.md\n", "updated ../incidents_index.md\n", "updated ../counters_index.md\n", "Updating ../counters/C00006.md\n", "Updating ../counters/C00009.md\n", "Updating ../counters/C00010.md\n", "Updating ../counters/C00011.md\n", "Updating ../counters/C00012.md\n", "Updating ../counters/C00013.md\n", "Updating ../counters/C00014.md\n", "Updating ../counters/C00016.md\n", "Updating ../counters/C00017.md\n", "Updating ../counters/C00019.md\n", "Updating ../counters/C00022.md\n", "Updating ../counters/C00024.md\n", "Updating ../counters/C00026.md\n", "Updating ../counters/C00027.md\n", "Updating ../counters/C00073.md\n", "Updating ../counters/C00153.md\n", "Updating ../counters/C00159.md\n", "Updating ../counters/C00170.md\n", "Updating ../counters/C00174.md\n", "Updating ../counters/C00176.md\n", "Updating ../counters/C00207.md\n", "Updating ../counters/C00220.md\n", "Updating ../counters/C00221.md\n", "updated ../metatechniques_index.md\n", "Updating ../metatechniques/M001.md\n", "Updating ../metatechniques/M003.md\n", "Updating ../metatechniques/M004.md\n", "Updating ../metatechniques/M006.md\n", "Updating ../metatechniques/M007.md\n", "Updating ../metatechniques/M010.md\n", "Updating ../metatechniques/M012.md\n", "Updating ../metatechniques/M013.md\n", "updated ../actors_index.md\n", "Updating ../actors/A005.md\n", "Updating ../actors/A006.md\n", "Updating ../actors/A007.md\n", "Updating ../actors/A008.md\n", "Updating ../actors/A009.md\n", "Updating ../actors/A010.md\n", "Updating ../actors/A017.md\n", "Updating ../actors/A018.md\n", "Updating ../actors/A020.md\n", "Updating ../actors/A021.md\n", "Updating ../actors/A027.md\n", "Updating ../actors/A032.md\n", "Updating ../actors/A033.md\n", "updated ../responsetype_index.md\n", "updated ../detections_index.md\n", "updated ../tactics_by_responsetype_table.md\n", "updated ../metatechniques_by_responsetype_table.md\n" ] } ], "source": [ "import pandas as pd\n", "from generate_amitt_ttps import Amitt\n", "amitt = Amitt()\n", "amitt.generate_and_write_datafiles()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Check which amitt variables we can see from here\n", "print('{}'.format(vars(amitt).keys()))\n", "vars(amitt)['tactics']" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# TEST AREA" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
id
tactic_idTA01TA02TA03TA04TA05TA06TA07TA08TA09TA10TA11TA12
responsetype
ALL400000000000
D2 Deny1101011213773110
D3 Disrupt6573587314061
D4 Degrade701305322062
D5 Deceive001002100000
D6 Destroy001100000000
D7 Deter401005030100
\n", "
" ], "text/plain": [ " id \n", "tactic_id TA01 TA02 TA03 TA04 TA05 TA06 TA07 TA08 TA09 TA10 TA11 TA12\n", "responsetype \n", "ALL 4 0 0 0 0 0 0 0 0 0 0 0\n", "D2 Deny 11 0 10 11 2 13 7 7 3 1 1 0\n", "D3 Disrupt 6 5 7 3 5 8 7 3 14 0 6 1\n", "D4 Degrade 7 0 1 3 0 5 3 2 2 0 6 2\n", "D5 Deceive 0 0 1 0 0 2 1 0 0 0 0 0\n", "D6 Destroy 0 0 1 1 0 0 0 0 0 0 0 0\n", "D7 Deter 4 0 1 0 0 5 0 3 0 1 0 0" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", "counts_table = pd.pivot_table(amitt.df_counters[['tactic_id', 'responsetype',\n", " 'id']], index='responsetype', columns='tactic_id', aggfunc=len, fill_value=0)\n", "counts_table" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['TA01', 'TA02', 'TA03', 'TA04', 'TA05', 'TA06', 'TA07', 'TA08', 'TA09',\n", " 'TA10', 'TA11', 'TA12'],\n", " dtype='object', name='tactic_id')" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "counts_table.columns.get_level_values(1)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idTOTALS
responsetypeALLD2 DenyD3 DisruptD4 DegradeD5 DeceiveD6 DestroyD7 Deter
metatechnique_id
M0010107700428
M0020210230017
M003068201219
M0040137600026
M0050154000019
M006070000310
M007436000316
M00800141006
M00900510006
M010038401117
M01102100003
M01202110004
M013016300111
M01402110004
\n", "
" ], "text/plain": [ " id \\\n", "responsetype ALL D2 Deny D3 Disrupt D4 Degrade D5 Deceive D6 Destroy \n", "metatechnique_id \n", "M001 0 10 7 7 0 0 \n", "M002 0 2 10 2 3 0 \n", "M003 0 6 8 2 0 1 \n", "M004 0 13 7 6 0 0 \n", "M005 0 15 4 0 0 0 \n", "M006 0 7 0 0 0 0 \n", "M007 4 3 6 0 0 0 \n", "M008 0 0 1 4 1 0 \n", "M009 0 0 5 1 0 0 \n", "M010 0 3 8 4 0 1 \n", "M011 0 2 1 0 0 0 \n", "M012 0 2 1 1 0 0 \n", "M013 0 1 6 3 0 0 \n", "M014 0 2 1 1 0 0 \n", "\n", " TOTALS \n", "responsetype D7 Deter \n", "metatechnique_id \n", "M001 4 28 \n", "M002 0 17 \n", "M003 2 19 \n", "M004 0 26 \n", "M005 0 19 \n", "M006 3 10 \n", "M007 3 16 \n", "M008 0 6 \n", "M009 0 6 \n", "M010 1 17 \n", "M011 0 3 \n", "M012 0 4 \n", "M013 1 11 \n", "M014 0 4 " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "coltype = 'responsetype'\n", "rowtype = 'metatechnique_id'\n", "rowname = 'metatag'\n", "counts_table2 = pd.pivot_table(amitt.df_counters[[coltype, rowtype,'id']], \n", " index=rowtype, columns=coltype, aggfunc=len, \n", " fill_value=0) \n", "counts_table2['TOTALS'] = counts_table2.sum(axis=1)\n", "counts_table2" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idTOTALS
responsetypeALLD2 DenyD3 DisruptD4 DegradeD5 DeceiveD6 DestroyD7 Deter
tactic_id
TA014116700432
TA0200500005
TA030107111121
TA040113301018
TA0502500007
TA060138520533
TA07077310018
TA08073200315
TA090314200019
TA1001000012
TA11016600013
TA1200120003
\n", "
" ], "text/plain": [ " id \\\n", "responsetype ALL D2 Deny D3 Disrupt D4 Degrade D5 Deceive D6 Destroy D7 Deter \n", "tactic_id \n", "TA01 4 11 6 7 0 0 4 \n", "TA02 0 0 5 0 0 0 0 \n", "TA03 0 10 7 1 1 1 1 \n", "TA04 0 11 3 3 0 1 0 \n", "TA05 0 2 5 0 0 0 0 \n", "TA06 0 13 8 5 2 0 5 \n", "TA07 0 7 7 3 1 0 0 \n", "TA08 0 7 3 2 0 0 3 \n", "TA09 0 3 14 2 0 0 0 \n", "TA10 0 1 0 0 0 0 1 \n", "TA11 0 1 6 6 0 0 0 \n", "TA12 0 0 1 2 0 0 0 \n", "\n", " TOTALS \n", "responsetype \n", "tactic_id \n", "TA01 32 \n", "TA02 5 \n", "TA03 21 \n", "TA04 18 \n", "TA05 7 \n", "TA06 33 \n", "TA07 18 \n", "TA08 15 \n", "TA09 19 \n", "TA10 2 \n", "TA11 13 \n", "TA12 3 " ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "coltype = 'responsetype'\n", "rowtype = 'tactic_id'\n", "rowname = 'tacctic'\n", "counts_table3 = pd.pivot_table(amitt.df_counters[[coltype, rowtype,'id']], \n", " index=rowtype, columns=coltype, aggfunc=len, \n", " fill_value=0) \n", "counts_table3['TOTALS'] = counts_table3.sum(axis=1)\n", "counts_table3" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idTOTALS
responsetypeALLD2 DenyD3 DisruptD4 DegradeD5 DeceiveD6 DestroyD7 Deter
metatechnique_id
M0010107700428
M0020210230017
M003068201219
M0040137600026
M0050154000019
M006070000310
M007436000316
M00800141006
M00900510006
M010038401117
M01102100003
M01202110004
M013016300111
M01402110004
\n", "
" ], "text/plain": [ " id \\\n", "responsetype ALL D2 Deny D3 Disrupt D4 Degrade D5 Deceive D6 Destroy \n", "metatechnique_id \n", "M001 0 10 7 7 0 0 \n", "M002 0 2 10 2 3 0 \n", "M003 0 6 8 2 0 1 \n", "M004 0 13 7 6 0 0 \n", "M005 0 15 4 0 0 0 \n", "M006 0 7 0 0 0 0 \n", "M007 4 3 6 0 0 0 \n", "M008 0 0 1 4 1 0 \n", "M009 0 0 5 1 0 0 \n", "M010 0 3 8 4 0 1 \n", "M011 0 2 1 0 0 0 \n", "M012 0 2 1 1 0 0 \n", "M013 0 1 6 3 0 0 \n", "M014 0 2 1 1 0 0 \n", "\n", " TOTALS \n", "responsetype D7 Deter \n", "metatechnique_id \n", "M001 4 28 \n", "M002 0 17 \n", "M003 2 19 \n", "M004 0 26 \n", "M005 0 19 \n", "M006 3 10 \n", "M007 3 16 \n", "M008 0 6 \n", "M009 0 6 \n", "M010 1 17 \n", "M011 0 3 \n", "M012 0 4 \n", "M013 1 11 \n", "M014 0 4 " ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "counts_table4 = pd.pivot_table(amitt.df_counters[['responsetype', 'metatechnique_id','id']], \n", " index='metatechnique_id', columns='responsetype', aggfunc=len, \n", " fill_value=0) \n", "counts_table4['TOTALS'] = counts_table4.sum(axis=1)\n", "counts_table4" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idnamemetatechniquesummaryplaybooksactorsresources_neededhow_foundreferencesincident_idstacticresponsetypenotestechniqueslongnametactic_idtactic_namemetatechnique_idmetatechnique_name
67C00001Better models of info spread up the layersM007 - metatechnique2019-11-workshopTA01 Strategic PlanningALLC00001 - Better models of info spread up the l...TA01Strategic PlanningM007- metatechnique
68C00003How can we safeguard against extremists using ...M007 - metatechnique2019-11-workshopTA01 Strategic PlanningALLC00003 - How can we safeguard against extremis...TA01Strategic PlanningM007- metatechnique
69C00004Managing like a chronic diseaseM007 - metatechnique2019-11-workshopTA01 Strategic PlanningALLC00004 - Managing like a chronic diseaseTA01Strategic PlanningM007- metatechnique
70C00005Policy: makers, terminology, elements: a) broa...M007 - metatechnique2019-11-workshopTA01 Strategic PlanningALLC00005 - Policy: makers, terminology, elements...TA01Strategic PlanningM007- metatechnique
71C00006Charge for social mediaM004 - frictionNo corresponding AMITT technique.A033 - social media platform owner2019-11-workshopTA01 Strategic PlanningD2 DenyC00006 - Charge for social mediaTA01Strategic PlanningM004- friction
............................................................
25C00215Use fraud legislation to clean up social mediaM007 - metatechniqueA020 - policy maker2019-11-workshopTA07 Channel SelectionD3 DisruptC00215 - Use fraud legislation to clean up soc...TA07Channel SelectionM007- metatechnique
50C00216Use advertiser controls to stem flow of funds ...M014 - reduce resourcesA023 - adtech provider2019-11-workshopTA05 MicrotargetingD2 DenyC00216 - Use advertiser controls to stem flow ...TA05MicrotargetingM014- reduce resources
45C00217Registries alert when large batches of newsy U...M003 - daylightA028 - platform administratorgrugqTA07 Channel SelectionD2 DenyC00217 - Registries alert when large batches o...TA07Channel SelectionM003- daylight
46C00218CensorshipM005 - removalAlter and/or block the publication/disseminati...A031 - social media platform administratorgrugqTaylor81TA09 ExposureD2 DenyC00218 - CensorshipTA09ExposureM005- removal
185C00219Add metadata to content - out of the control o...M003 - daylightAdd date and source to imagesgrugqTA06 Develop ContentD3 DisruptC00219 - Add metadata to content - out of the ...TA06Develop ContentM003- daylight
\n", "

186 rows × 19 columns

\n", "
" ], "text/plain": [ " id name \\\n", "67 C00001 Better models of info spread up the layers \n", "68 C00003 How can we safeguard against extremists using ... \n", "69 C00004 Managing like a chronic disease \n", "70 C00005 Policy: makers, terminology, elements: a) broa... \n", "71 C00006 Charge for social media \n", ".. ... ... \n", "25 C00215 Use fraud legislation to clean up social media \n", "50 C00216 Use advertiser controls to stem flow of funds ... \n", "45 C00217 Registries alert when large batches of newsy U... \n", "46 C00218 Censorship \n", "185 C00219 Add metadata to content - out of the control o... \n", "\n", " metatechnique \\\n", "67 M007 - metatechnique \n", "68 M007 - metatechnique \n", "69 M007 - metatechnique \n", "70 M007 - metatechnique \n", "71 M004 - friction \n", ".. ... \n", "25 M007 - metatechnique \n", "50 M014 - reduce resources \n", "45 M003 - daylight \n", "46 M005 - removal \n", "185 M003 - daylight \n", "\n", " summary \\\n", "67 \n", "68 \n", "69 \n", "70 \n", "71 No corresponding AMITT technique. \n", ".. ... \n", "25 \n", "50 \n", "45 \n", "46 Alter and/or block the publication/disseminati... \n", "185 \n", "\n", " playbooks \\\n", "67 \n", "68 \n", "69 \n", "70 \n", "71 \n", ".. ... \n", "25 \n", "50 \n", "45 \n", "46 \n", "185 Add date and source to images \n", "\n", " actors resources_needed \\\n", "67 \n", "68 \n", "69 \n", "70 \n", "71 A033 - social media platform owner \n", ".. ... ... \n", "25 A020 - policy maker \n", "50 A023 - adtech provider \n", "45 A028 - platform administrator \n", "46 A031 - social media platform administrator \n", "185 \n", "\n", " how_found references incident_ids tactic \\\n", "67 2019-11-workshop TA01 Strategic Planning \n", "68 2019-11-workshop TA01 Strategic Planning \n", "69 2019-11-workshop TA01 Strategic Planning \n", "70 2019-11-workshop TA01 Strategic Planning \n", "71 2019-11-workshop TA01 Strategic Planning \n", ".. ... ... ... ... \n", "25 2019-11-workshop TA07 Channel Selection \n", "50 2019-11-workshop TA05 Microtargeting \n", "45 grugq TA07 Channel Selection \n", "46 grugq Taylor81 TA09 Exposure \n", "185 grugq TA06 Develop Content \n", "\n", " responsetype notes techniques \\\n", "67 ALL \n", "68 ALL \n", "69 ALL \n", "70 ALL \n", "71 D2 Deny \n", ".. ... ... ... \n", "25 D3 Disrupt \n", "50 D2 Deny \n", "45 D2 Deny \n", "46 D2 Deny \n", "185 D3 Disrupt \n", "\n", " longname tactic_id \\\n", "67 C00001 - Better models of info spread up the l... TA01 \n", "68 C00003 - How can we safeguard against extremis... TA01 \n", "69 C00004 - Managing like a chronic disease TA01 \n", "70 C00005 - Policy: makers, terminology, elements... TA01 \n", "71 C00006 - Charge for social media TA01 \n", ".. ... ... \n", "25 C00215 - Use fraud legislation to clean up soc... TA07 \n", "50 C00216 - Use advertiser controls to stem flow ... TA05 \n", "45 C00217 - Registries alert when large batches o... TA07 \n", "46 C00218 - Censorship TA09 \n", "185 C00219 - Add metadata to content - out of the ... TA06 \n", "\n", " tactic_name metatechnique_id metatechnique_name \n", "67 Strategic Planning M007 - metatechnique \n", "68 Strategic Planning M007 - metatechnique \n", "69 Strategic Planning M007 - metatechnique \n", "70 Strategic Planning M007 - metatechnique \n", "71 Strategic Planning M004 - friction \n", ".. ... ... ... \n", "25 Channel Selection M007 - metatechnique \n", "50 Microtargeting M014 - reduce resources \n", "45 Channel Selection M003 - daylight \n", "46 Exposure M005 - removal \n", "185 Develop Content M003 - daylight \n", "\n", "[186 rows x 19 columns]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "amitt.df_counters" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idTOTALS
responsetypeALLD2 DenyD3 DisruptD4 DegradeD5 DeceiveD6 DestroyD7 Deter
resource_id
46261274214174
R00101000001
R00201000001
R00300200002
R00402240008
\n", "
" ], "text/plain": [ " id \\\n", "responsetype ALL D2 Deny D3 Disrupt D4 Degrade D5 Deceive D6 Destroy D7 Deter \n", "resource_id \n", " 4 62 61 27 4 2 14 \n", "R001 0 1 0 0 0 0 0 \n", "R002 0 1 0 0 0 0 0 \n", "R003 0 0 2 0 0 0 0 \n", "R004 0 2 2 4 0 0 0 \n", "\n", " TOTALS \n", "responsetype \n", "resource_id \n", " 174 \n", "R001 1 \n", "R002 1 \n", "R003 2 \n", "R004 8 " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "counts_table = pd.pivot_table(amitt.cross_counterid_resourceid.merge(amitt.df_counters[['id', 'responsetype']]), \n", " index='resource_id', columns='responsetype', aggfunc=len, \n", " fill_value=0)\n", "counts_table['TOTALS'] = counts_table.sum(axis=1)\n", "\n", "counts_table" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "ename": "KeyError", "evalue": "''", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mamitt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwrite_counts_table_to_file\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'resource'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mamitt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mresources\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcounts_table\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'testfile.txt'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;32m~/Dropbox/SJT_Projects_current/CogSecCollab/CODE_AND_DATA/github_cogseccollab_AMITT/HTML_GENERATING_CODE/generate_amitt_ttps.py\u001b[0m in \u001b[0;36mwrite_counts_table_to_file\u001b[0;34m(self, objectname, objectdict, counts_table, outfile)\u001b[0m\n\u001b[1;32m 712\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mindex\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcounts\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mcounts_table\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0miterrows\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 713\u001b[0m html += '{1} {2}\\n'.format(\n\u001b[0;32m--> 714\u001b[0;31m objectname, index, objectdict[index])\n\u001b[0m\u001b[1;32m 715\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mval\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mcounts\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalues\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 716\u001b[0m \u001b[0mhtml\u001b[0m \u001b[0;34m+=\u001b[0m \u001b[0;34m'{}\\n'\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mval\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mKeyError\u001b[0m: ''" ] } ], "source": [ "amitt.write_counts_table_to_file('resource', amitt.resources, counts_table, 'testfile.txt')" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'R001': 'datastreams ',\n", " 'R002': 'funding ',\n", " 'R003': 'money ',\n", " 'R004': 'platform algorithms ',\n", " 'R005': 'slang translation',\n", " 'R006': 'disinformation datasets'}" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "amitt.resources" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " is responsetype\n", "id ALL 4\n", " D2 Deny 62\n", " D3 Disrupt 61\n", " D4 Degrade 27\n", " D5 Deceive 4\n", " D6 Destroy 2\n", " D7 Deter 14\n", "TOTALS 174\n", "Name: , dtype: int64\n", "R001 is responsetype\n", "id ALL 0\n", " D2 Deny 1\n", " D3 Disrupt 0\n", " D4 Degrade 0\n", " D5 Deceive 0\n", " D6 Destroy 0\n", " D7 Deter 0\n", "TOTALS 1\n", "Name: R001, dtype: int64\n", "R002 is responsetype\n", "id ALL 0\n", " D2 Deny 1\n", " D3 Disrupt 0\n", " D4 Degrade 0\n", " D5 Deceive 0\n", " D6 Destroy 0\n", " D7 Deter 0\n", "TOTALS 1\n", "Name: R002, dtype: int64\n", "R003 is responsetype\n", "id ALL 0\n", " D2 Deny 0\n", " D3 Disrupt 2\n", " D4 Degrade 0\n", " D5 Deceive 0\n", " D6 Destroy 0\n", " D7 Deter 0\n", "TOTALS 2\n", "Name: R003, dtype: int64\n", "R004 is responsetype\n", "id ALL 0\n", " D2 Deny 2\n", " D3 Disrupt 2\n", " D4 Degrade 4\n", " D5 Deceive 0\n", " D6 Destroy 0\n", " D7 Deter 0\n", "TOTALS 8\n", "Name: R004, dtype: int64\n" ] } ], "source": [ "for index, counts in counts_table.iterrows():\n", " print('{} is {}'.format(index, counts))" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idresource_idresponsetype
\n", "
" ], "text/plain": [ "Empty DataFrame\n", "Columns: [id, resource_id, responsetype]\n", "Index: []" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "xx = amitt.cross_counterid_resourceid.merge(amitt.df_counters[['id', 'responsetype']], how='inner')\n", "xx[xx['responsetype'].isin(amitt.resources.keys())]" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ " 174\n", "R004 8\n", "R003 2\n", "R002 1\n", "R001 1\n", "Name: resource_id, dtype: int64" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "xx['resource_id'].value_counts()" ] }, { "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 }