Get the domain from a SH identity
773880
def get_domain(self, identity):
        
        domain = None
        if identity['email']:
            try:
                domain = identity['email'].split("@")[1]
            except IndexError:
                # logger.warning("Bad email format: %s" % (identity['email']))
                pass
        return domain
1151437
def _get_domain_id(self, domain):
        
        api = self.api[self.account]['domain_id']
        qdomain = dns.name.from_text(domain).to_unicode(True)
        domains, last_count, page = {}, -1, 0
        while last_count != len(domains):
            last_count = len(domains)
            page += 1
            url = (api['GET'].copy()).get('url', '/').replace('<index>', str(page))
            params = api['GET'].get('params', {}).copy()
            for param in params:
                params[param] = params[param].replace('<index>', str(page))
            response = self._get(url, query_params=params)
            domain_tags = Provider._filter_dom(response.text, api['filter'], True)
            for domain_tag in domain_tags:
                domain_id = Provider._extract_domain_id(dict(domain_tag.attrs)[api['id']['attr']],
                                                        api['id']['regex'])
                domain = (Provider._filter_dom(domain_tag, api['domain'])
                          .renderContents().decode('UTF-8'))
                domains[domain] = domain_id
                if domain == qdomain:
                    LOGGER.info('Hetzner => Get ID %s for domain %s', domain_id, qdomain)
                    return domain_id
        LOGGER.error('Hetzner => ID for domain %s does not exists', qdomain)
        raise AssertionError
