Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Complete Challenge: Folder Hacking

In your system, what's the fastest way to make a folder for each alphabet and inside each of these folders there's a subfolder with every alphabet once again.

Alphabets A-Z

Who will win this?
Code
for l in {A...Z} do mkdir $l; done
for l in {A...Z} do for i in {A...Z} do mkdir $l/$i; done

Or if you want a one-line solution:
Code
for l in {A...Z} do mkdir $l | for i in {A...Z} do mkdir $/$i; done; done

Note: This is just logic code.
Drink all the booze, hack all the things.
hackirc.net
Plex. That is all.

I do not dare test this for fear it will recurse forever and completely fuck my SSD. Play with this at your own risk.

PHP Code

<?php 
#!/usr/bin/python

import os
import sys

if sys.argv < 2:
   print(
"[-] You forgot to give me the path to the rabbit hole.")
   return -
1

path 
= sys.argv[1].encode('unicode-escape')
alphabet = "abcdefghijklmnopqrstuvwxyz"

def white_rabbit():
     
   for 
letter in alphabet:
      
os.makedirs('letter')

   for 
root, directories in os.walk(path):
      for 
directory in directories:
         print(
"[+] Now writing to: " + os.path.join(root, directory))
         for 
letter in alphabet:
            
newpath = path + '//' + letter
            os
.chdir(newpath)

            for 
letter in alphabet:
               
os.makedirs('letter')

def main():
   print(
"[*] Welcome, Alice, this is the rabbit-hole to Wonderland.")

   try:
      
os.chdir(path)

   
except OSError:
      print(
"[-] The rabbit hole caved in...\n[-] Your path is broken, fix it.")
      
sys.exit(-1)

   
white_rabbit()

if 
__name__ == '__main__':
   
main() 
Malware Dev & Grey Hat available for contract work. DM if you need me.
OSCP, OSCE, OSEE, OSWE, OSWP, CEH, CISSP
Yeah, I've been around a while
(Jun 1, 2017 12:42 PM)Nomad.Null Wrote:  I do not dare test this for fear it will recurse forever and completely fuck my SSD. Play with this at your own risk.

PHP Code

<?php 
#!/usr/bin/python

import os
import sys

if sys.argv < 2:
   print(
"[-] You forgot to give me the path to the rabbit hole.")
   return -
1

path 
= sys.argv[1].encode('unicode-escape')
alphabet = "abcdefghijklmnopqrstuvwxyz"

def white_rabbit():
     
   for 
letter in alphabet:
      
os.makedirs('letter')

   for 
root, directories in os.walk(path):
      for 
directory in directories:
         print(
"[+] Now writing to: " + os.path.join(root, directory))
         for 
letter in alphabet:
            
newpath = path + '//' + letter
            os
.chdir(newpath)

            for 
letter in alphabet:
               
os.makedirs('letter')

def main():
   print(
"[*] Welcome, Alice, this is the rabbit-hole to Wonderland.")

   try:
      
os.chdir(path)

   
except OSError:
      print(
"[-] The rabbit hole caved in...\n[-] Your path is broken, fix it.")
      
sys.exit(-1)

   
white_rabbit()

if 
__name__ == '__main__':
   
main() 

Doesn't work. Maybe I do contest winner wins money :D
(Jun 2, 2017 10:58 AM)mrwhitecock Wrote:  Doesn't work. Maybe I do contest winner wins money :D

Why not take the opportunity to learn to code for yourself?

You'd be expanding on what you already know and could release what you've learned in a tutorial to further help the community.
(Jun 2, 2017 10:58 AM)mrwhitecock Wrote:  Doesn't work. Maybe I do contest winner wins money :D

I posted the fucking code in the first post you dumb cunt.
My code works fine.

Why u reply to TrueDemon and not me? I'm not good enough for u because i don't have a fancy sig?

[Image: e9bde3f494aca6d77c51b617a8841ffa.png]

Code
reece@RMorgan-Desktop:~/testfolder$ for l in {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}; do mkdir $l; for i in {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z} ; do  mkdir $l/$i; done; done;
reece@RMorgan-Desktop:~/testfolder$ ls
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z
reece@RMorgan-Desktop:~/testfolder$ ls A
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z
reece@RMorgan-Desktop:~/testfolder$ ls B
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z
reece@RMorgan-Desktop:~/testfolder$

EDIT: Sorry for raging at u im drunked.
Drink all the booze, hack all the things.
hackirc.net
Plex. That is all.

Reece's code is vastly more efficient than my solution anyhow, and it doesn't result in an infinite recursion. I was under the impression he was looking for a rabbit virus.
Malware Dev & Grey Hat available for contract work. DM if you need me.
OSCP, OSCE, OSEE, OSWE, OSWP, CEH, CISSP
Yeah, I've been around a while
I remember a .bat file back in the day that was easy to write in notepad and when ran it endlessly makes folders in folders and fucks your HDD. Now im thinking about getting one of those rubber duckies.
What will the winner Get?
Give this a go. Be careful as it will run forever
PHP Code

<?php 
import os
import string

folders_to_visit 
= ["."]

while 
True:
    for 
x in string.ascii_lowercase:
        
os.mkdir(os.path.join(folers_to_visit[0], x))

        
folders_to_visit.append(os.path.join(folders_to_visit[0], x))

    
folders_to_visit.pop(0) 

Hope everyone has a wonderful day!


Possibly Related Threads...
Thread / Author Replies Views Last Post
by SandeepkrSep 27, 2016 11:25 AM 0 147 Sep 27, 2016 11:25 AM
Last Post: Sandeepkr
by xMoDOct 3, 2014 06:13 PM 9 309 Oct 3, 2014 06:13 PM
Last Post: Zabuza…
by Russian PersonJul 29, 2012 06:54 PM 0 131 Jul 29, 2012 06:54 PM
Last Post: Russian Person