Python uuid.getnode方法代码示例

Python uuid.getnode方法代码示例

示例1: init

import uuid 

def __init__(self, email, password):
        self.token=""
        self.email = email
        self.password = password
        hardware_address = str(uuid.getnode()).encode('utf-8')
        self.device_token = hashlib.md5(hardware_address).hexdigest()
        self.session = requests.Session()
        self.token = self.login()
        basic_info = self.get_basic_info()
        self.categories = basic_info["categoryTypes"]
        # self.months = basic_info["GB.months"]
        self.statements = basic_info["accounts"]
        self.fieldnames = [u'id', u'label', u'description', u'date', u'account', u'category',
                           u'subcategory', u'duplicated', u'currency',
                           u'value', u'deleted']
        self.category_resolver = {}
        for categ in self.categories:
            for sub_categ in categ['categories']:
                self.category_resolver[sub_categ['id']] = \
                    (categ['name'], sub_categ['name'])

        self.account_resolver = {}
        for account in self.statements:
            for sub_account in account['statements']:
                self.account_resolver[sub_account['id']] = sub_account['name'] 

开发者ID:hsadok,项目名称:guiabolso2csv,代码行数:27,代码来源:guia_bolso.py

示例2: test_lock_id_default

import uuid 

def test_lock_id_default(self):

        expected = '%012x' % uuid.getnode()

        k = zkutil.lock_id()
        dd(config)
        dd(k)
        self.assertEqual(expected, k.split('-')[0])

        k = zkutil.lock_id(node_id=None)
        dd(k)
        self.assertEqual(expected, k.split('-')[0])

        config.zk_node_id = 'a'
        k = zkutil.lock_id(node_id=None)
        dd(k)
        self.assertEqual('a', k.split('-')[0]) 

开发者ID:bsc-s2,项目名称:pykit,代码行数:19,代码来源:test_zkutil.py

示例3: get_info

import uuid 

def get_info(self):
        macaddr = uuid.getnode()
        macaddr = ':'.join(("%012X" % macaddr)[i : i + 2] for i in range(0, 12, 2))
        
        fingerprint = Kdatabase().get_obj("fingerprint")

        return {
            "user_id" : Kdatabase().get_obj("setting")["username"],
            "fullname" : Kdatabase().get_obj("setting")["username"],
            "distro" : common.get_distribution(),
            "os_name" : platform.system(),
            "macaddr" : macaddr,
            "user" : getpass.getuser(),
            "localip" : common.get_ip_gateway(),
            "hostname" : platform.node(),
            "platform" : platform.platform(),
            "version" : constant.VERSION,
            "open_ports" : len(fingerprint["port"]["current"]),
            "accounts" : len(fingerprint["account"]["current"]),
            "uuid" : Kdatabase().get_obj("basic")["uuid"],
            "startup_counts": Kdatabase().get_obj("basic")["startup_counts"]
        } 

开发者ID:turingsec,项目名称:marsnake,代码行数:24,代码来源:init.py

示例4: init

import uuid 

def __init__(self, account, password):

        # 初始化父类
        super(gfLoginSession, self).__init__(account=account, password=password)

        # TODO 从系统中读取磁盘编号
        self.disknum = "S2ZWJ9AF517295"
        self.mac_address = ("".join(c + "-" if i % 2 else c for i, c in \
                                    enumerate(hex(uuid.getnode())[2:].zfill(12)))[:-1]).upper()
        # 校验码的正则表达式
        self.code_rule = re.compile("^[A-Za-z0-9]{5}$")

        # 交易用的sessionId
        self._dse_sessionId = None

        # 融资融券标志
        self.margin_flags = False 

开发者ID:vex1023,项目名称:vxTrader,代码行数:19,代码来源:gfTrader.py

示例5: init

import uuid 

