MCPcopy Create free account
hub / github.com/TheSecuredAnalyst/security-suite / from_string

Method from_string

core/models.py:28–46  ·  view source on GitHub ↗

Auto-detect target type from string.

(cls, value: str)

Source from the content-addressed store, hash-verified

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
49class Finding(BaseModel):

Callers 15

test_api_authMethod · 0.80
test_apiMethod · 0.80
fuzz_apiMethod · 0.80
osint_dnsFunction · 0.80
osint_whoisFunction · 0.80
osint_subdomainsFunction · 0.80
osint_headersFunction · 0.80
osint_portsFunction · 0.80
osint_techFunction · 0.80
osint_emailsFunction · 0.80
osint_virustotalFunction · 0.80
osint_shodanFunction · 0.80

Calls

no outgoing calls

Tested by 14

test_api_authMethod · 0.64
test_apiMethod · 0.64
sample_resultFunction · 0.64
test_domain_detectionMethod · 0.64
test_url_detectionMethod · 0.64
test_ip_detectionMethod · 0.64
test_email_detectionMethod · 0.64
test_create_resultMethod · 0.64
test_add_findingMethod · 0.64
test_completeMethod · 0.64
test_durationMethod · 0.64