当前位置: 首页>>代码示例>>Python>>正文


Python config.OUTPUT_DIR属性代码示例

本文整理汇总了Python中config.OUTPUT_DIR属性的典型用法代码示例。如果您正苦于以下问题:Python config.OUTPUT_DIR属性的具体用法?Python config.OUTPUT_DIR怎么用?Python config.OUTPUT_DIR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在config的用法示例。


在下文中一共展示了config.OUTPUT_DIR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: active_search

# 需要导入模块: import config [as 别名]
# 或者: from config import OUTPUT_DIR [as 别名]
def active_search(self):
        scanable_domain = set()
        for d in self.subdomains:
            scanable_domain.update(tools.scanable_subdomain(d))

        self.subdomains = set(filter(lambda x: not x.startswith('*.'), self.subdomains))
        scanable_domain.update(self.domains)

        for domain in scanable_domain:
            isext, ip = tools.check_extensive_domain(domain)
            if isext:
                self.extensive_domain.add(domain)
            if not os.path.exists(os.path.join(config.OUTPUT_DIR, '%s.txt'%domain)):
                if tools.get_domain(domain) == domain:
                    d = subDomainsBrute.SubNameBrute(target=domain, options=subDomainsBruteOpt(domain))
                else:
                    d = subDomainsBrute.SubNameBrute(target=domain, options=subDomainsBruteOpt(domain, "next_sub.txt"))
                d.run()
                d.outfile.flush()
                d.outfile.close()
            r = helper.parse_domains_brute(domain, ip)
            self.subdomains.update(r.keys())
            self.domain_ip.update(r) 
开发者ID:5alt,项目名称:ZeroScan,代码行数:25,代码来源:run.py

示例2: install_ports

# 需要导入模块: import config [as 别名]
# 或者: from config import OUTPUT_DIR [as 别名]
def install_ports():
	sqlitepath = os.path.join(config.OUTPUT_DIR, "ports.db")
	install = ''
	if not os.path.exists(sqlitepath):
		install = '''
	CREATE TABLE open(
		`ip` VARCHAR(64) NOT NULL,
		`port` INTEGER,
		`service` varchar(64),
		`comment` TEXT,
		PRIMARY KEY(`ip`, `port`)
	);
	'''
	if install:
		conn = conn = get_ports_conn()
		cursor = conn.cursor()
		cursor.execute(install)
		conn.commit()
		conn.close() 
开发者ID:5alt,项目名称:ZeroScan,代码行数:21,代码来源:helper.py

示例3: install_domains

# 需要导入模块: import config [as 别名]
# 或者: from config import OUTPUT_DIR [as 别名]
def install_domains():
	sqlitepath = os.path.join(config.OUTPUT_DIR, "domains.db")
	install = ''
	if not os.path.exists(sqlitepath):
		install = '''
	CREATE TABLE `domains`(
		`domain` varchar(255) NOT NULL,
		`ip` TEXT NOT NULL,
		`cname` varchar(255),
		`cdn` INTEGER,
		`internal` INTEGER,
		PRIMARY KEY(`domain`, `ip`)
	);
	'''
	if install:
		conn = get_domains_conn()
		cursor = conn.cursor()
		cursor.execute(install)
		conn.commit()
		conn.close() 
开发者ID:5alt,项目名称:ZeroScan,代码行数:22,代码来源:helper.py

示例4: get_scores

# 需要导入模块: import config [as 别名]
# 或者: from config import OUTPUT_DIR [as 别名]
def get_scores(self, preds, save=False):
        preds = [label_path(self.id2type[x]) for x in preds]
        def vec2type(v):
            s = []
            for i in range(len(v)):
                if v[i]:
                    s.extend(label_path(self.id2type[i]))
            return set(s)
        labels_test = [vec2type(x) for x in self.labels_test]
        if save:
            labels_test = [vec2type(x) for x in self.labels]
        acc = strict(labels_test, preds)
        _, _, macro = loose_macro(labels_test, preds)
        _, _, micro = loose_micro(labels_test, preds)

        if save:
            outfile = open(os.path.join(config.OUTPUT_DIR, self.__str__() + ".tsv"), "w")
            for x, y in zip(preds, labels_test):
                t1 = "|".join(list(x))
                t2 = "|".join(list(y))
                outfile.write(t1 + "\t" + t2 + "\n")
            outfile.close()

        return acc, macro, micro 
