Skip to content

Instantly share code, notes, and snippets.



Created Feb 3, 2020
What would you like to do?
Replaces dots in a json for preprocessing data for MongoDB
import re
if __name__ == '__main__':
TEST = """
"_id": "5e1d995f08f9e94ea4c67e31",
"data.Attack_Pattern_Catalog.Attack_Patterns.Attack_Pattern": [
"_attributes": {
"ID": "1",
"N.ame": "Accessing Functionality Not Properly Constrained by ACLs",
"Ab.straction": "Standard",
"Status": "Draft"
"Description" : {
"_text": "In applications, particularly web applications, access to functionality is mitigated by an authorization framework. This framework maps Access Control Lists (ACLs) to elements of the application's functionality; particularly URL's for web apps. In the case that the administrator failed to specify an ACL for a particular element, an attacker may be able to access it with impunity. An attacker with the ability to access functionality not properly constrained by ACLs can obtain sensitive information and possibly compromise the entire application. Such an attacker can access resources that must be available only to users at a higher privilege level, can access management sections of the application, or can run queries for data that they otherwise not supposed to."
"Likelihood_Of_Attack": {
"_text": "High"
for line in TEST.splitlines():
s = re.sub(r'"(.*\..*)" *:', lambda x:".", "#"), line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.