(user: str, hostname: Optional[str] = None, host: Optional[str] = None)
| 123 | |
| 124 | @staticmethod |
| 125 | def _split_user(user: str, hostname: Optional[str] = None, host: Optional[str] = None): |
| 126 | domain = None |
| 127 | if "\\" in user: |
| 128 | domain, user = user.split("\\", 1) |
| 129 | if domain == ".": |
| 130 | domain = None |
| 131 | elif "@" in user: |
| 132 | user, domain = user.split("@", 1) |
| 133 | if domain is not None and hostname is not None: |
| 134 | domain = domain.lower() |
| 135 | |
| 136 | # Don't use IP addresses |
| 137 | if re.match(r'\d+\.\d+.\d+\.\d+', host) is not None: |
| 138 | host = None |
| 139 | |
| 140 | if hostname is not None: |
| 141 | hostname = hostname.lower() |
| 142 | if domain == hostname: |
| 143 | domain = None |
| 144 | elif domain == hostname.split(".")[0]: |
| 145 | domain = None |
| 146 | |
| 147 | if host is not None: |
| 148 | host = host.lower() |
| 149 | if domain == host: |
| 150 | domain = None |
| 151 | elif domain == host.split(".")[0]: |
| 152 | domain = None |
| 153 | |
| 154 | return user, domain |
| 155 | |
| 156 | def _find_infra_user_vertex(self, resource_vertex: DAGVertex, user: str, domain: Optional[str] = None) -> ( |
| 157 | Optional)[DAGVertex]: |
no outgoing calls
no test coverage detected