mainscript.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:CIDDS 作者: markusring 项目源码 文件源码
def init(browsing, mailing, printing, copyfiles, copysea, ssh, meeting, offline, private, breaks, attacking, t):
    activities = createActivityList(browsing, mailing, printing, copyfiles, copysea, ssh, meeting, offline, private, breaks, attacking)

    time.sleep(2)

    parser = SafeConfigParser()
    parser.read("packages/system/config.ini")

    subnet, host, hostname = getSubnetHostAndHostname()
    global myID

    if platform.system() == "Linux":
        myID = str(getnode())
    else:
        # For Windows, something must be trickled, since getnode () returns an incorrect value
        hexMac = check_output(["getmac"])[162:180]
        hexMacNoDash = hexMac.replace("-", "")
        intMac = int(hexMacNoDash, 16)
        myID = str(intMac)

    global pathForLog
    if platform.system() == "Linux":
        pathForLog = "/home/debian/log/"
    else:
        pathForLog = "M:\\"

    # In endless loop perform different activities
    try:    
        while True:

            if isWorkday(parser) and isWorkingHours(parser):
                    doSomething(activities)

            else:
                # Should be just the end of his work, he must wait until he has to work again
                time.sleep(random.randint(1, 15)*60 - random.randint(1, 55))

    except KeyboardInterrupt:
        echoC(__name__, "SCRIPT STOPPED: KEYBOARDINTERRUPT")    
        sys.exit(0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号