Giter VIP home page Giter VIP logo

sshearch's Introduction

Key Pattern Search and Delete Tool

This CLI tool searches for a specific regex pattern within all files in a given directory and optionally prompts to delete the file if the pattern is found.

This CLI tool was made durin BsidesLV23 Pros vs Joes ctf.

Usage

Search Pattern in Directory

Run the script with the directory as the argument to search for the default pattern "BEGIN.*KEY":

which python3
sudo apt-get install git
git clone https://github.com/impoSTARS/sshearch
cd sshearch
sudo su

python3 search.py -d / --delete --non-interactive
python search.py
python search.py -d /home/umlal/.ssh

Single line to deploy:

 which python3 && sudo apt-get install -y git && git clone https://github.com/impoSTARS/sshearch && cd sshearch && sudo python3 search.py -d / --delete --non-interactive

Search Custom Pattern in Directory

You can also specify a different pattern to search:

python search.py -p regexpattern -d directory

Search and Prompt to Delete Files

To search for the pattern and prompt to delete any files where the pattern is found, use the --delete option:

python search.py -d /home/umlal/.ssh --delete

If the pattern is found, you will be prompted with a question asking if you want to delete the file. Type 'y' or 'Y' to confirm the deletion, or 'n' or 'N' to skip to the next file. Warning

When using the --delete option, ensure that you have proper permissions and understand that the files will be forcibly deleted without recovery. Use this option with caution. Requirements

Python 3.x

sshearch's People

Contributors

sirappsec 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.