Git Product home page Git Product logo

diskwalker's Introduction

Diskwalker

a simple script to walk your disk and keep track of interesting sets of files

After gaining access to a remote machine during penetration testing, you might want to find interesting configuration files or binaries to attempt a privilege escalation.

The script is self contained, and works on both Python3 and Python2.7, so as to be compatible with both recent machines (who don't ship python2 by default) and not-so-recent as well.

Instead of executing several find commands, this simple script just keep track of them by doing a single pass over your whole disk tree structure, by applying all the predicates (the functions ending in _p or _filep for predicates to be applied only to files).

Still a WIP, but the code is really tight and it's very easy to write your own predicates: it just needs to be a function that receives a file path and returns a boolean.

At the end, all the sets of files are stored in a dictionary called d, its keys are the predicate names. To get access to it simply execute python3 -i diskwalk.py. You will be dropped in a python repl, and since these are python sets you can easily do operations like

d['executable_files'] & d['writable_files']

To get the set of files that are both writable and executable

d['executable_files'] - d['readable_files']

To get the files executable but not readable

d['owned_by_nobody_dirs'] | d['owned_by_nobody_files']

To get the union of directories and files owned by the nobody user

The obtained data will be saved to a pickled and compressed file dump.gz, simply supply it as an argument to load it and avoid scanning the disk again

python -i diskwalk.py dump.gz

Due to how python's pickle works, the usual caveats apply: you won't be able to load this same file into a different python interpreter from the one that you used to generate the file, for example.

diskwalker's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.