Handles NTPv4 extensions and MAC part (when authentication is used.)
2730
def guess_payload_class(self, payload):
        
        plen = len(payload)

        if plen > _NTP_AUTH_MD5_TAIL_SIZE:
            return NTPExtensions
        elif plen == _NTP_AUTH_MD5_TAIL_SIZE:
            return NTPAuthenticator

        return Packet.guess_payload_class(self, payload)
864882
def handle_spec(region_name, vpc_id, route_spec, failed_ips, questionable_ips):
    
    if CURRENT_STATE._stop_all:
        logging.debug("handle_spec: Stop requested, abort operation")
        return

    if not route_spec:
        logging.debug("handle_spec: No route spec provided")
        return

    logging.debug("Handle route spec")

    try:
        con      = connect_to_region(region_name)
        vpc_info = get_vpc_overview(con, vpc_id, region_name)
        vpc_info['cluster_node_subnets'] = \
                        make_cluster_node_subnet_list(vpc_info, route_spec)
        process_route_spec_config(con, vpc_info, route_spec,
                                  failed_ips, questionable_ips)
        con.close()
    except boto.exception.StandardError as e:
        logging.warning("vpc-router could not set route: %s - %s" %
                        (e.message, e.args))
        raise

    except boto.exception.NoAuthHandlerFound:
        logging.error("vpc-router could not authenticate")
1348704
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
        for (Callback c : callbacks) {
            if (c instanceof NameCallback) {
                LOG.debug("name callback");
            } else if (c instanceof PasswordCallback) {
                LOG.debug("password callback");
                LOG.warn("Could not login: the client is being asked for a password, but the "
                        + " client code does not currently support obtaining a password from the user."
                        + " Make sure that the client is configured to use a ticket cache (using"
                        + " the JAAS configuration setting 'useTicketCache=true)' and restart the client. If"
                        + " you still get this message after that, the TGT in the ticket cache has expired and must"
                        + " be manually refreshed. To do so, first determine if you are using a password or a"
                        + " keytab. If the former, run kinit in a Unix shell in the environment of the user who" + " is running this client using the command"
                        + " 'kinit <princ>' (where <princ> is the name of the client's Kerberos principal)." + " If the latter, do"
                        + " 'kinit -k -t <keytab> <princ>' (where <princ> is the name of the Kerberos principal, and"
                        + " <keytab> is the location of the keytab file). After manually refreshing your cache,"
                        + " restart this client. If you continue to see this message after manually refreshing"
                        + " your cache, ensure that your KDC host's clock is in sync with this host's clock.");
            } else if (c instanceof AuthorizeCallback) {
                LOG.debug("authorization callback");
                AuthorizeCallback ac = (AuthorizeCallback) c;
                String authid = ac.getAuthenticationID();
                String authzid = ac.getAuthorizationID();
                if (authid.equals(authzid)) {
                    ac.setAuthorized(true);
                } else {
                    ac.setAuthorized(false);
                }
                if (ac.isAuthorized()) {
                    ac.setAuthorizedID(authzid);
                }
            } else {
                throw new UnsupportedCallbackException(c);
            }
        }
    }
900952
def authenticationReject():
    """"""
    a = TpPd(pd=0x5)
    b = MessageType(mesType=0x11)  # 00010001
    packet = a / b
    return packet
375622
def _storeAccessContext(snmpEngine):
        """"""
        execCtx = snmpEngine.observer.getExecutionContext('rfc3412.receiveMessage:request')

        return {
            'securityModel': execCtx['securityModel'],
            'securityName': execCtx['securityName'],
            'securityLevel': execCtx['securityLevel'],
            'contextName': execCtx['contextName'],
            'pduType': execCtx['pdu'].getTagSet()
        }
