|
System | : | Linux MiraNet 3.0.0-14-generic-pae #23-Ubuntu SMP Mon Nov 21 22:07:10 UTC 2011 i686 |
Software | : | Apache. PHP/5.3.6-13ubuntu3.10 |
ID | : | uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)
|
|
Safe Mode | : | OFF |
Open_Basedir | : | OFF |
Freespace | : | 24.01 GB of 70.42 GB (34.09%) |
|
MySQL: ON MSSQL: OFF Oracle: OFF PostgreSQL: OFF Curl: OFF Sockets: ON Fetch: OFF Wget: ON Perl: ON |
Disabled Functions: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
|
[ System Info ]
[ Processes ]
[ SQL Manager ]
[ Eval ]
[ Encoder ]
[ Mailer ]
[ Back Connection ]
[ Backdoor Server ]
[ Kernel Exploit Search ]
[ MD5 Decrypter ]
[ Reverse IP ]
[ Kill Shell ]
[ FTP Brute-Force ]
|
|
/
usr/
share/
pyshared/
landscape/
lib/
- drwxr-xr-x
|
Viewing file: command.py (1.15 KB) -rw-r--r--Select action/file-type:  ( +) |  ( +) |  ( +) | Code ( +) | Session ( +) |  ( +) | SDB ( +) |  ( +) |  ( +) |  ( +) |  ( +) |  ( +) |
"""Shell commands execution.""" import commands
class CommandError(Exception): """ Raised by L{run_command} in case of non-0 exit code.
@cvar command: The shell command that failed. @cvar exit_status: Its non-zero exit status. @cvar output: The command's output. """ def __init__(self, command, exit_status, output): self.command = command self.exit_status = exit_status self.output = output
def __str__(self): return "'%s' exited with status %d (%s)" % ( self.command, self.exit_status, self.output)
def __repr__(self): return "<CommandError command=<%s> exit_status=%d output=<%s>>" % ( self.command, self.exit_status, self.output)
def run_command(command): """ Execute a command in a shell and return the command's output.
If the command's exit status is not 0 a L{CommandError} exception is raised. """ exit_status, output = commands.getstatusoutput(command) # shift down 8 bits to get shell-like exit codes exit_status = exit_status >> 8 if exit_status != 0: raise CommandError(command, exit_status, output) return output
|