def run(self):
     get_sensitive_keywords()
     print(self.sensitive_keywords)
     sum_items = 0
     sum_tp = 0
     sum_fp = 0
     sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf8')
     api_folders = get_first_layer_files(
         "E:\\Lab Work\\dataset_science\\API_Docs\\Countly_API_Docs_test\\")
     sum_acs = 0
     for api_folder in api_folders:
         logger.info("Processing Folder:" + str(api_folder))
         (items, tp, fp, acs) = self.process_api(api_folder)
         sum_acs = sum_acs + acs
         sum_items = sum_items + items
         sum_tp = sum_tp + tp
         sum_fp = sum_fp + fp
     print("SUM=" + str(sum_acs))
     # print("SUM_ITEMS=" + str(sum_items))
     # print("SUM_TP=" + str(sum_tp))
     # print("SUM_FP=" + str(sum_fp))
     print("-----Sensitive Results-----")
     for sensitive_result in self.sensitive_results:
         print(sensitive_result)
     # logger.info("API Count=" + str(api_cnt))
     logger.info("Sensitive API Count=" + str(len(self.sensitive_results)))
Exemple #2
0
 def run(self):
     get_sensitive_keywords()
     api_folders = get_first_layer_files(Config.target_folder)
     for api_folder in api_folders:
         logger.info("Processing Folder:" + str(api_folder))
         self.process_api(api_folder)
     print("-----Sensitive Results-----")
     print("APIs Count=" + str(len(self.apis)))
     print("Sensitive APIs Count=" + str(len(self.sensitive_results)))
Exemple #3
0
def check_api_by_class(temp_class_name, temp_api):
    class_name = temp_class_name.lower()
    tag = False
    if "identify" in class_name or "userproperty" in class_name or "identifies" in class_name or "userproperties" in class_name:
        tag = True
    api = temp_api.lower()
    if tag and (api == "add" or api == "set" or api == "setonce"
                or api == "append"):
        return True, ["GeneralUserProperty"]
    if api == "onevent" and "umeng" in class_name:
        return True, ["GeneralLogEvent"]
    if api == "logcustom" or api == "trackevent" or api == "logevent" or api == "logeventasync" or api == "logeventsync":
        return True, ["GeneralLogEvent"]
    if api == "setuserproperty" or api == "adduserproperty" or api == "setuserproperties" or api == "adduserpropertoes":
        return True, ["GeneralUserProperty"]
    sensitive_keywords = get_sensitive_keywords()
    is_sensitive = False
    privacy_item = ""
    for keywords in sensitive_keywords:
        is_sensitive = True
        for keyword in keywords:
            if keyword.lower() not in api:
                is_sensitive = False
        if is_sensitive:
            privacy_item = keywords
            break
    if is_sensitive:
        return True, privacy_item
    else:
        return False, privacy_item
 def run(self):
     self.sensitive_keywords = get_sensitive_keywords()
     sum_tp = 0
     sum_fp = 0
     for api_folder in self.api_folders:
         (tp, fp) = self.process_api(api_folder)
         sum_tp = sum_tp + tp
         sum_fp = sum_fp + fp
Exemple #5
0
 def run(self):
     self.sensitive_keywords = get_sensitive_keywords()
     sum_tp = 0
     sum_fp = 0
     sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf8')
     api_folders = get_first_layer_folders(Config.target_folder)
     for api_folder in api_folders:
         (tp, fp) = self.process_api(api_folder)
         sum_tp = sum_tp + tp
         sum_fp = sum_fp + fp
Exemple #6
0
def check_api_by_keywords(temp_api):
    api = temp_api.lower()
    if api == "logcustom" or api == "trackevent" or api == "logevent" or api == "onevent" or api == "logeventasync" or api == "logeventsync":
        return True, ["event"]
    if api == "setuserproperty" or api == "adduserproperty" or api == "setuserproperties" or api == "adduserpropertoes":
        return True, ["property"]
    sensitive_keywords = get_sensitive_keywords()
    is_sensitive = False
    privacy_item = ""
    for keywords in sensitive_keywords:
        is_sensitive = True
        for keyword in keywords:
            if keyword.lower() not in api:
                is_sensitive = False
        if is_sensitive:
            privacy_item = keywords
            break
    if is_sensitive:
        return True, privacy_item
    else:
        return False, privacy_item