EntityScript

Draft 1.01:
Index







Sections: Status -> Approved

1.) EntityScript™ Overview - Overview of the project

2.) .entity/.ds Lookups - Overview of basic .entity and .ds file relationships. An overview of each file.

3.) Special File Types - Overview of special types of methods, files, and types in C.ORE™

4.) Log File Types - Overview of Logging within C.ORE™

5.) Using OpenPackager™ - Overview of the OpenPackager™ project and details regarding using the sub-system for organizing the base system and addons.

6.) Locations - Overview of various parts of the IPDVC™ file system

7.) System Audits - Overview of various audit mechanisms present in C.ORE™ and how to use them.

8.) C.ORE™ Scripts - Overview of scripts that run in C.ORE™, the purpose they have, overview of some scripting philosophy, and some usage examples.

9.) Startup - Step-by-step process of startup routines and how to extend them

10.) C.ORE™: AirEP™ file system (Access Identity Ring Entertainment Platform: AirEP™ - Understand more about the Access, Identity, Ring

11.) Keys: Each of the built-in keys that can be used to retrieve meta-information in C.ORE™

12.) How-to: Additional Notes

13.) Moderation: Basic moderation principles

14.) Social Pledge: Basic social-pledge for your interface and who you interact with

15.) Disclaimers: Basic recommendations for your interface and dealing with various types of commerce

16.) Additional Resources: Dig deeper into the technical stack, program methods, variables, and other happenings within CORE.HOST™

core_count




"""
Copyright (C) 2020 New Entity Operations Inc.

ALL RIGHTS RESERVED

core_seeker gives a basic seek system for text-mode

"""
from core_middlelayer import (
    ACCESS_CONTROL_DS, ACCESS_CONTROL_PATH,
    COREES,
    DIRDATA,
    RING_KEY_LOCATION
)

class Locate:
    """
    Locate, return, or filter a match in core.es
    based off of the prototype critera - here, a skeleton
    """
    def seek_by_date():
     """
     Filter the seeker to a specific date
     Function: incomplete, pass
     """
     Sought_In_Core = input(
     "What date are you looking for?: ") + ' \n'

    def seek_by_time():
     """
     Filter the seeker to a specific time

     Function: incomplete, pass
     """
     Sought_In_Core = input(
     "What time are you looking for?: ") + ' \n'

    def seek_by_member():
     """
     Filter the seeker to a specific member

     Function: incomplete, pass
     """
     Sought_In_Core = input(
     "What name are you looking for?: ") + ' \n'

    def seek_by_text():
     """
     Filter the seeker to locate a specific text field

     Function: incomplete, pass
     """
     Sought_In_Core = input(
     "What text entry are you looking for?: ") + ' \n'

    def seek_full_match():
     """
     Seek and return an exact line match
     """
     Sought_In_Core = input(
     "What exact full text are you looking for?: ") + ' \n'

     with open (DIRDATA+COREES, 'rt') as SEARCH_SLUG:
      for line in SEARCH_SLUG:
       if Sought_In_Core != line:
        print('No Matches Found')
       elif Sought_In_Core == line:
        print(line)
       else:
        print('Hm, error in the search...')
     SEARCH_SLUG.close()

