Check all writable directories of Linux system

Check all writable directories of Linux system

Unix-Sedat-Ozdemir

Hi everybody. In penetration tests, we can exploit many linux systems but usually we have low-privilege in these systems. We can use powerful tools to privilege escalation. (ex: linuxprivchecker). But first we need to (normal user) writable folder for downloading these tools. So I created a Python script for meet the needs. I hope it will work 🙂

def GetAllDirectory():
    # Get all directory names
    for DirectoryName in os.walk("/"):
        # Current is directory writable or not
        if os.access(DirectoryName[0],os.W_OK) == True:
            print("[!] This directory is writable : " + DirectoryName[0])

if __name__ == "__main__":
    GetAllDirectory()
    print("Done")

Just copy the code and set name like start.py. And run with python start.py. The output is as follows:

 

Referances:
https://www.tutorialspoint.com/python/os_walk.htm
https://docs.python.org/3/library/os.html
Also you can visit Python category for reading the other posts.

Tarafından yazıldı
Sedat Ozdemir
Bir yorum bırak

Teşekkürler!

Bloğumu ziyaret ettiğiniz ve yazılarımı okuduğunuz için teşekkürler!