GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — atc-react/scripts/update_react_mapping.py at master · efeerdur/atc-react

Expand file tree

/

update_react_mapping.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
48 lines (38 loc) · 1.7 KB
/

update_react_mapping.py

Copy path

File metadata and controls

48 lines (38 loc) · 1.7 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
import json
import requests
try:
from scripts.reactutils import REACTutils
except:
from response.atc_react.scripts.reactutils import REACTutils
REACTConfig = REACTutils.load_config("config.yml")
local_react_json_url = REACTConfig.get('local_react_json_url')
remote_react_json_url = REACTConfig.get('remote_react_json_url')
react_mapping_url = REACTConfig.get('react_mapping_url')
ra_mapping = {}
rs_mapping = {}
class UpdateReactMapping:
def __init__(self):
try:
with open(local_react_json_url) as f:
react_json = json.load(f)
print("[*] Using local react.json STIX file")
except:
react_json = requests.get(remote_react_json_url).json()
print("[*] Using remote master RE&CT react.json STIX file")
for object in react_json["objects"]:
if object['type'] == "x-react-action" and "RA" in \
object['external_references'][0]['external_id']:
ra_id = object['external_references'][0]['external_id']
ra_name = object['name']
ra_mapping.update({ra_id: ra_name})
elif object['type'] == "x-react-stage":
rs_id = object['external_references'][0]['external_id']
rs_name = object['name']
rs_mapping.update({rs_id: rs_name})
with open(react_mapping_url, 'w') as fp:
fp.write("ra_mapping = " + json.dumps(ra_mapping,
sort_keys=True, indent=4) + '\n')
fp.write("rs_mapping = " +
json.dumps(rs_mapping, sort_keys=True, indent=4))
print("[+] RE&CT mapping has been updated")
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.