1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1229],{7555:(e,s,r)=>{r.d(s,{N_:()=>u,Zp:()=>l,ok:()=>o,zy:()=>d});var t=r(37876),a=r(14232),i=r(14e3),n=r(48230),c=r.n(n);function l(){let e=(0,i.useRouter)();return(0,a.useCallback)((s,r)=>{if("number"==typeof s)return void(s<0?e.back():e.forward());(null==r?void 0:r.replace)?e.replace(s):e.push(s)},[e])}function d(){let e=(0,i.usePathname)(),s=(0,i.useSearchParams)();return{pathname:e,search:s.toString()?"?".concat(s.toString()):"",hash:"",state:null,key:"default"}}function o(){let e=(0,i.useSearchParams)(),s=(0,i.useRouter)(),r=(0,i.usePathname)();return[new URLSearchParams(e.toString()),(0,a.useCallback)((t,a)=>{let i,n=new URLSearchParams(e.toString());"function"==typeof t?i=t(n):t instanceof URLSearchParams?i=t:(Object.entries(t).forEach(e=>{let[s,r]=e;return n.set(s,r)}),i=n);let c="".concat(r,"?").concat(i.toString());(null==a?void 0:a.replace)?s.replace(c):s.push(c)},[e,s,r])]}function u(e){var s;let{to:r,href:a,children:i,...n}=e;return(0,t.jsx)(c(),{href:null!=(s=null!=r?r:a)?s:"",...n,children:i})}},66006:(e,s,r)=>{r.d(s,{k:()=>c});var t=r(37876),a=r(14232),i=r(24972),n=r(56680);let c=a.forwardRef((e,s)=>{let{className:r,value:a,...c}=e;return(0,t.jsx)(i.bL,{ref:s,className:(0,n.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",r),...c,children:(0,t.jsx)(i.C1,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:"translateX(-".concat(100-(a||0),"%)")}})})});c.displayName=i.bL.displayName},70203:(e,s,r)=>{r.d(s,{Xi:()=>d,av:()=>o,j7:()=>l,tU:()=>c});var t=r(37876),a=r(14232),i=r(90491),n=r(56680);let c=i.bL,l=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)(i.B8,{ref:s,className:(0,n.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",r),...a})});l.displayName=i.B8.displayName;let d=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)(i.l9,{ref:s,className:(0,n.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",r),...a})});d.displayName=i.l9.displayName;let o=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)(i.UC,{ref:s,className:(0,n.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",r),...a})});o.displayName=i.UC.displayName},74091:(e,s,r)=>{r.d(s,{Y:()=>_});var t=r(37876),a=r(14232),i=r(91725),n=r(26283),c=r(23156),l=r(66006),d=r(70203),o=r(19005),u=r(57840),m=r(42743),x=r(35711),h=r(76675),f=r(49240),p=r(52417),j=r(78539),v=r(17734),g=r(19878),N=r(89903),y=r(43579),b=r(50607),w=r(20972);let _=()=>{let[e,s]=(0,a.useState)([]),[r,_]=(0,a.useState)([]),[S,k]=(0,a.useState)(!1),[A,C]=(0,a.useState)(0),[,z]=(0,a.useState)([]),{toast:I}=(0,y.dj)(),{currentOrganization:R}=(0,w.Z)(),U=async()=>{if(!(null==R?void 0:R.id))return;console.log("Fetching discovered assets for organization:",R.id);let{data:e,error:r}=await b.N.from("discovered_assets").select("*").eq("organization_id",R.id).order("last_discovered",{ascending:!1});if(r)return void console.error("Error fetching assets:",r);e&&e.length>0&&s(e.map(e=>{var s,r,t;let a=e.metadata,i=e.ip_addresses;return{id:e.asset_identifier,name:e.hostname||e.asset_identifier,type:e.asset_type||"server",ip_address:null!=(s=null==i?void 0:i[0])?s:"Unknown",os:e.operating_system||"Unknown",version:e.version||"",status:(null==a?void 0:a.status)||"online",compliance_score:null!=(r=null==a?void 0:a.compliance_score)?r:0,vulnerabilities:null!=(t=null==a?void 0:a.vulnerabilities)?t:0,last_scan:e.last_discovered,criticality:(null==a?void 0:a.criticality)||"medium"}}))},Z=async()=>{if(!(null==R?void 0:R.id))return;let{data:e,error:s}=await b.N.from("zero_trust_network_segments").select("*").eq("organization_id",R.id);!s&&e&&e.length>0&&_(e.map(e=>{var s,r;return{id:e.id,name:e.name,cidr:e.cidr,assets_count:null!=(s=e.assets_count)?s:0,compliance_level:null!=(r=e.compliance_level)?r:0,security_zone:e.security_zone||"internal"}}))};(0,a.useEffect)(()=>{U(),Z()},[null==R?void 0:R.id]);let T=async e=>{k(!0),C(0),console.log("Starting STIG ".concat(e," fingerprinting..."));try{let{data:s,error:r}
1=await b.N.functions.invoke("infrastructure-discovery",{body:{action:"stig_fingerprinting",target_os:e,stig_profiles:["Windows Server 2019","Ubuntu 22.04","IIS 10.0","Apache 2.4"],organizationId:null==R?void 0:R.id,stig_viewer_lookup:!0}});if(r)throw r;z(s.results||[]),await U(),I({title:"Discovery Complete",description:"Found ".concat(s.discovered_count||0," assets")})}catch(e){console.error("Discovery error:",e),I({title:"Discovery Failed",description:e.message||"Failed to perform infrastructure discovery.",variant:"destructive"})}finally{k(!1),C(100)}},D=async()=>{k(!0),C(0);let e=["windows_server_2019","ubuntu_22_04","iis_10","apache_2_4"],s=0;for(let r of e)T(r).finally(()=>{C(++s/e.length*100),s===e.length&&(k(!1),I({title:"STIG Discovery Complete",description:"STIG fingerprinting completed for ".concat(e.length," supported platforms"),variant:"default"}))})},P=e.length,B=e.filter(e=>"online"===e.status).length,E=e.filter(e=>"critical"===e.criticality).length,W=Math.round(e.reduce((e,s)=>e+s.compliance_score,0)/e.length);return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsx)(i.Zp,{className:"card-cyber",children:(0,t.jsx)(i.Wu,{className:"p-6",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"Total Assets"}),(0,t.jsx)("p",{className:"text-2xl font-bold text-primary",children:P})]}),(0,t.jsx)(u.A,{className:"h-8 w-8 text-primary"})]})})}),(0,t.jsx)(i.Zp,{className:"card-cyber",children:(0,t.jsx)(i.Wu,{className:"p-6",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"Online Assets"}),(0,t.jsx)("p",{className:"text-2xl font-bold text-success",children:B})]}),(0,t.jsx)(f.A,{className:"h-8 w-8 text-success"})]})})}),(0,t.jsx)(i.Zp,{className:"card-cyber",children:(0,t.jsx)(i.Wu,{className:"p-6",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"Critical Assets"}),(0,t.jsx)("p",{className:"text-2xl font-bold text-destructive",children:E})]}),(0,t.jsx)(p.A,{className:"h-8 w-8 text-destructive"})]})})}),(0,t.jsx)(i.Zp,{className:"card-cyber",children:(0,t.jsx)(i.Wu,{className:"p-6",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"Avg Compliance"}),(0,t.jsxs)("p",{className:"text-2xl font-bold text-accent",children:[W,"%"]})]}),(0,t.jsx)(j.A,{className:"h-8 w-8 text-accent"})]})})})]}),(0,t.jsxs)(i.Zp,{className:"card-cyber",children:[(0,t.jsx)(i.aR,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(i.ZB,{className:"flex items-center space-x-2",children:[(0,t.jsx)(v.A,{className:"h-5 w-5 text-primary"}),(0,t.jsx)("span",{children:"Infrastructure Discovery"})]}),(0,t.jsx)(i.BT,{children:"STIG-targeted fingerprinting and compliance assessment for critical systems"})]}),(0,t.jsx)(n.$,{variant:"cyber",onClick:D,disabled:S,children:S?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.A,{className:"h-4 w-4 mr-2 animate-spin"}),"STIG Scanning..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.A,{className:"h-4 w-4 mr-2"}),"STIG Discovery"]})})]})}),S&&(0,t.jsx)(i.Wu,{children:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,t.jsx)("span",{children:"Discovery Progress"}),(0,t.jsxs)("span",{children:[A,"%"]})]}),(0,t.jsx)(l.k,{value:A,className:"w-full"})]})})]}),(0,t.jsxs)(d.tU,{defaultValue:"assets",className:"space-y-4",children:[(0,t.jsxs)(d.j7,{className:"bg-card border border-border",children:[(0,t.jsx)(d.Xi,{value:"assets",children:"Assets"}),(0,t.jsx)(d.Xi,{value:"networks",children:"Network Segments"})]}),(0,t.jsx)(d.av,{value:"assets",className:"space-y-4",children:(0,t.jsxs)(i.Zp,{className:"card-cyber",children:[(0,t.jsxs)(i.aR,{children:[(0,t.jsx)(i.ZB,{children:"Discovered Assets"}),(0,t.jsx)(i.BT,{children:"Complete inventory of your IT infrastru
1cture"})]}),(0,t.jsx)(i.Wu,{children:(0,t.jsx)("div",{className:"space-y-4",children:e.map(e=>(0,t.jsx)("div",{className:"p-4 border border-border rounded-lg bg-card hover:bg-accent/30 transition-colors",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(e=>{switch(e){case"server":return(0,t.jsx)(o.A,{className:"h-5 w-5"});case"workstation":default:return(0,t.jsx)(u.A,{className:"h-5 w-5"});case"network_device":return(0,t.jsx)(m.A,{className:"h-5 w-5"});case"database":return(0,t.jsx)(x.A,{className:"h-5 w-5"});case"cloud_service":return(0,t.jsx)(h.A,{className:"h-5 w-5"})}})(e.type),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,t.jsx)("h4",{className:"font-medium text-foreground",children:e.name}),(0,t.jsx)(c.E,{className:(e=>{switch(e){case"online":return"bg-success text-success-foreground";case"offline":return"bg-destructive text-destructive-foreground";case"maintenance":return"bg-warning text-warning-foreground";default:return"bg-muted text-muted-foreground"}})(e.status),children:e.status.toUpperCase()}),(0,t.jsx)(c.E,{variant:"outline",className:(e=>{switch(e){case"critical":return"text-destructive";case"high":return"text-warning";case"medium":return"text-primary";case"low":return"text-success";default:return"text-muted-foreground"}})(e.criticality),children:e.criticality.toUpperCase()})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm text-muted-foreground",children:[(0,t.jsxs)("span",{children:["IP: ",e.ip_address]}),(0,t.jsxs)("span",{children:["OS: ",e.os," ",e.version]}),(0,t.jsxs)("span",{children:["Compliance: ",e.compliance_score,"%"]}),(0,t.jsxs)("span",{children:["Vulnerabilities: ",e.vulnerabilities]})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)(n.$,{variant:"outline",size:"sm",children:[(0,t.jsx)(N.A,{className:"h-3 w-3 mr-1"}),"Configure"]}),(0,t.jsxs)(n.$,{variant:"outline",size:"sm",children:[(0,t.jsx)(v.A,{className:"h-3 w-3 mr-1"}),"Scan"]})]})]})},e.id))})})]})}),(0,t.jsx)(d.av,{value:"networks",className:"space-y-4",children:(0,t.jsxs)(i.Zp,{className:"card-cyber",children:[(0,t.jsxs)(i.aR,{children:[(0,t.jsx)(i.ZB,{children:"Network Segments"}),(0,t.jsx)(i.BT,{children:"Network topology and security zone analysis"})]}),(0,t.jsx)(i.Wu,{children:(0,t.jsx)("div",{className:"space-y-4",children:r.map(e=>(0,t.jsx)("div",{className:"p-4 border border-border rounded-lg bg-card hover:bg-accent/30 transition-colors",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsx)(m.A,{className:"h-6 w-6 text-primary"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-medium text-foreground",children:e.name}),(0,t.jsxs)("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[(0,t.jsxs)("span",{children:["CIDR: ",e.cidr]}),(0,t.jsxs)("span",{children:["Assets: ",e.assets_count]}),(0,t.jsxs)("span",{children:["Compliance: ",e.compliance_level,"%"]}),(0,t.jsx)(c.E,{variant:"outline",children:e.security_zone.toUpperCase()})]})]})]}),(0,t.jsxs)(n.$,{variant:"outline",size:"sm",children:[(0,t.jsx)(v.A,{className:"h-3 w-3 mr-1"}),"Analyze"]})]})},e.id))})})]})})]})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.