lib.core.startup

Package lib :: Package core :: Module startup |
[hide private]
[frames] | no frames]

# Source Code for Module lib.core.startup

     1  # Copyright (C) 2010-2013 Claudio Guarnieri.
     2  # Copyright (C) 2014-2016 Cuckoo Foundation.
     3  # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
     4  # See the file 'docs/LICENSE' for copying permission.
     5
     6  import ctypes
     7  import logging
     8
     9  from lib.common.defines import KERNEL32, SYSTEMTIME
    10  from lib.common.results import NetlogHandler
    11
    12  log = logging.getLogger()
    13
    14 -def init_logging():
    15      """Initialize logger."""
    16      formatter = logging.Formatter("%(asctime)s [%(name)s] %(levelname)s: %(message)s")
    17      sh = logging.StreamHandler()
    18      sh.setFormatter(formatter)
    19      log.addHandler(sh)
    20
    21      nh = NetlogHandler()
    22      nh.setFormatter(formatter)
    23      log.addHandler(nh)
    24
    25      log.setLevel(logging.DEBUG)
    26
    27 -def set_clock(clock):
    28      st = SYSTEMTIME()
    29      st.wYear = clock.year
    30      st.wMonth = clock.month
    31      st.wDay = clock.day
    32      st.wHour = clock.hour
    33      st.wMinute = clock.minute
    34      st.wSecond = clock.second
    35      st.wMilliseconds = 0
    36      KERNEL32.SetLocalTime(ctypes.byref(st))
    37