732969
public Observable<ServiceResponse<Domain>> getDomainWithServiceResponseAsync(UUID domainId) {
        if (domainId == null) {
            throw new IllegalArgumentException("Parameter domainId is required and cannot be null.");
        }
        if (this.client.apiKey() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
        }
        return service.getDomain(domainId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Domain>>>() {
                @Override
                public Observable<ServiceResponse<Domain>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<Domain> clientResponse = getDomainDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }
1140990
def _populate_domain(self):
        '''
        '''

        self.domain = {}
        for device in self.devices:
            device_name = get_device_info(device).name
            ca_devices = \
                device.tm.cm.trust_domains.trust_domain.load(
                    name='Root'
                ).caDevices
            self.domain[device_name] = [
                d.replace('/%s/' % self.partition, '') for d in ca_devices
            ]
961985
def get_domain_home_from_url(self, url):
        
        p = parse.urlparse(url)
        if p.netloc:
            self.domain = p.netloc
            self.homepage = '{}://{}'.format(p.scheme, p.netloc)
            return self.homepage, p.netloc
        else:
            return '', ''
425643
def defines(self, id, domain='messages'):
        
        assert isinstance(id, (str, unicode))
        assert isinstance(domain, (str, unicode))

        return id in self.messages.get(domain, {})
400463
function getDomain(url) {
	var domain = _.isObject(url) ? url.host : urlib.parse(url).host;
	return domain || url;
}
758968
def get_domain_smarthost(self, domainid, serverid):
        """"""
        return self.api_call(
            ENDPOINTS['domainsmarthosts']['get'],
            dict(domainid=domainid, serverid=serverid))
1086020
def DomainFactory(domain_name, cmds):
    """"""
    klass = type(str(domain_name), (BaseDomain,), {})

    for c in cmds:
        command = get_command(domain_name, c['name'])
        setattr(klass, c['name'], classmethod(command))

    return klass
841321
def get_domain(url):
    
    parse_result = urlparse(url)
    domain = "{schema}://{netloc}".format(
        schema=parse_result.scheme, netloc=parse_result.netloc)
    return domain
409719
def parse_domains(self, domain, params):
        
        domain_id = self.get_non_aws_id(domain['DomainName'])
        domain['name'] = domain.pop('DomainName')
        #TODO: Get Dnssec info when available
        #api_client = params['api_client']
        #details = api_client.get_domain_detail(DomainName = domain['name'])
        #get_keys(details, domain, ['Dnssec'])
        self.domains[domain_id] = domain
492592
def _root_domain():
    

    if not hasattr(env,'root_domain'):
        cwd = os.getcwd().split(os.sep)
        domain = ''
        #if the first env.host has a domain name then we'll use that
        #since there are no top level domains that have numbers in them we can test env.host

        username, host, port = normalize(env.hosts[0])
        if host[-1] in string.ascii_letters:
            domain_parts = env.host.split('.')
            length = len(domain_parts)
            if length==2:
                #assumes .com .net etc so we want the full hostname for the domain
                domain = host
            elif length==3 and len(domain_parts[-1])==2:
                #assume country tld so we want the full hostname for domain
                domain = host
            elif length >=3:
                #assume the first part is the hostname of the machine
                domain = '.'.join(domain[1:])
        #we'll just pick the first directory in the path which has a period.
        else:
            for d in cwd:
                if '.' in d: 
                    domain = d
        if not domain and env.INTERACTIVE:
            domain = prompt('Enter the root domain for this project ',default='example.com')
        else:
            domain = 'example.com'
        env.root_domain = domain
    return env.root_domain
766453
private static String getFullInstanceId(String hostname, String id) {
    String str = hostname == null ? "" : hostname;
    str = str.replace('.', '_');
    str += (id == null ? "" : "-" + id);
    return str;
  }
948266
def get_effective_domain_id(request):
    
    default_domain = get_default_domain(request)
    domain_id = default_domain.get('id')
    domain_name = default_domain.get('name')
    return None if domain_name == DEFAULT_DOMAIN else domain_id
1295179
function getIdentity(urlStr, urlTemplates, www) {
     var identity = {};

     urlObj = urlParser.parse(urlStr);
        
     // Loop all the urlMappings for site object
     for(var y = 0; y <= urlTemplates.length-1; y++){
        urlTemplate = urlTemplates[y];

        // remove http protocol    
        urlTemplate = removeHttpHttps(urlTemplate);
        
        // if the urlTemplate contains a username or userid parse it
        if (urlTemplate != '' && (urlTemplate.indexOf('{username}') > -1 || urlTemplate.indexOf('{userid}') > -1)) {
            
            // break up url template
            var parts = urlTemplate.split(/\{userid\}|\{username\}/),
                startMatch = false,
                endMatch = false,
                user = urlObj.href

            // remove protocol, querystring and fragment
            user = user.replace(urlObj.hash, '');
            user = user.replace(urlObj.search, ''); 
            user = removeHttpHttps(user); 
            

            // remove www if subdomain is optional
            if(www){
                user = user.replace('www.', '') ;
                urlStr = urlStr.replace('www.', '') ;
            }

            // remove any trailing /
            if (endsWith(user,'/'))
                user = user.substring(0, user.length - 1); 
              

            // remove unwanted front section of url string
            if (user.indexOf(parts[0]) === 0){
                startMatch = true;
                part = parts[0];
                user = user.substring(part.length, user.length);
            }
            
            // remove unwanted end section of url string
            if (parts.length === 2){
                // if no end part or its just and trailing /
                if (parts[1].length > 0 && parts[1] !== '/'){
                    // end part matches template
                    if (endsWith(user,parts[1])){
                        endMatch = true;
                        user = user.replace(parts[1], '');
                    } else if (endsWith(user,parts[1] + '/')) {
                        // end part matches template with a trailing /
                        endMatch = true;
                        user = user.replace(parts[1] + '/', '');
                    }
                } else {
                    endMatch = true;
                }
            }
            


            // if the user contain anymore / then do not use it
            if (user.indexOf("/") > -1)
                endMatch = false;


            if (startMatch && endMatch){
                
                identity = {}; 
                identity.domain = urlObj.host; 
                identity.matchedUrl = urlStr;

                if (urlTemplate.indexOf("{username}") > -1){
                    identity.userName = user;
                    identity.sgn = "sgn://" + urlObj.host + "/?ident=" + user;
                }

                if (urlTemplate.indexOf("{userid}") > -1){
                    identity.userId = user;
                    identity.sgn = "sgn://" + urlObj.host + "/?pk=" + user;
                }

                break;
            }                       
        } 
    } 

    return identity;
}
1229231
def _get_cookie(self, name, domain):
        ''' 
        '''
        for c in self.session.cookies:
            if c.name==name and c.domain==domain:
                return c
        return None
129976
def _extract_from_sans(self):
        """"""
        self.logger.info("{} Trying to find Subdomains in SANs list".format(COLORED_COMBOS.NOTIFY))
        if self.host.naked:
            domain = self.host.naked
            tld_less = domain.split(".")[0]
        else:
            domain = self.host.target.split(".")
            tld_less = domain[1]
            domain = ".".join(domain[1:])

        for san in self.sans:
            if (tld_less in san or domain in san) and self.target != san and not san.startswith("*"):
                self.logger.info("{} Subdomain detected: {}".format(COLORED_COMBOS.GOOD, san))