1import{i as ve,l as ke,o as Ae,r as l,q as Ce,j as e,P as Se,c as Me,n as Te,d as K,s as Ee,t as Ie,L as p,m as Re,v as Le,w as De}from"./index-C86sjUM7.js";import{T as Pe}from"./ToolNavigation-BRVKy_Ic.js";import{F as Fe}from"./FreeTierScanMeter-4VpL8LJE.js";import{A as $e,L as ze}from"./AlternativeSubmissionMethods-HiFwwICy.js";import{e as X,h as Oe,s as Ye,M as Be,a as He,S as Q,f as Je}from"./MalwareChecksPanel-DMAlp6cz.js";import{I as qe}from"./info-D5zhcT7u.js";import"./book-open-Caz2b750.js";import"./lock-CAeLtCCS.js";import"./crosshair-CQNJkBVv.js";import"./shield-alert-cz1iZj9B.js";import"./link-2-CKxS_3iO.js";import"./puzzle-Bcj0v0f6.js";import"./chart-column-C1wJcOix.js";const Ue=4.5*1024*1024,Ze=Re();function rs(){const{isAuthenticated:h,getValidToken:w}=ve(),{refreshCreditBalance:ee,seatLicensed:L}=ke(),{refreshRuns:se}=Ae(),[te,D]=l.useState(!1),{registerJob:ae,registerJobByType:le}=Ce(),[n,P]=l.useState(null),[ne,S]=l.useState(!1),[j,F]=l.useState(!1),[f,M]=l.useState(!1),[x,$]=l.useState(null),[c,z]=l.useState(null),[b,O]=l.useState(!1),[N,Y]=l.useState(!1),[,re]=l.useState(null),[B,oe]=l.useState("Free"),[ie,ce]=l.useState(null),[me,v]=l.useState(!1),[r,H]=l.useState(!1),[k,T]=l.useState(X),[y,E]=l.useState(!1),[I,de]=l.useState({}),[J,he]=l.useState(null),[q,U]=l.useState(!1),Z=l.useRef(null);l.useEffect(()=>{if(!h)return;(async()=>{try{const t=w(),a={"Content-Type":"application/json"};t&&(a.Authorization=`${t}`);const o=await fetch("https://api.bluelanternsecurity.io/tools",{method:"GET",headers:a});if(o.ok){const i=await o.json();let m=[];if(i.body&&typeof i.body=="string")try{m=JSON.parse(i.body).result||[]}catch{m=[]}else i.result?m=i.result:Array.isArray(i)&&(m=i);if(m.find(d=>d.id==="EMAILANALYZER")){const d="Free";ce(0),oe(d)}}}catch(t){console.error("Failed to fetch tool info",t)}})()},[h,w]);const R=s=>{s.preventDefault(),s.stopPropagation(),s.type==="dragenter"||s.type==="dragover"?S(!0):s.type==="dragleave"&&S(!1)},xe=s=>{if(s.preventDefault(),s.stopPropagation(),S(!1),!h){v(!0);return}s.dataTransfer.files&&s.dataTransfer.files[0]&&W(s.dataTransfer.files[0])},ue=s=>{s.preventDefault(),s.target.files&&s.target.files[0]&&W(s.target.files[0])},W=s=>{if(!s.name.endsWith(".eml")){alert("Please upload a .eml file");return}if(s.size>Ue){alert("Request too large. File size cannot exceed 4.5MB.");return}P(s),M(!1)},G=()=>{P(null),M(!1),$(null),z(null),O(!1),Y(!1),H(!1),T(X()),E(!1)},pe=async()=>{if(Object.keys(I).length>0||q)return;const s=w();if(s){U(!0);try{const{subToolCosts:t,allChecksCost:a}=await Je(s);de(t),he(a)}catch(t){console.error("Failed to fetch malware sub-tool costs:",t)}finally{U(!1)}}},fe=()=>{const s=!r;H(s),s&&pe()},be=()=>{const s=!y;E(s),T(Q.reduce((t,a)=>({...t,[a.key]:s}),{}))},ye=s=>{T(t=>{const a={...t,[s]:!t[s]};return E(Q.every(o=>a[o.key])),a})},u=Oe({allChecks:y,checks:k}),ge=Ye({allChecks:y,allChecksCost:J,checks:k,subToolCosts:I}),A=j||r&&!u,we=()=>{if(!h){v(!0);return}Z.current.click()},V=async(s,t,a)=>{const o=t(),i=await fetch("https://api.bluelanternsecurity.io/runs",{method:"POST",headers:{Authorization:`${s}`},body:o}),m=await i.json();let g=m;if(m.body&&typeof m.body=="string")try{g=JSON.parse(m.body)}catch(C){console.error("Failed to parse inner body",C)}const{jobId:d,cached:je,accepted:Ne}=Le(g);if(!i.ok||!Ne){const C=new Error(De(i.status,g));throw C.status=i.status,C}return d?ae(d,a,n?.name||"uploaded email"):le(a,n?.name||"uploaded email"),{jobId:d||null,cached:je,resultData:g}},_=async()=>{if(!n){alert("Please select a .eml file first");return}if(!h){v(!0);return}if(r&&!u){alert("Please select at least one malware analysis check, or uncheck the malware analysis option.");return}const s=w();if(!s){alert("Authentication error. Please log in again.");return}F(!0);try{const t=await V(s,()=>{const a=new FormData;return a.append("tool","EMAILANALYZER"),a.append("checkCost","false"),a.append("file",n),a},"EMAILANALYZER");if(re(t.resultData),$(t.jobId),O(t.cached),r&&u)try{const a=await V(s,()=>{const o=new FormData;return o.append("tool","STATICMALWAREANALYZER"),o.append("checkCost","false"),o.append("file",n),He(o,{checks:k,allChecks:y}),o},"STATICMALWAREANALYZER");z(a.jobId),Y(a.cached)}
1catch(a){console.error("Malware submission failed:",a),alert(`Email analysis submitted, but malware analysis failed: ${a.message}`)}M(!0),D(!1),ee(),se()}catch(t){console.error("API call failed:",t),t.status===429&&D(!0),alert(`Analysis failed: ${t.message||"Please try again later."}`)}finally{F(!1)}};return e.jsxs("div",{className:"tool-page min-h-screen bg-slate-950 text-white",children:[e.jsx(Pe,{}),e.jsx(Se,{title:"Email threat analyzer | Phishing detection for .eml files | Blue Lantern",description:"Upload .eml files to detect phishing, malicious links, and authentication failures across SPF, DKIM, and DMARC. Free scans to start, no subscription required.",path:"/email-analyzer"}),e.jsxs("div",{className:"tool-content relative max-w-6xl mx-auto px-4 pb-12 pt-24 sm:px-6 sm:pb-16 sm:pt-28",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-white mb-3",children:"Email Threat Analyzer"}),e.jsx("p",{className:"text-base text-slate-300 max-w-2xl mx-auto",children:"Upload .eml email files to detect potential phishing."}),e.jsxs("p",{className:"text-base text-slate-300 max-w-2xl mx-auto",children:[" Email data is NOT retained on our servers beyond 24 hours."," ",e.jsx("a",{href:"/privacy",title:"See our data privacy policy for more details",className:"inline-block align-middle w-4 h-4 rounded-full border border-slate-400 text-slate-400 hover:border-slate-200 hover:text-slate-200 transition-colors text-xs font-semibold text-center leading-4 -translate-y-0.5",children:"i"})]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:`relative rounded-[14px] border border-dashed transition-colors duration-300 ${ne?"border-cyan-400/60 bg-cyan-500/10":"border-slate-700/60 bg-slate-900/60"}`,onDragEnter:R,onDragLeave:R,onDragOver:R,onDrop:xe,children:[e.jsx("input",{ref:Z,type:"file",accept:".eml",onChange:ue,className:"hidden"}),e.jsxs("div",{className:"p-6 text-center sm:p-12",children:[e.jsx("div",{className:"mb-5 sm:mb-6",children:e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-[10px] bg-cyan-500/15 ring-1 ring-cyan-400/40 sm:h-20 sm:w-20",children:e.jsx(Me,{className:"w-8 h-8 text-cyan-200 sm:w-10 sm:h-10"})})}),e.jsx("h3",{className:"mb-2 text-lg font-semibold text-white break-all sm:text-xl",children:n?n.name:"Drag and Drop your email to scan here"}),e.jsx("p",{className:"mb-6 text-sm text-slate-300 sm:text-base",children:"or click the button below to browse your files"}),e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 sm:flex-row",children:[e.jsx("button",{onClick:we,className:`w-full rounded-md px-6 py-2.5 text-sm font-semibold transition-colors sm:w-auto sm:px-8 ${n?"border border-slate-700 bg-slate-800/50 text-slate-200 hover:border-slate-600 hover:bg-slate-800":"bg-cyan-500 text-slate-950 hover:bg-cyan-400"}`,children:n?"Change selected email":"Select Email File"}),n&&!f&&e.jsx("button",{onClick:_,disabled:A,className:`w-full rounded-md px-6 py-2.5 text-sm font-semibold transition-colors sm:w-auto sm:px-8 ${A?"bg-slate-700 text-slate-400 cursor-not-allowed":"bg-cyan-500 text-slate-950 hover:bg-cyan-400"}`,children:j?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-slate-400/40 border-t-slate-200 rounded-full animate-spin"}),"Submittingâ¦"]}):"Submit for Analysis"})]}),h?L?e.jsx("p",{className:"mt-4 text-sm font-medium text-emerald-300",children:"Included in your Seat License"}):e.jsxs("p",{className:"mt-4 text-sm font-medium text-cyan-300 tabular-nums",children:[B," per analysis"]}):e.jsxs("div",{className:"mt-4",children:[e.jsxs("p",{className:"text-sm font-medium text-cyan-300 tabular-nums",children:[B," â 30 scans a day"]}),e.jsx("a",{href:Ze,onClick:Te,className:"mt-1 inline-block text-sm font-semibold text-emerald-400 transition-colors hover:text-emerald-300",children:"Sign up free to start scanning"})]}),n&&!j&&!f&&e.jsxs("p",{className:"mt-4 text-sm text-emerald-300",children:[e.jsx(K,{className:"w-4 h-4 inline"})," File ready: ",n.name]})]}),e.jsxs("p",{className:"px-4 pb-4 text-center text-xs text-slate-500",children:[e.jsx(Ee,{className:"w-3 h-3 inline"})," Note: Request sizes cannot exceed 4.5MB"]}
1)]}),!n&&e.jsxs("div",{className:"mt-4 rounded-[14px] border border-slate-800/80 bg-slate-900/40 p-5",children:[e.jsxs("h3",{className:"mb-1 flex items-center gap-2 text-sm font-semibold text-white",children:[e.jsx(qe,{className:"h-4 w-4 text-cyan-300"})," How to save an email as a .eml file"]}),e.jsx("p",{className:"mb-3 text-xs text-slate-400",children:"Best done on a desktop computer. Most mobile mail apps canât export a .eml file."}),e.jsxs("div",{className:"space-y-2.5 text-sm text-slate-300",children:[e.jsxs("p",{className:"flex flex-col gap-0.5 sm:flex-row sm:gap-3",children:[e.jsx("span",{className:"font-medium text-white sm:w-24 sm:flex-shrink-0",children:"Gmail"}),e.jsxs("span",{children:["Open the email, click the ",e.jsx("span",{className:"text-white",children:"â®"})," menu (top right), then ",e.jsx("span",{className:"text-white",children:"Download message"}),"."]})]}),e.jsxs("p",{className:"flex flex-col gap-0.5 sm:flex-row sm:gap-3",children:[e.jsx("span",{className:"font-medium text-white sm:w-24 sm:flex-shrink-0",children:"Outlook"}),e.jsxs("span",{children:["Open the email, then ",e.jsx("span",{className:"text-white",children:"File â Save As"})," and choose the ",e.jsx("span",{className:"text-white",children:".eml"})," format."]})]}),e.jsxs("p",{className:"flex flex-col gap-0.5 sm:flex-row sm:gap-3",children:[e.jsx("span",{className:"font-medium text-white sm:w-24 sm:flex-shrink-0",children:"Apple Mail"}),e.jsxs("span",{children:["Select the email, then ",e.jsx("span",{className:"text-white",children:"File â Save As"})," and set the format to ",e.jsx("span",{className:"text-white",children:"Raw Message Source"}),"."]})]})]})]})]}),n&&!f&&e.jsxs("div",{className:"mb-8 space-y-4",children:[e.jsxs("div",{className:`group relative overflow-hidden rounded-[14px] border transition-all duration-200 cursor-pointer ${r?"border-cyan-400/40 bg-cyan-500/10 shadow-lg shadow-cyan-500/5":"border-slate-800/80 bg-slate-900/60 hover:border-slate-700 hover:bg-slate-900/80"}`,onClick:fe,role:"switch","aria-checked":r,children:[e.jsx("div",{className:"pointer-events-none absolute -right-16 -top-16 h-44 w-44 rounded-full bg-cyan-500/10 blur-3xl","aria-hidden":"true"}),e.jsxs("div",{className:"relative p-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:`flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-[10px] ring-1 transition-colors ${r?"bg-cyan-500/20 ring-cyan-400/40":"bg-slate-800/80 ring-slate-700/60"}`,children:e.jsx(Ie,{className:`h-5 w-5 ${r?"text-cyan-200":"text-cyan-300/80"}`})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-white sm:text-lg",children:"Want to scan this email for malware too?"}),e.jsx("p",{className:"mt-1 text-sm text-slate-300",children:"Weâll send the same .eml file to the Static Malware Analyzer in one step. Pick which checks to run below."})]})]}),e.jsxs("div",{className:"flex items-center gap-3 self-start sm:self-center",children:[e.jsx("span",{className:`text-xs font-medium tabular-nums transition-colors ${r?"text-cyan-200":"text-slate-500"}`,children:r?"Yes":"No"}),e.jsx("div",{className:`w-12 h-7 rounded-full transition-colors duration-200 flex items-center ${r?"bg-cyan-500 justify-end":"bg-slate-700 justify-start"}`,children:e.jsx("div",{className:"w-5 h-5 rounded-full bg-white shadow-md mx-1 transition-all duration-200"})})]})]})]}),r&&e.jsx(Be,{title:"Malware Analysis Options",description:"Pick which checks to run against the email file. At least one is required.",checks:k,allChecks:y,onCheckToggle:ye,onAllChecksToggle:be,subToolCosts:I,allChecksCost:J,costLoading:q,selectedCost:ge,hasAnyCheck:u})]}),n&&!f&&r&&e.jsx("div",{className:"rounded-[14px] bg-slate-900/60 border border-slate-800/80 mb-8",children:e.jsxs("div",{className:"p-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-white mb-3",children:"Ready to Analyze"}),e.jsxs("p",{className:"text-sm text-slate-300 mb-2",children:["Submit this email for threat analysis",r&&u?" and the selected malware checks":"",". Results will appear on your ",e.jsx(p,{to:"/monitoring-hub",className:"text-cyan-300 hover:text-cyan-200",children:"Monitoring Hub"})," in about ",e.jsx("span",{className:"text-white",children:"30 seconds"}),"."]}),e.jsx(Fe,{limitHit:te}),L?e.jsx("p",{className:"text-sm font-medium text-emerald-300 mb-6",children:"Included in your Seat License"}):ie!==null&&e.jsxs("p",{className:"text-sm font-medium text-cyan-300 mb-6",children:["Free Tier: 30 scans a day",r&&u&&e.jsx("span",{className:"ml-2 text-xs font-normal text-slate-400",children:"(email + malware count as two)"})]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("button",{onClick:_,disabled:A,className:`w-full rounded-md px-6 py-2.5 text-sm font-semibold transition-colors sm:w-auto ${A?"bg-slate-700 text-slate-400 cursor-not-allowed":"bg-cyan-500 text-slate-950 hover:bg-cyan-400"}`,children:j?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-slate-400/40 border-t-slate-200 rounded-full animate-spin"}),"Submittingâ¦"]}):"Submit for Analysis"}),e.jsx("button",{onClick:G,className:"w-full rounded-md border border-slate-700 bg-slate-800/50 px-6 py-2.5 text-sm font-medium text-slate-200 transition-colors hover:border-slate-600 hover:bg-slate-800 sm:w-auto",children:"Clear"})]})]})}),f&&e.jsx("div",{className:"rounded-[14px] bg-slate-900/60 border border-emerald-500/30 p-6 sm:p-8 mb-8",children:e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start",children:[e.jsx("div",{className:"w-12 h-12 rounded-[10px] bg-emerald-500/15 ring-1 ring-emerald-400/40 flex items-center justify-center flex-shrink-0",children:e.jsx(K,{className:"w-6 h-6 text-emerald-300"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:b&&(!c||N)?"Report ready":"Analysis
1submitted"}),e.jsx("p",{className:"text-sm text-slate-300 mb-4",children:b&&(!c||N)?e.jsxs(e.Fragment,{children:["Your email ",e.jsx("span",{className:"font-mono text-cyan-300 break-all",children:n?.name})," has been analyzed before, so your ",c?"reports are":"report is"," ",e.jsx("span",{className:"text-white",children:"ready now"})," â no new scan (or charge) was needed."]}):b?e.jsxs(e.Fragment,{children:["Your email ",e.jsx("span",{className:"font-mono text-cyan-300 break-all",children:n?.name})," was analyzed before, so the email report is ",e.jsx("span",{className:"text-white",children:"ready now"}),". The malware analysis is still running â its results will be available on your"," ",e.jsx(p,{to:"/monitoring-hub",className:"text-cyan-300 hover:text-cyan-200",children:"Monitoring Hub"})," in approximately ",e.jsx("span",{className:"text-white",children:"30 seconds"}),"."]}):e.jsxs(e.Fragment,{children:["Your email ",e.jsx("span",{className:"font-mono text-cyan-300 break-all",children:n?.name})," has been submitted",c?" for email and malware analysis":"",". Results will be available on your ",e.jsx(p,{to:"/monitoring-hub",className:"text-cyan-300 hover:text-cyan-200",children:"Monitoring Hub"})," in approximately ",e.jsx("span",{className:"text-white",children:"30 seconds"}),"."]})}),(x||c)&&e.jsxs("div",{className:"p-3 rounded-md bg-slate-900/80 border border-slate-800 mb-4 space-y-1",children:[x&&e.jsxs("p",{className:"text-sm text-slate-400",children:["Email job ID: ",e.jsx("span",{className:"font-mono text-cyan-300",children:x})]}),c&&e.jsxs("p",{className:"text-sm text-slate-400",children:["Malware job ID: ",e.jsx("span",{className:"font-mono text-cyan-300",children:c})]})]}),e.jsxs("div",{className:"mt-6 flex flex-col gap-3 sm:flex-row",children:[b&&x&&e.jsx(p,{to:`/email-report/${x}`,className:"inline-flex items-center justify-center rounded-md bg-cyan-500 px-6 py-2 text-sm font-semibold text-slate-950 transition-colors hover:bg-cyan-400",children:"View Email Report Now"}),N&&c&&e.jsx(p,{to:`/malware-report/${c}`,className:"inline-flex items-center justify-center rounded-md bg-cyan-500 px-6 py-2 text-sm font-semibold text-slate-950 transition-colors hover:bg-cyan-400",children:"View Malware Report Now"}),!(b&&x&&(!c||N&&c))&&e.jsx(p,{to:"/monitoring-hub",className:"inline-flex items-center justify-center rounded-md bg-cyan-500 px-6 py-2 text-sm font-semibold text-slate-950 transition-colors hover:bg-cyan-400",children:"Go to Monitoring Hub"}),e.jsx("button",{onClick:G,className:"rounded-md border border-slate-700 bg-slate-800/50 px-6 py-2 text-sm font-medium text-slate-200 transition-colors hover:border-slate-600 hover:bg-slate-800",children:"Analyze Another Email"})]})]})]})}),e.jsx($e,{isAuthenticated:h,showMailbox:!0,intro:"Prefer not to upload through the UI? You can also submit suspicious emails through one of the channels below.",api:{endpoint:"https://api.bluelanternsecurity.io/runs",method:"POST",description:"Send a multipart/form-data request with the .eml file. Requires an API key from API Access.",body:{type:"form",fields:[{key:"tool",value:"EMAILANALYZER"},{key:"file",value:"@your-email.eml",placeholder:!0},{key:"checkCost",value:"false"}]},docsLink:{to:"/documentation/business-use-cases/automate-email-analysis-through-our-api",label:"full API guide"}}})]}),e.jsx(ze,{open:me,onClose:()=>v(!1),toolName:"Email Threat Analyzer"})]})}export{rs as default};
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.