开发者ID:billy-inn,项目名称:NFETC,代码行数:26,代码来源:task.py

示例5: check_valid

# 需要导入模块: import config [as 别名]
# 或者: from config import OUTPUT_DIR [as 别名]
def check_valid(model):
    file = "%s/All/test.pred.%s.csv" % (config.OUTPUT_DIR, model)
    try:
        df = pd.read_csv(file)
        if df.shape[0] == config.TEST_SIZE:
            return True
        else:
            return False
    except:
        return False 
开发者ID:ChenglongChen,项目名称:kaggle-HomeDepot,代码行数:12,代码来源:get_stacking_feature_conf.py

示例6: main

# 需要导入模块: import config [as 别名]
# 或者: from config import OUTPUT_DIR [as 别名]
def main(options):

    # create sub folder
    subm_folder = "%s/ensemble_selection"%config.SUBM_DIR
    os_utils._create_dirs( [subm_folder] )
    subm_prefix = "%s/test.pred.[%s]" % (subm_folder, options.outfile)

    # get model list
    log_folder = "%s/level%d_models"%(config.LOG_DIR, options.level-1)
    model_list = get_model_list(log_folder, options.size)

    # get instance splitter
    if options.level not in [2, 3]:
        inst_splitter = None
    elif options.level == 2:
        inst_splitter = splitter_level2
    elif options.level == 3:
        inst_splitter = splitter_level3

    ees = ExtremeEnsembleSelection(
            model_folder=config.OUTPUT_DIR, 
            model_list=model_list, 
            subm_prefix=subm_prefix, 
            weight_opt_max_evals=options.weight_opt_max_evals, 
            w_min=-1., 
            w_max=1., 
            inst_subsample=options.inst_subsample,
            inst_subsample_replacement=options.inst_subsample_replacement,
            inst_splitter=inst_splitter,
            model_subsample=options.model_subsample,
            model_subsample_replacement=options.model_subsample_replacement,
            bagging_size=options.bagging_size, 
            init_top_k=options.init_top_k,
            epsilon=options.epsilon,
            multiprocessing=False, 
            multiprocessing_num_cores=config.NUM_CORES,
            enable_extreme=options.enable_extreme,
            random_seed=config.RANDOM_SEED
        )
    ees.go() 
开发者ID:ChenglongChen,项目名称:kaggle-HomeDepot,代码行数:42,代码来源:extreme_ensemble_selection.py

示例7: refit

# 需要导入模块: import config [as 别名]
# 或者: from config import OUTPUT_DIR [as 别名]
def refit(self):
        X_train, y_train, X_test = self.feature._get_train_test_data()
        if self.plot_importance:
            feature_names = self.feature._get_feature_names()
            self.learner.fit(X_train, y_train, feature_names)
            y_pred = self.learner.predict(X_test, feature_names)
        else:
            self.learner.fit(X_train, y_train)
            y_pred = self.learner.predict(X_test)
        
        id_test = self.feature.data_dict["id_test"].astype(int)

        # save
        fname = "%s/%s/test.pred.%s.csv"%(config.OUTPUT_DIR, "All", self.__str__())
        pd.DataFrame({"id": id_test, "prediction": y_pred}).to_csv(fname, index=False)
        if hasattr(self.learner.learner, "predict_proba"):
            if self.plot_importance:
                feature_names = self.feature._get_feature_names()
                y_proba = self.learner.learner.predict_proba(X_test, feature_names)
            else:
                y_proba = self.learner.learner.predict_proba(X_test)
            fname = "%s/%s/test.proba.%s.csv"%(config.OUTPUT_DIR, "All", self.__str__())
            columns = ["proba%d"%i for i in range(y_proba.shape[1])]
            df = pd.DataFrame(y_proba, columns=columns)
            df["id"] = id_test
            df.to_csv(fname, index=False)

        # submission
        fname = "%s/test.pred.%s.[Mean%.6f]_[Std%.6f].csv"%(
            config.SUBM_DIR, self.__str__(), self.rmse_cv_mean, self.rmse_cv_std)
        pd.DataFrame({"id": id_test, "relevance": y_pred}).to_csv(fname, index=False)

        # plot importance
        if self.plot_importance:
            ax = self.learner.plot_importance()
            ax.figure.savefig("%s/%s.pdf"%(config.FIG_DIR, self.__str__()))
        return self 