def __init__(self, account, password):

        # 初始化父类
        super(yjbLoginSession, self).__init__(account=account, password=password)

        # 初始化登录参数
        self.mac_address = ("".join(c + "-" if i % 2 else c for i, c in \
                                    enumerate(hex(uuid.getnode())[2:].zfill(12)))[:-1]).upper()

        # TODO disk_serial_id and cpuid machinecode 修改为实时获取
        self.disk_serial_id = "ST3250890AS"
        self.cpuid = "-41315-FA76111D"
        self.machinecode = "-41315-FA76111D"

        # 校验码规则
        self.code_rule = re.compile("^[0-9]{4}$")

        if datetime.now() > datetime(year=2016, month=11, day=30, hour=0):
            # raise TraderAPIError('佣金宝交易接口已于2016年11月30日关闭')
            logger.warning('佣金宝交易接口已于2016年11月30日关闭')
        else:
            logger.warning('佣金宝交易接口将于2016年11月30日关闭') 

开发者ID:vex1023,项目名称:vxTrader,代码行数:24,代码来源:yjbTrader.py

示例6: network

import uuid 

def network(environ, response, parameter=None):
    status = "200 OK"
    
    header = [
        ("Content-Type", "application/json"),
        ("Cache-Control", "no-store, no-cache, must-revalidate"),
        ("Expires", "0")
    ]

    result = {
        "hostname": socket.gethostname(),
        "ip": socket.gethostbyname(socket.gethostname()),
        "ipv4": requests.get('https://api.ipify.org').text,
        "ipv6": requests.get('https://api6.ipify.org').text,
        "mac_address": get_mac()
    }

    response(status, header)
    return [json.dumps(result).encode()] 

开发者ID:victorqribeiro,项目名称:rpiapi,代码行数:21,代码来源:network.py

示例7: init

import uuid 

def __init__(self, address, port):
        self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.server.settimeout(10)
        self.serverIP = address#socket.gethostname()
        self.serverConnected = False
        print(self.serverIP)
        self.serverPort = port#5069
        myIP = socket.gethostname()
        self.networkReady = False
        self.delim = b'\x1E'
        self.buffer = b''
        self.state = FSNObjects.PlayerState(None, None, None, None, None, None, None)
        self.messageHandler = None
        self.serverReady = True
        self.readyToQuit = False
        self.clientID = str(time.perf_counter())+str(get_mac()) 

开发者ID:skyfpv,项目名称:FlowState,代码行数:18,代码来源:FSNClient.py

示例8: login

import uuid 

def login(self, username, password, state=None, sync=True):
        """Authenticate to Google with the provided credentials & sync.

        Args:
            email (str): The account to use.
            password (str): The account password.
            state (dict): Serialized state to load.

        Raises:
            LoginException: If there was a problem logging in.
        """
        auth = APIAuth(self.OAUTH_SCOPES)

        ret = auth.login(username, password, get_mac())
        if ret:
            self.load(auth, state, sync)

        return ret 

开发者ID:kiwiz,项目名称:gkeepapi,代码行数:20,代码来源:init.py

示例9: resume

import uuid 

def resume(self, email, master_token, state=None, sync=True):
        """Authenticate to Google with the provided master token & sync.

        Args:
            email (str): The account to use.
            master_token (str): The master token.
            state (dict): Serialized state to load.

        Raises:
            LoginException: If there was a problem logging in.
        """
        auth = APIAuth(self.OAUTH_SCOPES)

        ret = auth.load(email, master_token, android_id=get_mac())
        if ret:
            self.load(auth, state, sync)

        return ret 

开发者ID:kiwiz,项目名称:gkeepapi,代码行数:20,代码来源:init.py

示例10: oid

import uuid 

