Auto-detect target type from string.
(cls, value: str)
| 26 | |
| 27 | @classmethod |
| 28 | def from_string(cls, value: str) -> "Target": |
| 29 | """Auto-detect target type from string.""" |
| 30 | value = value.strip() |
| 31 | |
| 32 | # URL detection |
| 33 | if value.startswith(("http://", "https://")): |
| 34 | return cls(value=value, target_type="url") |
| 35 | |
| 36 | # Email detection |
| 37 | if "@" in value and "." in value.split("@")[-1]: |
| 38 | return cls(value=value, target_type="email") |
| 39 | |
| 40 | # IP detection (simple check) |
| 41 | parts = value.split(".") |
| 42 | if len(parts) == 4 and all(p.isdigit() and 0 <= int(p) <= 255 for p in parts): |
| 43 | return cls(value=value, target_type="ip") |
| 44 | |
| 45 | # Default to domain |
| 46 | return cls(value=value, target_type="domain") |
| 47 | |
| 48 | |
| 49 | class Finding(BaseModel): |
no outgoing calls