594213
def handle(self, sock, read_data, path, headers):
        ""
        for i in range(self.timeout // self.check_interval):
            # Sleep first
            eventlet.sleep(self.check_interval)
            # Check for another action
            action = self.balancer.resolve_host(self.host)
            if not isinstance(action, Spin):
                return action.handle(sock, read_data, path, headers)
        # OK, nothing happened, so give up.
        action = Static(self.balancer, self.host, self.matched_host, type="timeout")
        return action.handle(sock, read_data, path, headers)
1172195
def _authenticate_plain(credentials, sock_info):
    
    source = credentials.source
    username = credentials.username
    password = credentials.password
    payload = ('\x00%s\x00%s' % (username, password)).encode('utf-8')
    cmd = SON([('saslStart', 1),
               ('mechanism', 'PLAIN'),
               ('payload', Binary(payload)),
               ('autoAuthorize', 1)])
    sock_info.command(source, cmd)
757801
def decap(self, orig_pkt):
        """"""
        if orig_pkt.name != Ether().name or orig_pkt.payload.name != MACsec().name:  # noqa: E501
            raise TypeError('cannot decapsulate MACsec packet, must be Ethernet/MACsec')  # noqa: E501
        packet = copy.deepcopy(orig_pkt)
        prev_layer = packet[MACsec].underlayer
        prev_layer.type = packet[MACsec].type
        next_layer = packet[MACsec].payload
        del prev_layer.payload
        if prev_layer.name == Ether().name:
            return Ether(raw(prev_layer / next_layer))
        return prev_layer / next_layer
442800
function NickservMiddleware() {
	return function(client, raw_events, parsed_events) {
		raw_events.use(theMiddleware);
	};


	function theMiddleware(command, event, client, next) {
		if (command === '005') {
			if (client.options.nickserv) {
				var options = client.options.nickserv;
				client.say('nickserv', 'identify ' + options.account + ' ' + options.password);
			}
		}

		if (command === 'PRIVMSG' && event.params[0].toLowerCase() === 'nickserv') {
			// Handle success/retries/failures
		}

		next();
	}
}
225765
def handle_get_passphrase(self, conn, _):
        """"""
        p1 = self.client.device.ui.get_passphrase('Symmetric encryption:')
        p2 = self.client.device.ui.get_passphrase('Re-enter encryption:')
        if p1 == p2:
            result = b'D ' + util.assuan_serialize(p1.encode('ascii'))
            keyring.sendline(conn, result, confidential=True)
        else:
            log.warning('Passphrase does not match!')
471055
def cli(env, identifier):
    """"""

    manager = SoftLayer.HardwareManager(env.client)
    hardware_id = helpers.resolve_id(manager.resolve_ids,
                                     identifier,
                                     'hardware')
    instance = manager.get_hardware(hardware_id)

    table = formatting.Table(['username', 'password'])
    for item in instance['softwareComponents']:
        if 'passwords' not in item:
            raise exceptions.SoftLayerError("No passwords found in softwareComponents")
        for credentials in item['passwords']:
            table.add_row([credentials.get('username', 'None'), credentials.get('password', 'None')])
    env.fout(table)
484538
def handle_unauthorized_file_type(error):
    ''''''
    url = url_for('api.allowed_extensions', _external=True)
    msg = (
        'This file type is not allowed.'
        'The allowed file type list is available at {url}'
    ).format(url=url)
    return {'message': msg}, 400
951669
def source_mac
      @source_mac ||= if self.victim_ip
        ::ServiceObjects::NetworkInformation.self_mac(interface)
      else
        gateway_ip = ServiceObjects::NetworkInformation.gateway_ip
        mac = ::Ownlan::Attack::Base.new(self).ip_to_mac(gateway_ip)
      end
    end
42347
protected function _handleUnauthenticatedAccess()
    {
        header("HTTP/1.0 401 Unauthorized");
        $renderer = new TwigRenderer();
        $output = $renderer->render('unauth.tmpl', array());
        $result = array("code"=>"401","message" => $output);
        echo parent::encodeData($result);
        exit;

    }
129487
def hosting_devices_unassigned_from_cfg_agent(self, context, payload):
        """"""
        try:
            if payload['hosting_device_ids']:
                #TODO(hareeshp): implement unassignment of hosting devices
                pass
        except KeyError as e:
            LOG.error("Invalid payload format for received RPC message "
                      "`hosting_devices_unassigned_from_cfg_agent`. Error "
                      "is %(error)s. Payload is %(payload)s",
                      {'error': e, 'payload': payload})
631698
protected static function check_security() {
        global $CFG;

        if (!empty($_SESSION['USER']->id) and !empty($CFG->tracksessionip)) {
            // Make sure current IP matches the one for this session.
            $remoteaddr = getremoteaddr();

            if (empty($_SESSION['USER']->sessionip)) {
                $_SESSION['USER']->sessionip = $remoteaddr;
            }

            if ($_SESSION['USER']->sessionip != $remoteaddr) {
                // This is a security feature - terminate the session in case of any doubt.
                self::terminate_current();
                throw new exception('sessionipnomatch2', 'error');
            }
        }
    }
757808
private void handleCertificateAuthenticator(X509Certificate[] certChain,
                                                CertificateAuthenticator certAuthen) throws Exception {
        String type = certAuthen.getType();
        if (type == null)
            type = AccessIdUtil.TYPE_USER;
        String realm = certAuthen.getRealm();
        if (realm == null)
            realm = "defaultRealm";
        authenticatedId = certAuthen.getUsername();
        username = authenticatedId;
        String accessId = AccessIdUtil.createAccessId(type, realm, authenticatedId);
        addCredentials(accessId);
    }