Post

Securinets isetZg:Compression Madness

Securinets isetZg:Compression Madness

TASK

Securinets

Handout

The handout is a endless zip file, in this case i need to create a script to unzip everything automatically .

Endless zip extraction

Here is the bash script i used

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
    unzip file.zip
    prev_file="200.zip"

    while [ -f "$prev_file" ]
    do
        echo "Contents of $prev_file:"
        unzip -l "$prev_file"

        curr_file=$(unzip -Z1 "$prev_file")
        unzip "$prev_file" -d "$(dirname "$prev_file")"
        rm "$prev_file"
        prev_file="$curr_file"

        if [ "$prev_file" = "stop.zip" ]; then
            break
        fi
    done

The result is two files one is password.txt and the other is another endless .tar files

Securinets

The password.txt content :

1
Password : HalfWay400                                                                                                                                                                                                                                    

Endless Tar extraction

Here is the bash script i used

1
2
3
4
5
6
7
8
9
10
11
12
13
14
    prev_file="200.tar"

    while [ -f "$prev_file" ]
    do
        echo "Contents of $prev_file:"
        tar -tf "$prev_file" 
        curr_file=$(tar -tf "$prev_file" | head -n 1)
        mkdir -p temp
        tar -xf "$prev_file" -C temp
        prev_file="temp/$curr_file"
        if [ "$prev_file" = "stop.tar" ]; then
            break
        fi
    done

Securinets

Flag

Now we have the pdf and the password for it .

Securinets

Now we only have to submit it

Securinets

This post is licensed under CC BY 4.0 by the author.