def oid(timestamp_factory=IncreasingMicrosecondClock()):
    """Generate unique identifiers for objects in string format.

    The lexicographical order of these strings are roughly same as their
    generation times.

    Internally, an object ID is composed of a timestamp and the node ID
    so that IDs generated from different nodes can also be compared and
    be ensured to be unique.

    :param timestamp_factory: the timestamp generator
    :return: A string can be used as an UUID.
    """
    timestamp = timestamp_factory()
    ns = timestamp * 1e9
    ts = int(ns // 100) + 0x01b21dd213814000L

    node = uuid.getnode()
    num = (ts << 48L) | node
    return _base58_encode(num) 

开发者ID:eavatar,项目名称:eavatar-me,代码行数:22,代码来源:time_uuid.py

示例11: cd_mac_uuid

import uuid 

def cd_mac_uuid():
    """
    :return: 网卡作为设备号
    """
    return uuid.UUID(int=uuid.getnode()).hex[-12:] 

开发者ID:liucaide,项目名称:Andromeda,代码行数:7,代码来源:cd_tools.py

示例12: get_mac_address​

import uuid 

def get_mac_address():
    h = iter(hex(get_mac())[2:].zfill(12))
    return ":".join(i + next(h) for i in h) 

开发者ID:huge-success,项目名称:sanic,代码行数:5,代码来源:logdna_example.py

示例13: generate_system_id

import uuid 

def generate_system_id(self):
        mac_address = uuid.getnode()
        pid = os.getpid()
        system_id = (((mac_address & 0xffffffffff) << 24) |
                     (pid & 0xffff) << 8 |
                     (self._node_nr & 0xff)
                     )

        return system_id 

开发者ID:brunorijsman,项目名称:rift-python,代码行数:11,代码来源:node.py

示例14: get_localhost_details

import uuid 

def get_localhost_details(interfaces_eth, interfaces_wlan):
    hostdata = "None"
    hostname = "None"
    windows_ip = "None"
    eth_ip = "None"
    wlan_ip = "None"
    host_fqdn = "None"
    eth_mac = "None"
    wlan_mac = "None"
    windows_mac = "None"
    hostname = socket.gethostbyname(socket.gethostname())
    if hostname.startswith("127.") and os.name != "nt":
        hostdata = socket.gethostbyaddr(socket.gethostname())
        hostname = str(hostdata[1]).strip('[]')
        host_fqdn = socket.getfqdn()
        for interface in interfaces_eth:
            try:
                eth_ip = get_ip(interface)
                if not "None" in eth_ip:
                    eth_mac = get_mac_address(interface)
                break
            except IOError:
                pass
        for interface in interfaces_wlan:
            try:
                wlan_ip = get_ip(interface)
                if not "None" in wlan_ip:
                    wlan_mac = get_mac_address(interface)
                break
            except IOError:
                pass
    else:
        windows_ip = socket.gethostbyname(socket.gethostname())
        windows_mac = uuid.getnode()
        windows_mac = ':'.join(("%012X" % windows_mac)[i:i+2] for i in range(0, 12, 2))
        hostdata = socket.gethostbyaddr(socket.gethostname())
        hostname = str(socket.gethostname())
        host_fqdn = socket.getfqdn()
    return hostdata, hostname, windows_ip, eth_ip, wlan_ip, host_fqdn, eth_mac, wlan_mac, windows_mac 

开发者ID:funkandwagnalls,项目名称:pythonpentest,代码行数:41,代码来源:hostdetails.py

示例15: getmac

import uuid 

def getmac():
    mac = uuid.getnode()
    mac_formated = ':'.join(("%012x" % mac)[i:i+2] for i in range(0, 12, 2))
    return mac_formated 

开发者ID:syncloud,项目名称:platform,代码行数:6,代码来源:id.py

示例16: init

import uuid 

def __init__(self, category=None, level=None, event_type=None, owner=None,
                 time_start=None, time_end=None, event_id=None):
        self.category = category
        self.level = level or EventLevel.NORMAL
        self.event_type = event_type
        self.owner = owner
        self.time_start = time_start
        self.time_end = time_end

        self.event_id = event_id or tokenize(
            uuid.getnode(), time.time(), category, level, event_type, owner) 

开发者ID:mars-project,项目名称:mars,代码行数:13,代码来源:events.py

示例17: fingerprint

import uuid 

def fingerprint():
    md5 = hashlib.md5()
    # Hostname, OS, CPU, MAC,
    data = [p.node(), p.system(), p.machine(), str(uuid.getnode())]
    md5.update(''.join(data).encode('utf8'))
    return "%s-pygraphistry-%s" % (md5.hexdigest()[:8], sys.modules['graphistry'].__version__) 

开发者ID:graphistry,项目名称:pygraphistry,代码行数:8,代码来源:util.py

示例18: login

import uuid 

def login(self):
        flag = True
        if self.loginUrl is not None:
            try:
                mac = uuid.UUID(int=uuid.getnode()).hex[-12:]
                self.params.append(
                    ('KEY', self.md5(self.softKey.upper() + self.user.upper()) + mac))
                self.opener.addheaders = self.params
                url = "http://" + self.loginUrl
                url += "/Upload/Login.aspx?U=%s&p=%s" % (
                    self.user, self.md5(self.pwd))
                try:
                    response = self.opener.open(url, None, 60)
                    if response.code == 200:
                        body = response.read()
                        if body is not None:
                            if body.find("-") > 0:
                                us = body.split("_")
                                self.uid = us[0]
                                self.uKey = body.strip()
                                print '登录成功,用户ID是:', self.uid
                                flag = True
                            else:
                                print '登录失败,错误代码是:', body
                                flag = False
                except Exception, e:
                    print "Error:Login Request"
                    print e
            except Exception, e:
                print "Error:Login Params "
                print e 

开发者ID:cundi,项目名称:PySide_For_Amazon_Order,代码行数:33,代码来源:captcha_handler.py

示例19: test_getnode

import uuid 

def test_getnode(self):
        node1 = uuid.getnode()
        self.assertTrue(0 < node1 < (1 << 48), '%012x' % node1)

        # Test it again to ensure consistency.
        node2 = uuid.getnode()
        self.assertEqual(node1, node2, '%012x != %012x' % (node1, node2))

    # bpo-32502: UUID1 requires a 48-bit identifier, but hardware identifiers
    # need not necessarily be 48 bits (e.g., EUI-64). 

开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:test_uuid.py

示例20: test_uuid1_eui64

import uuid 

def test_uuid1_eui64(self):
        # Confirm that uuid.getnode ignores hardware addresses larger than 48
        # bits. Mock out each platform's *_getnode helper functions to return
        # something just larger than 48 bits to test. This will cause
        # uuid.getnode to fall back on uuid._random_getnode, which will
        # generate a valid value.
        too_large_getter = lambda: 1 << 48

        uuid_real__node = uuid._node
        uuid_real__NODE_GETTERS_WIN32 = uuid._NODE_GETTERS_WIN32
        uuid_real__NODE_GETTERS_UNIX = uuid._NODE_GETTERS_UNIX
        uuid._node = None
        uuid._NODE_GETTERS_WIN32 = [too_large_getter]
        uuid._NODE_GETTERS_UNIX = [too_large_getter]
        try:
            node = uuid.getnode()
        finally:
            uuid._node = uuid_real__node
            uuid._NODE_GETTERS_WIN32 = uuid_real__NODE_GETTERS_WIN32
            uuid._NODE_GETTERS_UNIX = uuid_real__NODE_GETTERS_UNIX

        self.assertTrue(0 < node < (1 << 48), '%012x' % node)

        # Confirm that uuid1 can use the generated node, i.e., the that
        # uuid.getnode fell back on uuid._random_getnode() rather than using
        # the value from too_large_getter above.
        try:
            uuid.uuid1(node=node)
        except ValueError as e:
            self.fail('uuid1 was given an invalid node ID') 

开发者ID:IronLanguages,项目名称:ironpython2,代码行数:32,代码来源:test_uuid.py

你可能感兴趣的:(doc)