# -*- coding: utf-8 -*-
# pragma pylint: disable=unused-argument, no-self-use
# (c) Copyright IBM Corp. 2010, 2020. All Rights Reserved.

"""
    Debugging tool:

    Example:
        get_technique_info.py AppleScript
"""
import sys
from fn_mitre_integration.lib.mitre_attack import MitreAttack
import json
from proxies import get_proxies

if len(sys.argv) < 2:
    print("Usage get_technique_info.py tech_id <mitigation>")
    sys.exit()

tech_id = sys.argv[1]

mitigation_only = False
if len(sys.argv) == 3:
    mitigation_only = True

if mitigation_only:
    mitigations = MitreAttack(opts=None, function_opts=get_proxies()).get_tech_mitigation(tech_id)
    print(str(mitigations))
else:
    tech = MitreAttack().get_tech(tech_id)
    print(str(tech))
예제 #2
0
import sys
from fn_mitre_integration.lib.mitre_attack import MitreAttack
import json
from proxies import get_proxies

if len(sys.argv) < 2:
    print(
        "Usage lookup.py item_name type_name[optional] collection_name[optional]"
    )
    sys.exit()

item_name = sys.argv[1]
type_name = None
collection_name = None
if len(sys.argv) > 2:
    type_name = sys.argv[2]

if len(sys.argv) > 3:
    collection_name = sys.argv[3]

attack = MitreAttack(opts=None, function_opts=get_proxies())

attack.connect_server()

item = attack.lookup_item(item_name)

item_dict = json.loads(item.serialize())

print(item_dict)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
    Debugging tool:
    example:
    get_tactic_url.py "Initial Access"
"""
import sys
from fn_mitre_integration.lib.mitre_attack import MitreAttack
import json

if len(sys.argv) < 2:
    print("Usage get_tactic_url.py tactic_name")
    sys.exit()

tactic_name = sys.argv[1]

url = MitreAttack().get_tactic_url(tactic_name)

print(url)
예제 #4
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-


"""
    Debugging tool:

    Example:
        get_technique_info.py AppleScript
"""
import sys
from fn_mitre_integration.lib.mitre_attack import MitreAttack
import json

if len(sys.argv) < 2:
    print("Usage get_technique_info.py tech_id <mitigation>")
    sys.exit()

tech_id = sys.argv[1]

mitigation_only = False
if len(sys.argv) == 3:
    mitigation_only = True

if mitigation_only:
    mitigations = MitreAttack().get_tech_mitigation(tech_id)
    print(str(mitigations))
else:
    tech = MitreAttack().get_tech(tech_id)
    print(str(tech))
예제 #5
0
# -*- coding: utf-8 -*-
# pragma pylint: disable=unused-argument, no-self-use

"""
Note that the mitre_attack class encapsulates the
MITRE ATTACK STIX TAXII server. Since that sever is
available to public, this file is a system level test
"""

from fn_mitre_integration.lib.mitre_attack import MitreAttack
from fn_mitre_integration.lib.mitre_attack_utils import get_techniques
import requests

mitre_attack = MitreAttack()

def url_get(url):
    ret = False
    try:
        response = requests.get(url)
        if response.status_code == 200:
            ret = True
    except:
        ret = False

    return ret


def test_get_tactic_url():
    tactics = mitre_attack.get_all_tactics()

    for tactic in tactics:
예제 #6
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pragma pylint: disable=unused-argument, no-self-use
# (c) Copyright IBM Corp. 2010, 2020. All Rights Reserved.
"""
    Debugging tool
        get_tech_mitigation AppleScript

"""
import sys
from fn_mitre_integration.lib.mitre_attack import MitreAttack
from fn_mitre_integration.lib.mitre_attack_utils import get_techniques
import json
from proxies import get_proxies

if len(sys.argv) < 2:
    print("Usage get_tech_mitigation.py <tech name>")
    sys.exit()

tactic_name = sys.argv[1]

tactics = tactic_name.split(", ")

if len(tactics) == 1:
    techs = MitreAttack(
        opts=None,
        function_opts=get_proxies()).get_tactic_techniques(tactic_name)
else:
    techs = get_techniques(tactic_name)

print(str(techs))
예제 #7
0
#

import sys
from fn_mitre_integration.lib.mitre_attack import MitreAttack
import json

if len(sys.argv) < 2:
    print(
        "Usage lookup.py item_name type_name[optional] collection_name[optional]"
    )
    sys.exit()

item_name = sys.argv[1]
type_name = None
collection_name = None
if len(sys.argv) > 2:
    type_name = sys.argv[2]

if len(sys.argv) > 3:
    collection_name = sys.argv[3]

attack = MitreAttack()

attack.connect_server()

item = attack.lookup_item(item_name)

item_dict = json.loads(item.serialize())

print(item_dict)
예제 #8
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
    Debugging tool
        get_tech_mitigation AppleScript

"""
import sys
from fn_mitre_integration.lib.mitre_attack import MitreAttack
from fn_mitre_integration.lib.mitre_attack_utils import get_techniques
import json

if len(sys.argv) < 2:
    print("Usage get_tech_mitigation.py <tech name>")
    sys.exit()

tactic_name = sys.argv[1]

tactics = tactic_name.split(", ")

if len(tactics) == 1:
    techs = MitreAttack().get_tactic_techniques(tactic_name)
else:
    techs = get_techniques(tactic_name)

print(str(techs))