class IPDVS:
 BINGO_BUCKET = []
 WAS_VALID = []
 class ACCESS:
  conflict_bucket = []
  match_bucket = []
  relational_key_bucket = []
  config_setter_bucket = []
  def access_IPDVS(vcnkey, vcnkey_hash):
   with open(ACCESS_CONTROL_PATH+ACCESS_CONTROL_DS, 'r') as IPDVS_ACCESS:
    row_counter = 0
    for row in IPDVS_ACCESS:
     if row_counter == 0:
      print("Skipping Header")
      row_counter+=1
     else:
      # print(row)
      element_list_row = row.replace('"', '').split(',')
      print(element_list_row)
      vcnkey_match = element_list_row[2]
      vcnkey_key_match = element_list_row[5]
      vcnkey_config_setter = element_list_row[0]
      if vcnkey_match == vcnkey:
       print("attempting to grant the member access.")
       IPDVS.ACCESS.match_bucket.append(vcnkey_match)
       IPDVS.ACCESS.relational_key_bucket.append(vcnkey_key_match)
       IPDVS.ACCESS.config_setter_bucket.append(vcnkey_config_setter)
      else:
       print("Not found...")
       # return("Not found...")
   IPDVS_ACCESS.close()
   try:
    IPDVS.ACCESS.match_bucket[0]
    print(IPDVS.ACCESS.match_bucket[0]+" Found")
    if IPDVS.ACCESS.relational_key_bucket[0] == vcnkey_hash:
     print("Access granted to the member...")
     # return("Access granted to the member...")
     IPDVS.ACCESS.relational_key_bucket.clear()
     IPDVS.ACCESS.match_bucket.clear()
     IPDVS.ACCESS.conflict_bucket.clear()
     from core_settings import not_admin_check
     not_admin_check.make_config(
      key_id=IPDVS.ACCESS.config_setter_bucket[0]
     )
    else:
     print("Seems like you may have a key mismatch.")
     # return("Seems like you may have a key mismatch.")
   except:
    IndexError
    print("We weren't able to match those credentials.")
    # return("We weren't able to match those credentials.")
  row_counter = 0
  def add_member(vcnkey, vcnkey_hash):
   vcnkey = vcnkey.lower()
   if len(vcnkey) < 3:
    print("This needs to be longer than 3 characters")
    # return("This needs to be longer than 3 characters")
   elif len(vcnkey) > 64:
    print("Wow... that's a... too long. 64 is the max member name length.")
    # return("Wow... that's a... too long. 64 is the max member name length.")
   elif len(vcnkey_hash) < 10:
    print("The key should be stronger/longer")
    # return("The key should be stronger/longer")
   elif len(vcnkey_hash) > 100:
    print("Passwords are limited to 100 characters.")
    # return("Passwords are limited to 100 characters.")
   else:
    print("Looks clean, running Member setup...")
    import re
    if not re.match("^[a-zA-Z0-9]+$", vcnkey):
     print(
      "Only letters and numbers are allowed in Member names."
     )
     # return("Only letters and numbers are allowed in Member names.")
    else:
     with open(ACCESS_CONTROL_PATH+ACCESS_CONTROL_DS, 'r') as IPDVS_ACCESS:
      for row in IPDVS_ACCESS:
       if IPDVS.ACCESS.row_counter == 0:
        print("Skipping Header")
        IPDVS.ACCESS.row_counter+=1
       else:
        IPDVS.ACCESS.row_counter+=1
        print(row)
        element_list_row = row.replace('"', '').split(',')
        print(element_list_row)
        if element_list_row[2] == vcnkey:
         print("That name wasn't available.")
         # return("That name wasn't available.")
         IPDVS.ACCESS.conflict_bucket.append("CONFLICT")
        else:
         print("Not found...")
         # return("Not found...")
     IPDVS_ACCESS.close()
     try:
      IPDVS.ACCESS.conflict_bucket[0]
      print("Not a success. Conflict deteched.")
      IPDVS.ACCESS.conflict_bucket.clear()
      # return("Not a success. Conflict deteched.")
     except:
      IndexError
      IPDVS.BINGO_BUCKET.append("BINGO")
      quote = '"'
      comma = ','
      DEFAULT_LOCAL_NAME = "anon"
      DEFAULT_PUBLIC_SLUG = "NOT PUBLIC"
      from core_operations import AlienVault
      ENCRYPTED_HASH = AlienVault.make_ALIEN_VAULT_CODES(
        HASHED_LOGIN_KEY=vcnkey_hash
       )
      # Offet by -1 to account for the header control logic
      new_member_id = str(IPDVS.ACCESS.row_counter-1)
      with open(ACCESS_CONTROL_PATH+ACCESS_CONTROL_DS, 'a') as IPDVS_ACCESS:
       IPDVS_ACCESS.write(
        str(new_member_id)+comma+\
        '1'+comma+\
        quote+vcnkey+quote+comma+\
        quote+DEFAULT_LOCAL_NAME+quote+comma+\
        quote+DEFAULT_LOCAL_NAME+quote+comma+\
        quote+ENCRYPTED_HASH+quote+comma+\
        quote+DEFAULT_PUBLIC_SLUG+quote+comma+\
        quote+'NEVER'+quote+comma+\
        quote+"IDENTITY/PHOTO/badges/triangle_portfolio.png"+quote+comma+\
        quote+"RING/ENTITY/ALIAS/VCN_DIRECTORY/"+vcnkey+"/DEFAULT_ALIAS.vcn"+quote+'\n'
       )
      # Reset the member que in case you want to add mulitiple new identities
      IPDVS.ACCESS.row_counter = 0
      IPDVS_ACCESS.close()
      IPDVS_ATTRIBUTE_DEFAULTS = [
       "## DEFAULT ALIAS",
       "DA: NO",
       "## DEFAULT UNBOUND ALIAS",
       "DUA: ANON",
       "## DEFAULT SLUG, . for the default location or put the full relative path here for the member sets",
        "## A symlink will be used to point all the relative paths inside of their 'ALIAS' folder",
       "DSLUG: RING/ENTITY/ALIAS/VCN_DIRECTORY/"+vcnkey+"/",
       "HOST: No Access",
       "PORT: No Port Specified",
       "USERNAME: Anon",
       "KEY_HASH: Defer to ACS",
       "PROTOCOL: TCP",
       "SSL: YES",
       "RANK: NOT RANKED",
       "MAX_CONNECTIONS: 0",
       "KEY_MASTER_LOCATION: DATA/KEY.es",
       "KEY_ACCESS_Location: "+RING_KEY_LOCATION
      ]
      class TEMPLATE:
       def construct_RING_template():
        from os import mkdir
        mkdir("RING/ENTITY/ALIAS/VCN_DIRECTORY/"+vcnkey)
        with open("RING/ENTITY/ALIAS/VCN_DIRECTORY/"+\
         vcnkey+"/DEFAULT_ALIAS.vcn", 'w') as RING_template:
         for i in IPDVS_ATTRIBUTE_DEFAULTS:
          RING_template.write('%s\n' % i)
        RING_template.close()
        print("Ring Template Construction: Success.")
      # we provide a formated datetime object to use on conflicts
      # conflicts may occur if you delete a username and save data, then
      # if you create the same username, the data is moved to a "checkpoint"
      from datetime import datetime as dt
      TIME_NOW = dt.now()
      TIME_NOW.strftime("%Y-%m%-d_%H-%M-%S")
      TIME_NOW = str(TIME_NOW)
      from os import path
      from shutil import move
      if path.exists("RING/ENTITY/ALIAS/VCN_DIRECTORY/"+vcnkey+"/DEFAULT_ALIAS.vcn") == True:
       move(
        "RING/ENTITY/ALIAS/VCN_DIRECTORY/"+vcnkey,
        "RING/ENTITY/ALIAS/VCN_DIRECTORY/"+vcnkey+"_"+TIME_NOW
       )
       TEMPLATE.construct_RING_template()
      else:
       TEMPLATE.construct_RING_template()
      print("The Member "+vcnkey+" was added to the system.")

  element_list_row = []

  def validate_member(vcnkey, vcnkey_hash):
   print("Validating Member Credentials...")
   with open(ACCESS_CONTROL_PATH+ACCESS_CONTROL_DS, 'r') as IPDVS_ACCESS:
    row_counter = 0
    for row in IPDVS_ACCESS:
     if row_counter == 0:
      print("Skipping Header")
      row_counter+=1
     else:
      print(row)
      IPDVS.ACCESS.element_list_row = row.replace('"', '').split(',')
      print(IPDVS.ACCESS.element_list_row)
      if IPDVS.ACCESS.element_list_row[2] == vcnkey:
       print("We found the member...")
       IPDVS.BINGO_BUCKET.append(vcnkey)
       # Now, import the hashing mechanism to check the keys.
       from core_operations import AlienVault, KEY_TEMP
       KEY_TEMP.key_holder_plain.append(IPDVS.ACCESS.element_list_row[5])
       HASH_NEEDED = AlienVault.get_ALIEN_VAULT_CODES(
        HASHED_LOGIN_KEY=vcnkey_hash
       )
       print("The Hash was: "+str(HASH_NEEDED))
       if HASH_NEEDED == True:
        print("Credentials: Matched...")
        IPDVS.WAS_VALID.append("YES")
       else:
        print("Credentials: Mismatched... Try another key.")
      else:
       print("Member unable to be located...")
   IPDVS_ACCESS.close()




Return HOME