SkillAgentSearch skills...

Sudome

PoC for privileged projects from non-privileged PyCharm sessions.

Install / Use

/learn @samayer12/Sudome
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

sudome

A proof-of-concept for PyCharm projects that must run with elevated permissions on Linux. python-sudo.sh sources the virtual environment and then executes the project with elevated permissions. setup.sh places the appropriate entry in /etc/sudoers.d/python. The user must enter their sudo credentials during setup.sh.

Usage

  1. Ensure setup.sh is executable (ls -l setup.sh).

    -rwxr--r-- 1 user user   535 Mmm DD HH:MM python-sudo.sh
    
  2. Run ./setup.sh from project root. Example output:

    [user@host sudome]$ /bin/bash /home/user/PycharmProjects/sudome/setup.sh
    Configuration Line:
    [sudo] password for user: 
    user host = (root) NOPASSWD: /usr/bin/python
    File contents: /etc/sudoers.d/python
    user host = (root) NOPASSWD: /usr/bin/python
    
  3. Add python as a venv project interpreter in PyCharm.

  4. Add python-sudo.sh as a project interpreter in PyCharm. This will time out or throw an error, but it will be okay.

  5. Observe the available run configs from .idea/runConfigurations/.

  6. Choose any config through PyCharm and run it (Shift + F10).

Required Project Structure

ProjectRoot/
  |-.idea/
  |  \- runConfigurations/
  |     \- [XML files]
  |- src/
  |- test/
  |- python-sudo.sh
  |- requirements.txt
  \- setup.sh

Inspired by Eric Smith.

View on GitHub
GitHub Stars14
CategoryDevelopment
Updated1y ago
Forks5

Languages

Shell

Security Score

60/100

Audited on Oct 1, 2024

No findings