• Stars
    star
    117
  • Rank 300,127 (Top 6 %)
  • Language
    Python
  • License
    Other
  • Created over 6 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Python library for requesting root privileges

Elevate: Request root privileges

Elevate is a small Python library that re-launches the current process with root/admin privileges using one of the following mechanisms:

  • UAC (Windows)
  • AppleScript (macOS)
  • pkexec, gksudo or kdesudo (Linux)
  • sudo (Linux, macOS)

Usage

To use, call elevate.elevate() early in your script. When run as root this function does nothing. When not run as root, this function replaces the current process (Linux, macOS) or creates a new process, waits, and exits (Windows). Consider the following example:

import os
from elevate import elevate

def is_root():
    return os.getuid() == 0

print("before ", is_root())
elevate()
print("after ", is_root())

This prints:

before False
before True
after True

On Windows, the new process's standard streams are not attached to the parent, which is an inherent limitation of UAC. By default the new process runs in a new console window. To suppress this window, use elevate(show_console=False).

On Linux and macOS, graphical prompts are tried before sudo by default. To prevent graphical prompts, use elevate(graphical=False).

More Repositories

1

quarry

Python library that implements the Minecraft network protocol and data types
Python
532
star
2

MCRcon

Use minecraft's new-fangled Rcon
Python
112
star
3

mark2

minecraft server wrapper, written in python with twisted
Python
105
star
4

pathlab

Extends Pathlib to archives, images, remote filesystems, etc
Python
33
star
5

rex

Minecraft packet sniffer
Python
31
star
6

httpio

Python library for reading HTTP resources as random-access file-like objects using the `Range` header
Python
30
star
7

isoparser

Parser for the ISO 9660 disk image format
Python
29
star
8

asyncvnc

Asynchronous VNC for Python
Python
26
star
9

iso9660

this python library can list and extract files from a common (non-utf) iso file
Python
25
star
10

pathlib-abc

Python base classes for rich path objects
Python
23
star
11

MCQuery

Use minecraft's new-fangled Query protocol
Python
18
star
12

bvdf

Tools for decoding the binary variant of the Valve Data Format
Python
17
star
13

authserver

A skeleton minecraft server which kicks users when they log in successfully
Python
16
star
14

barneymc

This is my working python minecraft protocol implementation, with bonus asynchat client/server skeletons
Python
13
star
15

JSRPC

For your web ui: access javascript variables and functions in native python
Python
11
star
16

cedar

cedar will generate a cartograph of a minecraft seed
Python
9
star
17

Ashitaka

Minecraft client/proxy
Python
5
star
18

minebnc

Minecraft Bouncer
Python
5
star
19

pytest-vnc

Cross-platform keyboard, video and mouse for pytest
Python
5
star
20

PlumpXP

Bukkit plugin to increase XP drops from mobs
Java
4
star
21

pybind

Multi-platform global keybinding module for python
Python
3
star
22

asyncio-raknet

Python asyncio of RakNet
Python
3
star
23

keysymdef

X11 keysym data for Python
Python
2
star
24

smpmap

Simple world manager and parser for the Minecraft SMP map format
Python
2
star
25

mcocr

OCR library for MC screenshots + screenshot manager
Python
2
star
26

pixieboot

Straightforward PXE booting for windows and linux
1
star
27

RT-E

1
star
28

CutePVP

A team based PVP bukkit plugin
Java
1
star
29

helixir

Python interface to the Perforce RPC API
Python
1
star
30

xox

Lightweight virtualenv orchestration
Python
1
star
31

pathlib-artifactory

Python client for Artifactory
Python
1
star
32

shortcwd

Wraps SUBST in a context manager. Helps shorten path lengths to avoid MAX_PATH.
Python
1
star
33

quarry-ng

WIP next gen quarry
Python
1
star