Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTI snapshot unzip #312

Open
1 of 2 tasks
abbonno opened this issue Mar 11, 2025 · 1 comment · May be fixed by #319
Open
1 of 2 tasks

CTI snapshot unzip #312

abbonno opened this issue Mar 11, 2025 · 1 comment · May be fixed by #319
Assignees
Labels
level/subtask Subtask issue type/enhancement Enhancement issue

Comments

@abbonno
Copy link
Member

abbonno commented Mar 11, 2025

Description

To index the content from the snapshot we need to unzip it first. For that, we will integrate the selected tool on #311 within the content manager.

Functional requirements

  • Created unzip tool files.
  • Unzip tool tested and integrated properly.
@abbonno abbonno added level/subtask Subtask issue type/enhancement Enhancement issue labels Mar 11, 2025
@wazuhci wazuhci moved this to Backlog in XDR+SIEM/Release 5.0.0 Mar 11, 2025
@abbonno abbonno self-assigned this Mar 12, 2025
@wazuhci wazuhci moved this from Backlog to In progress in XDR+SIEM/Release 5.0.0 Mar 12, 2025
@abbonno
Copy link
Member Author

abbonno commented Mar 12, 2025

Unzip basic code
import java.io.*;
import java.util.zip.*;

public class Unzip {
    
    /*
     * Unzips a ZIP file in a specified folder
     * @param zipFilePath Origin ZIP file path following the format: "path/file.zip"
     * @param destDirectory Unzipped file destiny path following the format: "path/"
     */
    public void unzip(String zipFilePath, String destDirectory) {
        try (ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFilePath))) {
            ZipEntry entry;
            while ((entry = zipIn.getNextEntry()) != null) {
                File filePath = new File(destDirectory + entry.getName());

                try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath))) {
                    byte[] buffer = new byte[1024];
                    int len;
                    while ((len = zipIn.read(buffer)) > 0) {
                        bos.write(buffer, 0, len);
                    }
                } catch (IOException e) {
                    System.err.println("Error al extraer el archivo: " + filePath);
                }
                zipIn.closeEntry();
            }
            System.out.println("Descompresión completada en: " + destDirectory);
        } catch (IOException e) {
            System.err.println("Error al descomprimir: " + e.getMessage());
        }
    }
}

@wazuhci wazuhci moved this from In progress to On hold in XDR+SIEM/Release 5.0.0 Mar 12, 2025
@wazuhci wazuhci moved this from On hold to In progress in XDR+SIEM/Release 5.0.0 Mar 13, 2025
@abbonno abbonno linked a pull request Mar 13, 2025 that will close this issue
@AlexRuiz7 AlexRuiz7 linked a pull request Mar 13, 2025 that will close this issue
@wazuhci wazuhci moved this from In progress to Pending review in XDR+SIEM/Release 5.0.0 Mar 13, 2025
@wazuhci wazuhci moved this from Pending review to In progress in XDR+SIEM/Release 5.0.0 Mar 13, 2025
@wazuhci wazuhci moved this from In progress to Pending review in XDR+SIEM/Release 5.0.0 Mar 13, 2025
@wazuhci wazuhci moved this from Pending review to On hold in XDR+SIEM/Release 5.0.0 Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/subtask Subtask issue type/enhancement Enhancement issue
Projects
Status: On hold
Development

Successfully merging a pull request may close this issue.

2 participants