开发者ID:ChenglongChen,项目名称:kaggle-HomeDepot,代码行数:39,代码来源:task.py

示例8: create_directories

# 需要导入模块: import config [as 别名]
# 或者: from config import OUTPUT_DIR [as 别名]
def create_directories():
    """Create all the directories in the /data directories which are used for preprocessing/training/evaluating."""

    directories = [TILES_DIR, WATER_BITMAPS_DIR, WGS84_DIR, LABELS_DIR, MODELS_DIR, OUTPUT_DIR, TENSORBOARD_DIR]
    for directory in directories:
        save_makedirs(directory) 
开发者ID:treigerm,项目名称:WaterNet,代码行数:8,代码来源:io_util.py

示例9: __init__

# 需要导入模块: import config [as 别名]
# 或者: from config import OUTPUT_DIR [as 别名]
def __init__(self, domain, dictionary="subnames.txt"):
        self.file= "subDomainsBrute"+os.sep+"dict"+os.sep+dictionary
        self.threads = 200
        self.output = os.path.join(config.OUTPUT_DIR, '%s.txt'%domain)
        self.i = False
        self.full_scan = False 
开发者ID:5alt,项目名称:ZeroScan,代码行数:8,代码来源:run.py

示例10: process_subdomain

# 需要导入模块: import config [as 别名]
# 或者: from config import OUTPUT_DIR [as 别名]
def process_subdomain(self):
        helper.install_domains()
        sqlitepath = os.path.join(config.OUTPUT_DIR,'domains.db')
        conn = db.connect(sqlitepath)
        conn.text_factory = str
        cursor = conn.cursor()
        sql = "INSERT INTO domains(domain, ip, cname, cdn, internal) VALUES(?, ?, ?, ?, ?)"

        ips = set()
        cdn_ip = set()

        self.subdomains.update(self.domains)

        for domain in self.subdomains:
            cname = tools.get_cname(domain)
            cdn = tools.get_cdn(domain, cname)
            ipl = self.domain_ip.get(domain, None)
            if cdn:
                self.cdn_domain.add(domain)
            if not ipl:
                ipl = tools.resolve_host_ip(domain)
            else:
                ipl = ipl.split(",")
            for ip in ipl:
                internal = tools.is_internal_ip(ip)
                if not cdn and not internal:
                    ips.add(ip)
                elif cdn:
                    self.takeover_domain_check.add((domain, ip, cname))
                    cdn_ip.add(ip)
                if not internal:
                    self.internal_domain.add(domain)
                try:
                    status = cursor.execute(sql, (domain, ip, cname, cdn, internal))
                    conn.commit()
                except Exception as e:
                    print e
        self.ips = ips-cdn_ip
        with open(os.path.join(config.OUTPUT_DIR,config.IPS), 'w') as f:
            f.write('\n'.join(self.ips).strip()) 
开发者ID:5alt,项目名称:ZeroScan,代码行数:42,代码来源:run.py

示例11: report_subdomain

# 需要导入模块: import config [as 别名]
# 或者: from config import OUTPUT_DIR [as 别名]
def report_subdomain(self):
        domains = set()
        conn = helper.get_domains_conn()
        cur = conn.cursor()
        cur.execute("SELECT * FROM domains WHERE cdn=0 and internal=0")
        rows = cur.fetchall()
        for row in rows:
            domain, ip, cname, cdn, internal = row
            domains.add(domain)
        json.dump(list(domains), open(os.path.join(config.OUTPUT_DIR, "all_subdomains.json"), "w")) 
开发者ID:5alt,项目名称:ZeroScan,代码行数:12,代码来源:run.py

示例12: report

