Example #1
0
def __get_preceding_deliveryprocess_counters():
    '''
    Get the delivery security process objects counters and return a Tuple that contains them.
    The Security Report from where we are looking for the counters is located in the
    'Reports History' folder. 

    Return:
    A Tuple that has the Delivery Security process counters in the following order, 
    evaluation,
    qualification,
    security_audit,
    testing,
    in_life
    '''
    from datetime import datetime
    date = datetime.now()
    
    year = date.year
    month = date.month-1

    if date.month-1 == 0:
        year = date.year-1
        month = 12

    last_month = date.replace(year, month, 1)

    preceding_report_file_name = str(last_month.year) + '-' + str(last_month.month) + variables.SECURITY_REPORT_FILE_NAME
    
    import os.path
    from report_creation_utils import xml_utils
    if os.path.isfile(os.path.join(variables.SECURITY_PROJECTS_DIRPATH, variables.HISTORY_FOLDER_NAME, preceding_report_file_name)):
        last_month_security_report_path = os.path.join(variables.SECURITY_PROJECTS_DIRPATH, variables.HISTORY_FOLDER_NAME, preceding_report_file_name)
        
        evaluation_objects_counter = xml_utils.get_attribute_value(last_month_security_report_path, 'EvaluationObjects', 'counter')
        qualification_objects_counter = xml_utils.get_attribute_value(last_month_security_report_path, 'QualificationObjects', 'counter')
        security_audit_objects_counter = xml_utils.get_attribute_value(last_month_security_report_path, 'SecurityAuditObjects', 'counter')
        testing_objects_counter = xml_utils.get_attribute_value(last_month_security_report_path, 'TestingObjects', 'counter')
        in_life_objects_counter = xml_utils.get_attribute_value(last_month_security_report_path, 'InLifeObjects', 'counter')

        return [evaluation_objects_counter,
                qualification_objects_counter,
                security_audit_objects_counter,
                testing_objects_counter,
                in_life_objects_counter]

    return [0, 0, 0, 0, 0]
Example #2
0
def __get_preceding_risks_counters():
    '''
    Get the High risks and Light risks counters and return a Tuple that contains them.
    The Security Report from where we are looking for the counters is located in the
    'Reports History' folder. 

    Return:
    A Tuple that has the Delivery Security process counters in the following order, 
    High risks,
    Moderate risks,
    Light risks
    '''
    from datetime import datetime
    date = datetime.now()
    
    year = date.year
    month = date.month-1

    if date.month-1 == 0:
        year = date.year-1
        month = 12

    last_month = date.replace(year, month, 1)

    preceding_report_file_name = str(last_month.year) + '-' + str(last_month.month) + variables.SECURITY_REPORT_FILE_NAME
    
    import os.path
    from report_creation_utils import xml_utils
    if os.path.isfile(os.path.join(variables.SECURITY_PROJECTS_DIRPATH, variables.HISTORY_FOLDER_NAME, preceding_report_file_name)):
        last_month_security_report_path = os.path.join(variables.SECURITY_PROJECTS_DIRPATH, variables.HISTORY_FOLDER_NAME, preceding_report_file_name)
        
        high_risks_counter = xml_utils.get_attribute_value(last_month_security_report_path, 'HighRisks', 'counter')
        moderate_risks_counter = xml_utils.get_attribute_value(last_month_security_report_path, 'ModerateRisks', 'counter')
        light_risks_counter = xml_utils.get_attribute_value(last_month_security_report_path, 'LightRisks', 'counter')
        
        return [high_risks_counter,
                moderate_risks_counter,
                light_risks_counter]

    return [0, 0, 0]
Example #3
0
def __get_preceding_securityprogress_counters():
    '''
    Get the Security Progress objects counters and return a Tuple that contains them.
    The Security Report from where we are looking for the counters is located in the
    'Reports History' folder. 

    Return:
    A Tuple that has the Security Progress counters in the following order, 
    Not started,
    In progresss,
    On Hold,
    Done,
    Not evaluated
    '''
    from datetime import datetime
    date = datetime.now()
    last_month = date.replace(date.year, date.month-1, 1)

    preceding_report_file_name = str(last_month.year) + '-' + str(last_month.month) + variables.SECURITY_REPORT_FILE_NAME
    
    import os.path
    from report_creation_utils import xml_utils
    if os.path.isfile(os.path.join(variables.SECURITY_PROJECTS_DIRPATH, variables.HISTORY_FOLDER_NAME, preceding_report_file_name)):
        last_month_security_report_path = os.path.join(variables.SECURITY_PROJECTS_DIRPATH, variables.HISTORY_FOLDER_NAME, preceding_report_file_name)
        
        are_notstarted_counter = xml_utils.get_attribute_value(last_month_security_report_path, 'NotStartedObjects', 'counter')
        are_inprogresss_counter = xml_utils.get_attribute_value(last_month_security_report_path, 'InProgressObjects', 'counter')
        are_onhold_counter = xml_utils.get_attribute_value(last_month_security_report_path, 'OnHoldObjects', 'counter')
        are_done_counter = xml_utils.get_attribute_value(last_month_security_report_path, 'DoneObjects', 'counter')
        are_notevaluated_counter = xml_utils.get_attribute_value(last_month_security_report_path, 'NotEvaluatedObjects', 'counter')
        
        
        return [are_notstarted_counter,
                are_inprogresss_counter,
                are_onhold_counter,
                are_done_counter,
                are_notevaluated_counter]

    return [0, 0, 0, 0]
Example #4
0
def __get_light_risks_counter(xml_file):
    return xml_utils.get_attribute_value(xml_file, 'Risks', 'lightRiskCounter')
Example #5
0
def __get_moderate_risks_counter(xml_file):
    return xml_utils.get_attribute_value(xml_file, 'Risks', 'moderateRiskCounter')
Example #6
0
def is_eiot_object(xml_file):
    '''Return a boolean that indicates if the object is considered as a eIoT (enterprise Internet of Things) one.'''
    return xml_utils.get_attribute_value(xml_file, 'type', 'EIOT') == 'true'
Example #7
0
def is_others_object(xml_file):
    '''Return a boolean that indicates if the object is considered as a Others one.'''
    return xml_utils.get_attribute_value(xml_file, 'type', 'OTHER') == 'true'
Example #8
0
def is_b2c_object(xml_file):
    '''Return a boolean that indicates if the object is considered as a B2C one.'''
    return xml_utils.get_attribute_value(xml_file, 'type', 'B2C') == 'true'