Example #1
0
    def init_lock_user_info(self, user):
        logger.info('init lock user info: [{0}].'.format(user))
        if not self.config.get('auto_order_use_proxy', True):  # 自助下单,默认使用代理IP
            host, port = None, 8888
            auto_order.init_user_info(user, host, port)
        elif len(self.ip_pool) != 0:
            ip_info = random.choice(self.ip_pool)
            host, port = self.get_proxy(ip_info)
            auto_order.init_user_info(user, host, port)

    def execute(self):
        # auto_order.load_goods_lock_info()
        self.load_goods_user_info()  # 从excel读取用户信息和产品订阅信息
        self.load_user_status()  # 读取过去存储的用户字典
        proxy_num = self.config.get('ip_pool_num', 1)
        self.update_proxies(proxy_num)
        self.activate_workers()  # 激活workers,开始监控
        self.start_to_monitor()
        pass


if __name__ == '__main__':
    util.config_logger('auto_order_reminder')

    import config
    reminder = AutoOrderReminder(config.AUTO_ORDER_REMINDER_CONFIG)
    reminder.execute()
    # reminder.send_alert_mail('测试程序2')
    pass
Example #2
0
from __future__  import print_function
import os, sys, re, MySQLdb, json, time, argparse
dirNm, execName = os.path.split(os.path.realpath(sys.argv[0]))
sys.path.append(os.path.realpath(os.path.join(dirNm, "../libexec")))
sys.path.append(os.path.realpath(os.path.join(dirNm, "../site")))

from XALTdb      import XALTdb
from SitePkg     import translate
from util        import files_in_tree, capture, config_logger
from progressBar import ProgressBar
import warnings, getent
warnings.filterwarnings("ignore", "Unknown table.*")

ConfigBaseNm = "xalt_db"
ConfigFn     = ConfigBaseNm + ".conf"
logger       = config_logger()

class CmdLineOptions(object):
  def __init__(self):
    pass
  
  def execute(self):
    parser = argparse.ArgumentParser()
    parser.add_argument("--delete",      dest='delete', action="store_true", help="delete files after reading")
    parser.add_argument("--timer",       dest='timer',  action="store_true", help="Time runtime")
    parser.add_argument("--reverseMapD", dest='rmapD',  action="store",      help="Path to the directory containing the json reverseMap")
    args = parser.parse_args()
    return args


def remove_files(fileA):
Example #3
0
check_script_base = "iptables-liveupdate"

# -------------------------- MAIN PROGRAM -------------------------- #
if __name__ == "__main__":
    cmd_arguments = parse_std_arguments("""
        On a list of remote hosts, check differences between 'stored'
        and 'in-kernel' IPtables IPv4 and IPv6 configurations.
        For this to work, for each host, the username used must have
        SCP write-access to its home directory (without SUDO),
        and SUDO ALL access. If '--live-update' is specified, the
        script ALSO modifies the 'in-kernel' IPtables rules to make them
        satisfy the requirements of the 'stored' IPtables rules.
        """,
                                        p_add_live_update=1)

    config_logger(cmd_arguments)
    log = logging.getLogger()

    log.info("Starting IPtables liveupdate driver script...")

    hosts_config = read_hosts_config(cmd_arguments.cfgfile)

    our_time_str = str(int(time.time()))

    log.debug("Computed ephemeral time string = {0} ...".format(our_time_str))

    src_script = "{0}.py".format(check_script_base)
    dest_script = "{0}-{1}.py".format(check_script_base, our_time_str)

    timeout_str = "-o ConnectTimeout={0}".format(cmd_arguments.timeout)
Example #4
0
        # proxy_num = self.config.get('ip_pool_num', 1)
        while True:
            try:
                while len(self.message_queue) != 0:
                    message = self.message_queue.pop()
                    if message == 'user_status_dict':
                        self.save_user_status()
                    elif message == 'goods_sale_info_dict':
                        self.save_goods_sale_info()
                # self.update_proxies(proxy_num)
                time.sleep(10)
            except Exception as e:
                logger.exception('on sale reminder exception: [{0}].'.format(e))

    def execute(self):
        self.load_goods_user_info()     # 从excel读取用户信息和产品订阅信息
        self.load_user_status()         # 读取过去存储的用户字典
        self.load_goods_sale_info()     # 读取当前产品的售价和折扣信息
        self.activate_workers()         # 激活workers,开始监控
        self.start_to_monitor()
        pass


if __name__ == '__main__':
    util.config_logger('on_sale_reminder')

    import config
    reminder = OnSaleReminder(config.ON_SALE_REMINDER_CONFIG)
    reminder.execute()
    pass
Example #5
0
#!/usr/bin/env python
# -*- python -*-
#
# Git Version: @git@

from __future__ import print_function
from util import config_logger, extract_compiler
import os, sys, time, platform

logger = config_logger()


def print_assembly(uuid, fn, version, syshost, compiler, epochStr):
    user = os.environ.get("USER", "unknown")
    osName = platform.system() + "_%_%_" + platform.release()

    year = time.strftime("%Y")
    date = time.strftime("%c").replace(" ", "_%_%_")

    try:
        f = open(fn, "w")
        f.writelines("\t.section .xalt\n")
        f.writelines("\t.asciz \"XALT_Link_Info\"\n"
                     )  #this is how to find the section in the exec
        # Print cushion
        f.writelines("\n\t.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n")
        f.writelines("\t.asciz \"<XALT_Version>%%" + version + "%%\"\n")
        f.writelines("\t.asciz \"<Build.Syshost>%%" + syshost + "%%\"\n")
        f.writelines("\t.asciz \"<Build.compiler>%%" + compiler + "%%\"\n")
        f.writelines("\t.asciz \"<Build.OS>%%" + osName + "%%\"\n")
        f.writelines("\t.asciz \"<Build.User>%%" + user + "%%\"\n")