Parse a message to see if we have ip addresses or users that we care about

        :param auth_message: The auth message to parse
        :return: Result
493994
def _parse_auth_message(self, auth_message):
        
        result = {}

        has_matched = False

        for regex in REGEXES_INVALID_USER:
            # Check for the invalid user/ip messages
            m = re.search(regex, auth_message)

            if m and not has_matched:
                has_matched = True

                # Save the username and IP
                result['username'] = m.group('user')
                result['ip'] = m.group('ip')

        for regex in REGEXES_INVALID_IP:
            # Check for the invalid ip messages
            m = re.search(regex, auth_message)

            if m and not has_matched:
                has_matched = True

                # Save the IP
                result['ip'] = m.group('ip')                        

        for regex in REGEXES_IGNORE:
            # Check for messages we want to ignore
            m = re.search(regex, auth_message)

            if m and not has_matched:
                has_matched = True

        # If it's an ssh log and we don't know what it is, handle that
        if not has_matched:
            sys.stderr.write("Unhandled auth message: %s\n" % auth_message)

        return result
640211
def _parse_metadata(self, message):
        

        metadata = Metadata(source=self.actor_urn).__dict__
        if 'author' in message['d']:
            metadata['source_user'] = message['d']['author']['username']
        else:
            metadata['source_user'] = None
        if 'channel_id' in message['d']:
            metadata['source_channel'] = message['d']['channel_id']
        else:
            metadata['source_channel'] = None
        metadata['user_id'] = metadata['source_user']
        metadata['display_name'] = metadata['source_user']

        metadata['source_connector'] = 'discord'

        return metadata
54607
function readNotifyUserMessage(message, tokens) {
	message.userName = protocol.decodeString(tokens[1]);
	message.sessionId = protocol.decodeString(tokens[3]);
	message.userMessage = protocol.decodeString(tokens[5]);
}
922261
def checkMessageSignature(self, message):
        
        message_sig = message.getArg(OPENID_NS, 'sig')
        if not message_sig:
            raise ValueError("%s has no sig." % (message,))
        calculated_sig = self.getMessageSignature(message)
        return cryptutil.const_eq(calculated_sig, message_sig)
733893
def parse_address(address: str) -> str:
    
    display_name, parsed_address = email.utils.parseaddr(address)

    return parsed_address or address
866229
def parse_auth_token_from_request(self, auth_header):
        
        if not auth_header:
            raise falcon.HTTPUnauthorized(
                description='Missing Authorization Header')

        try:
            auth_header_prefix, _ = auth_header.split(' ', 1)
        except ValueError:
            raise falcon.HTTPUnauthorized(
                description='Invalid Authorization Header: Missing Scheme or Parameters')

        if auth_header_prefix.lower() != self.auth_header_prefix.lower():
            raise falcon.HTTPUnauthorized(
                description='Invalid Authorization Header: '
                            'Must start with {0}'.format(self.auth_header_prefix))

        return auth_header
96914
def _is_auth_info_available():
  """"""
  return (_ENDPOINTS_USER_INFO in os.environ or
          (_ENV_AUTH_EMAIL in os.environ and _ENV_AUTH_DOMAIN in os.environ) or
          _ENV_USE_OAUTH_SCOPE in os.environ)
1188675
def get_hmac(message):
    
    key = current_app.config['WEBHOOKS_SECRET_KEY']
    hmac_value = hmac.new(
        key.encode('utf-8') if hasattr(key, 'encode') else key,
        message.encode('utf-8') if hasattr(message, 'encode') else message,
        sha1
    ).hexdigest()
    return hmac_value
1097263
def _parse_message(self, data):
        
        if TwitchChatStream._check_has_ping(data):
            self._send_pong()
        if TwitchChatStream._check_has_channel(data):
            self.current_channel = \
                TwitchChatStream._check_has_channel(data)[0]

        if TwitchChatStream._check_has_message(data):
            return {
                'channel': re.findall(r'^:.+![a-zA-Z0-9_]+'
                                      r'@[a-zA-Z0-9_]+'
                                      r'.+ '
                                      r'PRIVMSG (.*?) :',
                                      data)[0],
                'username': re.findall(r'^:([a-zA-Z0-9_]+)!', data)[0],
                'message': re.findall(r'PRIVMSG #[a-zA-Z0-9_]+ :(.+)',
                                      data)[0].decode('utf8')
            }
        else:
            return None
70863
async def on_raw_chghost(self, message):
        
        if 'chghost' not in self._capabilities or not self._capabilities['chghost']:
            return

        nick, _ = self._parse_user(message.source)
        if nick not in self.users:
            return

        # Update user and host.
        metadata = {
            'username': message.params[0],
            'hostname': message.params[1]
        }
        self._sync_user(nick, metadata)
