Add stealer parser

Signed-off-by: Andrea Pavone <info@andreapavone.com>
This commit is contained in:
2024-11-10 19:43:46 +01:00
parent eb0b894e1c
commit 94ec1f888d
3 changed files with 239 additions and 5 deletions

View File

@ -7,18 +7,26 @@ import { TextSearchIcon } from 'lucide-react';
import {
Table,
TableBody,
TableCaption,
TableCell,
TableFooter,
TableHead,
TableHeader,
TableRow,
} from "@/Components/ui/table"
import FileUpload from "@/Components/FileUpload";
import {Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle} from "@/Components/ui/card";
type ParsedFile = {
url: string,
username: string,
password: string,
application: string,
}
export default function Home() {
const [securitySummaryResponse, setSecuritySummaryResponse] = useState<SecuritySummaryResponseType | null>(null);
const [parsedFile, setParsedFile] = useState<null| ParsedFile[]>(null);
useEffect(() => {
axios.get<SecuritySummaryResponseType>('/api/v1/security/summary')
.then(response => {
@ -29,6 +37,29 @@ export default function Home() {
});
}, []);
const handleFileUpload = async (file: File) => {
// Gestisci il file qui
// Esempio: invia il file al server
const formData = new FormData();
formData.append('file', file);
try {
const response = await axios.post('/api/v1/parse/stealer', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
});
if(response.data.status === 'success'){
setParsedFile(response.data.data);
console.log('data', response.data.data);
}
} catch (error) {
console.error('Upload failed:', error);
}
};
return (
<div className="container mx-auto p-4 space-y-6">
@ -76,10 +107,36 @@ export default function Home() {
<CardDescription></CardDescription>
</CardHeader>
<CardContent>
--todo
<FileUpload
onFileUpload={handleFileUpload}
/>
<h3 className="text-2xl mt-6">Parse Output</h3>
<Table>
<TableHeader>
<TableRow>
<TableHead>Application</TableHead>
<TableHead>URL</TableHead>
<TableHead>Username</TableHead>
<TableHead>Password</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{parsedFile?.map((value, index) => (
<TableRow key={index}>
<TableCell>{value.application}</TableCell>
<TableCell>{value.url}</TableCell>
<TableCell>{value.username}</TableCell>
<TableCell>{value.password}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</CardContent>
</Card>
</div>
);
};