# 需要导入模块: import config [as 别名]
# 或者: from config import OUTPUT_DIR [as 别名]
def report(self):
        json.dump(self.ip_all, open(os.path.join(config.OUTPUT_DIR, "ip_all.json"), "w"))
        json.dump(list(self.cdn_domain), open(os.path.join(config.OUTPUT_DIR, "cdn_domain.json"), "w"))
        json.dump(list(self.internal_domain), open(os.path.join(config.OUTPUT_DIR, "internal_domain.json"), "w"))
        json.dump(list(self.extensive_domain), open(os.path.join(config.OUTPUT_DIR, "extensive_domain.json"), "w"))

        with open(os.path.join(config.OUTPUT_DIR, 'domain_takeover.txt'), 'a') as f:
            f.write('\n'.join(self.takeover_domain).strip())
        tools.report(self.ip_all, outname=config.REPORT_FILENAME) 
开发者ID:5alt,项目名称:ZeroScan,代码行数:11,代码来源:run.py

示例13: get_domains_conn

# 需要导入模块: import config [as 别名]
# 或者: from config import OUTPUT_DIR [as 别名]
def get_domains_conn():
	sqlitepath = os.path.join(config.OUTPUT_DIR, "domains.db")
	conn = db.connect(sqlitepath)
	conn.text_factory = str
	return conn 
开发者ID:5alt,项目名称:ZeroScan,代码行数:7,代码来源:helper.py

示例14: get_ports_conn

# 需要导入模块: import config [as 别名]
# 或者: from config import OUTPUT_DIR [as 别名]
def get_ports_conn():
	sqlitepath = os.path.join(config.OUTPUT_DIR, "ports.db")
	conn = db.connect(sqlitepath)
	conn.text_factory = str
	return conn 
开发者ID:5alt,项目名称:ZeroScan,代码行数:7,代码来源:helper.py

示例15: cv

# 需要导入模块: import config [as 别名]
# 或者: from config import OUTPUT_DIR [as 别名]
def cv(self):
        start = time.time()
        if self.verbose:
            self.logger.info("="*50)
            self.logger.info("Task")
            self.logger.info("      %s" % str(self.__str__()))
            self.logger.info("Param")
            self._print_param_dict(self.learner.param_dict)
            self.logger.info("Result")
            self.logger.info("      Run      RMSE        Shape")
    
        rmse_cv = np.zeros(self.n_iter)
        for i in range(self.n_iter):
            # data
            X_train, y_train, X_valid, y_valid = self.feature._get_train_valid_data(i)
            # fit
            self.learner.fit(X_train, y_train)
            y_pred = self.learner.predict(X_valid)
            rmse_cv[i] = dist_utils._rmse(y_valid, y_pred)
            # log
            self.logger.info("      {:>3}    {:>8}    {} x {}".format(
                i+1, np.round(rmse_cv[i],6), X_train.shape[0], X_train.shape[1]))
            # save
            fname = "%s/Run%d/valid.pred.%s.csv"%(config.OUTPUT_DIR, i+1, self.__str__())
            df = pd.DataFrame({"target": y_valid, "prediction": y_pred})
            df.to_csv(fname, index=False, columns=["target", "prediction"])
            if hasattr(self.learner.learner, "predict_proba"):
                y_proba = self.learner.learner.predict_proba(X_valid)
                fname = "%s/Run%d/valid.proba.%s.csv"%(config.OUTPUT_DIR, i+1, self.__str__())
                columns = ["proba%d"%i for i in range(y_proba.shape[1])]
                df = pd.DataFrame(y_proba, columns=columns)
                df["target"] = y_valid
                df.to_csv(fname, index=False)

        self.rmse_cv_mean = np.mean(rmse_cv)
        self.rmse_cv_std = np.std(rmse_cv)
        end = time.time()
        _sec = end - start
        _min = int(_sec/60.)
        if self.verbose:
            self.logger.info("RMSE")
            self.logger.info("      Mean: %.6f"%self.rmse_cv_mean)
            self.logger.info("      Std: %.6f"%self.rmse_cv_std)
            self.logger.info("Time")
            if _min > 0:
                self.logger.info("      %d mins"%_min)
            else:
                self.logger.info("      %d secs"%_sec)
            self.logger.info("-"*50)
        return self 
开发者ID:ChenglongChen,项目名称:kaggle-HomeDepot,代码行数:52,代码来源:task.py


注:本文中的config.OUTPUT_DIR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。