750436
def on_privmsg(self, c, e):
        
        text = e.arguments[0]
        logger.debug('{0!s}'.format(e.source))
        metadata = self.set_metadata(e)
        metadata['is_private_message'] = True
        message = Message(text=text, metadata=metadata).__dict__
        self.baseplate.tell(message)
1077204
def __authenticate(self):
        
        if self.api_token:
            # verify current API token
            check_auth_uri = self.uri.split('/api/v1')[0] + '/check_token'
            req = self.request(check_auth_uri)
            try:
                ping = req.get().json()
            except Exception as exc:
                if str(exc).startswith('User not authenticated'):
                    self.api_token = None
            else:
                if self.email == ping['hello']:
                    return
                print "Authentication failed"
                sys.exit(1)

        auth_uri = self.uri.split('/api/v1')[0] + '/auth'
        payload = {
            'email': self.email,
            'password': self.password,
            'org_id': self.org_name
        }
        data = json.dumps(payload)
        req = self.request(auth_uri, data=data)
        response = req.post().json()
        token = response.get('mist_api_token', None)
        if token:
            # backwards compatibility with old Authentication system
            self.api_token = "mist_1 %s:%s" % (self.email, token)
        else:
            self.api_token = response.get('token', None)
578423
def parse_auth_response(self, auth_response):
        

        auth_dict = dict()
        auth_response = auth_response.json()
        LOG.debug('Authentication Response Body [ %s ]', auth_response)

        access = auth_response.get('access')
        access_token = access.get('token')
        access_tenant = access_token.get('tenant')
        access_user = access.get('user')

        auth_dict['os_token'] = access_token.get('id')
        auth_dict['os_tenant'] = access_tenant.get('name')
        auth_dict['os_user'] = access_user.get('name')

        if not auth_dict['os_token']:
            raise exceptions.AuthenticationProblem(
                'When attempting to grab the tenant or user nothing was'
                ' found. No Token Found to Parse. Here is the DATA: [ %s ]'
                ' Stack Trace [ %s ]',
                auth_response,
                traceback.format_exc()
            )

        region = self.job_args.get('os_region')
        print(region)
        if not region:
            raise exceptions.SystemProblem('No Region Set')

        service_catalog = access.pop('serviceCatalog')

        # Get the storage URL
        object_endpoints = self._service_endpoints(
            service_catalog=service_catalog,
            types_list=turbolift.__srv_types__
        )

        # In the legacy internal flag is set override the os_endpoint_type
        #  TODO(cloudnull) Remove this in future releases
        if 'internal' in self.job_args and self.job_args['internal']:
            LOG.warn(
                'The use of the ``--internal`` flag has been deprecated and'
                ' will be removed in future releases. Please use the'
                ' ``--os-endpoint-type`` flag and set the type name'
                ' instead. In the case of using snet (service net) this is'
                ' generally noted as "internalURL". Example setting:'
                ' ``--os-endpoint-type internalURL``'
            )
            self.job_args['os_endpoint_type'] = 'internalURL'

        auth_dict['storage_url'] = get_service_url(
            region=region,
            endpoint_list=object_endpoints,
            lookup=self.job_args['os_endpoint_type']
        )

        # Get the CDN URL
        cdn_endpoints = self._service_endpoints(
            service_catalog=service_catalog, types_list=turbolift.__cdn_types__
        )

        if cdn_endpoints:
            auth_dict['cdn_storage_url'] = get_service_url(
                region=region,
                endpoint_list=cdn_endpoints,
                lookup=self.job_args['cdn_endpoint_type']
            )

        return auth_dict
157584
def receive_response(self, message, insecure=False):
		
		response = self.receive_message()
		if not response.is_response(message):
			raise OmapiError("received message is not the desired response")
		# signature already verified
		if response.authid != self.protocol.defauth and not insecure:
			raise OmapiError("received message is signed with wrong authenticator")
		return response
388194
def ParseForwardedIps(self, forwarded_ips):
    
    addresses = []
    forwarded_ips = forwarded_ips or []
    for ip in forwarded_ips:
      if ip and (IP_REGEX.match(ip) or IP_ALIAS_REGEX.match(ip)):
        addresses.extend([str(addr) for addr in list(netaddr.IPNetwork(ip))])
      else:
        self.logger.warning('Could not parse IP address: "%s".', ip)
    return addresses
1289002
def auth(self, encoded):
        
        message, signature = self.split(encoded)
        computed = self.sign(message)
        if not hmac.compare_digest(signature, computed):
            raise AuthenticatorInvalidSignature
837828
def user_for_message(message)
      if user = users[message.user_id]
        yield message, user
      else
        message.user do |user|
          yield message, user
        end
      end
    end