|
@@ -0,0 +1,50 @@
|
|
|
+#!/usr/bin/env python
|
|
|
+# -*- encoding: utf-8 -*-
|
|
|
+"""
|
|
|
+@Contact : liuyuqi.gov@msn.cn
|
|
|
+@Time : 2024/06/22
|
|
|
+@License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
|
|
|
+@Desc : command line params or config from file
|
|
|
+"""
|
|
|
+
|
|
|
+import sys,os,re
|
|
|
+import argparse
|
|
|
+from collections import OrderedDict
|
|
|
+from .utils.frozen_dir import get_app_path
|
|
|
+
|
|
|
+def parse_args():
|
|
|
+ """
|
|
|
+ parse command line params
|
|
|
+ """
|
|
|
+ parser = argparse.ArgumentParser(description='search domain')
|
|
|
+ parser.add_argument('command', help='command: generate, search', choices=['generate','search', 'help','version'] , default='help')
|
|
|
+ parser.add_argument('--export_all', action='store_true', help='export all domain')
|
|
|
+ parser.add_argument(
|
|
|
+ "--input", help="set input domain list file,eg: domain.txt", type=str, default="domain.txt")
|
|
|
+ parser.add_argument(
|
|
|
+ "--output", help="set output domain result list file,eg: result.txt", type=str, default="result.txt")
|
|
|
+
|
|
|
+ parser.add_argument('--lang', choices=['zh', 'en'], default='en',help='language')
|
|
|
+ parser.add_argument('--domain', default='com',help='input some domain, plilt with ","')
|
|
|
+ parser.add_argument('--keyword', default='', help='input some keyword, spilt with ","')
|
|
|
+ parser.add_argument('--position', default='prefix',choices=['prefix', 'suffix'], help='choose generate str positon')
|
|
|
+ args = parser.parse_args()
|
|
|
+
|
|
|
+ # remove None
|
|
|
+ command_line_conf = OrderedDict(
|
|
|
+ {k: v for k, v in args.__dict__.items() if v is not None}
|
|
|
+ )
|
|
|
+ system_conf = user_conf = custom_conf = OrderedDict()
|
|
|
+ system_conf.update(command_line_conf)
|
|
|
+
|
|
|
+ app_path = get_app_path()
|
|
|
+ system_conf["app_path"] = app_path
|
|
|
+ return system_conf
|
|
|
+
|
|
|
+def _read_custom_conf(config_path: str) -> OrderedDict:
|
|
|
+ """read custom config file"""
|
|
|
+ pass
|
|
|
+
|
|
|
+def _read_user_conf() -> OrderedDict:
|
|
|
+ """read user config file"""
|
|
|
+ pass
|