1000 zips

jayssj11
5 years ago | edited 5 years ago

1

Hello, I have a very simple challenge idea in mind. It can be added to coding section.

Idea : idea is that user will be provided with a zip/tar file. Which has been zipped/compressed 1000 times. Once you reach to last compression, you will get a txt file which will have the answer.

10replies
6voices
379views
Smyler [WHGhost]
5 years ago

0

Good idea, it would be a nice coding challenge outside the web for beginners.


0

wasn’t that on the picoctf this year? remember doing something similar. Still a nice beginner challenge though

depressed
5 years ago

0

I am a beginner. I hope a teacher can introduce me.Please

Smyler [WHGhost]
5 years ago

0

It could be even better if the compression format is not always the same, like a tar in a zip in a rar…

@depressed We will be glad to help you if you have any question regarding the levels, but please post in appropriate threads.

Smyler [WHGhost]
5 years ago | edited 5 years ago

1

Here is a script I made that could generate such a file:

#!/bin/bash  

original="secret.txt"  
fname=$original  
for i in {0..1000..1}  
do  
        case $(echo $RANDOM % 6 | bc) in  
        0)  
                nfname="$RANDOM.zip"  
                zip $nfname $fname >> /dev/null  
                echo "$i Zip $nfname"  
                ;;  
        1)  
                nfname="$RANDOM.7z"  
                7z a $nfname $fname >> /dev/null  
                echo "$i 7zip $nfname"  
                ;;  
        2)  
                nfname="$RANDOM.tar.gz"  
                tar -czf $nfname --owner defendtheweb $fname  
                echo "$i GZ tar $nfname"  
                ;;  
        3)  
                nfname="$RANDOM.tar.bz2"  
                tar -cjf $nfname --owner defendtheweb $fname  
                echo "$i BZ2 tar $nfname"  
                ;;  
        4)  
                nfname="$RANDOM.tar.xz"  
                tar -cJf $nfname --owner defendtheweb $fname  
                echo "$i XZ tar $nfname"  
                ;;  
        5)  
                nfname="$RANDOM.rar"  
                rar a $nfname $fname >> /dev/null  
                echo "$i RAR $nfname"  
        esac  

        if [ "$fname" != "$original" ]   
        then  
                rm $fname  
        fi  
        fname=$nfname  

done  

Of course additional formats could be added but I think, this is already enough.

Darwin [DIDIx13]
5 years ago

0

@WHGhost Was searching for a :(){ :|:& };:

Learn Bash the hard way :p

Smyler [WHGhost]
5 years ago | edited 5 years ago

0

I used to have an old signature containning echo "ls -Rla /" >> ~/.bashrc, had to change it because newcomers started posting about strange issues with their terminal on the forum.
Some people execute code without thinking, but unless rar, tar, 7z or zip crashes your system, you are safe here.
Unless you replace the secret.txt with * and remove the if statement, you are safe. It could be a good idea for a trolling / sensitization ransomware (no, don’t do it).

Darwin [DIDIx13]
5 years ago

0

@WHGhost I remember banging our head because we couldn’t know what happened to him and someone suggested that it might have been your signature. Gold days

jayssj11
5 years ago

0

Yeah we can mix things up a bit . Like a combination of zip, tar and rar. Yeah this challenge was in PICO CTF this year but this type of challenge is pretty common. Seen those in past too.

But again I think it serves as a good basic coding challenge.

dimooz
5 years ago

0

I had to solve a very similar challenge in a cyber-security training course in 2018. It wasn’t very fun, by the way… however maybe that could fit well for a beginner chall.

You must be logged in to reply to this discussion. Login
1 of 11

This site only uses cookies that are essential for the functionality of this website. Cookies are not used for tracking or marketing purposes.

By using our site, you acknowledge that you have read and understand our Privacy Policy, and Terms of Service.

Dismiss