GRAYBYTE WORDPRESS FILE MANAGER9643

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /lib64/python2.7/Demo/tkinter/guido/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /lib64/python2.7/Demo/tkinter/guido//ShellWindow.py
import os
import sys
import string
from Tkinter import *
from ScrolledText import ScrolledText
from Dialog import Dialog
import signal

BUFSIZE = 512

class ShellWindow(ScrolledText):

    def __init__(self, master=None, shell=None, **cnf):
        if not shell:
            try:
                shell = os.environ['SHELL']
            except KeyError:
                shell = '/bin/sh'
            shell = shell + ' -i'
        args = string.split(shell)
        shell = args[0]

        apply(ScrolledText.__init__, (self, master), cnf)
        self.pos = '1.0'
        self.bind('<Return>', self.inputhandler)
        self.bind('<Control-c>', self.sigint)
        self.bind('<Control-t>', self.sigterm)
        self.bind('<Control-k>', self.sigkill)
        self.bind('<Control-d>', self.sendeof)

        self.pid, self.fromchild, self.tochild = spawn(shell, args)
        self.tk.createfilehandler(self.fromchild, READABLE,
                                  self.outputhandler)

    def outputhandler(self, file, mask):
        data = os.read(file, BUFSIZE)
        if not data:
            self.tk.deletefilehandler(file)
            pid, sts = os.waitpid(self.pid, 0)
            print 'pid', pid, 'status', sts
            self.pid = None
            detail = sts>>8
            cause = sts & 0xff
            if cause == 0:
                msg = "exit status %d" % detail
            else:
                msg = "killed by signal %d" % (cause & 0x7f)
                if cause & 0x80:
                    msg = msg + " -- core dumped"
            Dialog(self.master,
                   text=msg,
                   title="Exit status",
                   bitmap='warning',
                   default=0,
                   strings=('OK',))
            return
        self.insert(END, data)
        self.pos = self.index("end - 1 char")
        self.yview_pickplace(END)

    def inputhandler(self, *args):
        if not self.pid:
            self.no_process()
            return "break"
        self.insert(END, "\n")
        line = self.get(self.pos, "end - 1 char")
        self.pos = self.index(END)
        os.write(self.tochild, line)
        return "break"

    def sendeof(self, *args):
        if not self.pid:
            self.no_process()
            return "break"
        os.close(self.tochild)
        return "break"

    def sendsig(self, sig):
        if not self.pid:
            self.no_process()
            return "break"
        os.kill(self.pid, sig)
        return "break"

    def sigint(self, *args):
        return self.sendsig(signal.SIGINT)

    def sigquit(self, *args):
        return self.sendsig(signal.SIGQUIT)

    def sigterm(self, *args):
        return self.sendsig(signal.SIGTERM)

    def sigkill(self, *args):
        return self.sendsig(signal.SIGKILL)

    def no_process(self):
        Dialog(self.master,
               text="No active process",
               title="No process",
               bitmap='error',
               default=0,
               strings=('OK',))

MAXFD = 100     # Max number of file descriptors (os.getdtablesize()???)

def spawn(prog, args):
    p2cread, p2cwrite = os.pipe()
    c2pread, c2pwrite = os.pipe()
    pid = os.fork()
    if pid == 0:
        # Child
        for i in 0, 1, 2:
            try:
                os.close(i)
            except os.error:
                pass
        if os.dup(p2cread) <> 0:
            sys.stderr.write('popen2: bad read dup\n')
        if os.dup(c2pwrite) <> 1:
            sys.stderr.write('popen2: bad write dup\n')
        if os.dup(c2pwrite) <> 2:
            sys.stderr.write('popen2: bad write dup\n')
        os.closerange(3, MAXFD)
        try:
            os.execvp(prog, args)
        finally:
            sys.stderr.write('execvp failed\n')
            os._exit(1)
    os.close(p2cread)
    os.close(c2pwrite)
    return pid, c2pread, p2cwrite

def test():
    shell = string.join(sys.argv[1:])
    root = Tk()
    root.minsize(1, 1)
    if shell:
        w = ShellWindow(root, shell=shell)
    else:
        w = ShellWindow(root)
    w.pack(expand=1, fill=BOTH)
    w.focus_set()
    w.tk.mainloop()

if __name__ == '__main__':
    test()

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
June 15 2024 08:34:37
root / root
0755
AttrDialog.py
14.004 KB
April 19 2020 21:13:39
root / root
0644
AttrDialog.pyc
18.325 KB
April 10 2024 04:58:47
root / root
0644
AttrDialog.pyo
18.325 KB
April 10 2024 04:58:47
root / root
0644
ManPage.py
6.695 KB
April 19 2020 21:13:39
root / root
0644
ManPage.pyc
6.272 KB
April 10 2024 04:58:47
root / root
0644
ManPage.pyo
6.272 KB
April 10 2024 04:58:47
root / root
0644
MimeViewer.py
4.392 KB
April 10 2024 04:57:37
root / root
0755
MimeViewer.pyc
4.833 KB
April 10 2024 04:58:47
root / root
0644
MimeViewer.pyo
4.833 KB
April 10 2024 04:58:47
root / root
0644
ShellWindow.py
4.074 KB
April 19 2020 21:13:39
root / root
0644
ShellWindow.pyc
5.47 KB
April 10 2024 04:58:47
root / root
0644
ShellWindow.pyo
5.47 KB
April 10 2024 04:58:47
root / root
0644
brownian.py
1.065 KB
April 19 2020 21:13:39
root / root
0644
brownian.pyc
1.587 KB
April 10 2024 04:58:47
root / root
0644
brownian.pyo
1.587 KB
April 10 2024 04:58:47
root / root
0644
brownian2.py
1.347 KB
April 19 2020 21:13:39
root / root
0644
brownian2.pyc
1.743 KB
April 10 2024 04:58:47
root / root
0644
brownian2.pyo
1.743 KB
April 10 2024 04:58:47
root / root
0644
canvasevents.py
6.45 KB
April 10 2024 04:57:37
root / root
0755
canvasevents.pyc
10.465 KB
April 10 2024 04:58:47
root / root
0644
canvasevents.pyo
10.465 KB
April 10 2024 04:58:47
root / root
0644
dialog.py
3.126 KB
April 10 2024 04:57:37
root / root
0755
dialog.pyc
3.108 KB
April 10 2024 04:58:47
root / root
0644
dialog.pyo
3.108 KB
April 10 2024 04:58:47
root / root
0644
electrons.py
2.268 KB
April 10 2024 04:57:37
root / root
0755
electrons.pyc
2.33 KB
April 10 2024 04:58:47
root / root
0644
electrons.pyo
2.33 KB
April 10 2024 04:58:47
root / root
0644
hanoi.py
4.54 KB
April 19 2020 21:13:39
root / root
0644
hanoi.pyc
3.821 KB
April 10 2024 04:58:47
root / root
0644
hanoi.pyo
3.821 KB
April 10 2024 04:58:47
root / root
0644
hello.py
0.323 KB
April 19 2020 21:13:39
root / root
0644
hello.pyc
0.685 KB
April 10 2024 04:58:47
root / root
0644
hello.pyo
0.685 KB
April 10 2024 04:58:47
root / root
0644
imagedraw.py
0.497 KB
April 19 2020 21:13:39
root / root
0644
imagedraw.pyc
1.128 KB
April 10 2024 04:58:47
root / root
0644
imagedraw.pyo
1.128 KB
April 10 2024 04:58:47
root / root
0644
imageview.py
0.2 KB
April 19 2020 21:13:39
root / root
0644
imageview.pyc
0.557 KB
April 10 2024 04:58:47
root / root
0644
imageview.pyo
0.557 KB
April 10 2024 04:58:47
root / root
0644
kill.py
3.793 KB
April 10 2024 04:57:37
root / root
0755
kill.pyc
4.813 KB
April 10 2024 04:58:47
root / root
0644
kill.pyo
4.813 KB
April 10 2024 04:58:47
root / root
0644
listtree.py
0.968 KB
April 19 2020 21:13:39
root / root
0644
listtree.pyc
1.497 KB
April 10 2024 04:58:47
root / root
0644
listtree.pyo
1.497 KB
April 10 2024 04:58:47
root / root
0644
mbox.py
7.302 KB
April 10 2024 04:57:37
root / root
0755
mbox.pyc
8.173 KB
April 10 2024 04:58:47
root / root
0644
mbox.pyo
8.173 KB
April 10 2024 04:58:47
root / root
0644
newmenubardemo.py
1.203 KB
April 10 2024 04:57:37
root / root
0755
newmenubardemo.pyc
1.586 KB
April 10 2024 04:58:47
root / root
0644
newmenubardemo.pyo
1.586 KB
April 10 2024 04:58:47
root / root
0644
optionmenu.py
0.431 KB
April 19 2020 21:13:39
root / root
0644
optionmenu.pyc
0.58 KB
April 10 2024 04:58:47
root / root
0644
optionmenu.pyo
0.58 KB
April 10 2024 04:58:47
root / root
0644
paint.py
1.854 KB
April 19 2020 21:13:39
root / root
0644
paint.pyc
2.19 KB
April 10 2024 04:58:47
root / root
0644
paint.pyo
2.19 KB
April 10 2024 04:58:47
root / root
0644
rmt.py
4.386 KB
April 10 2024 04:57:37
root / root
0755
rmt.pyc
4.927 KB
April 10 2024 04:58:47
root / root
0644
rmt.pyo
4.927 KB
April 10 2024 04:58:47
root / root
0644
solitaire.py
17.372 KB
April 10 2024 04:57:37
root / root
0755
solitaire.pyc
20.407 KB
April 10 2024 04:58:47
root / root
0644
solitaire.pyo
20.407 KB
April 10 2024 04:58:47
root / root
0644
sortvisu.py
18.893 KB
April 10 2024 04:57:37
root / root
0755
sortvisu.pyc
23.183 KB
April 10 2024 04:58:47
root / root
0644
sortvisu.pyo
23.183 KB
April 10 2024 04:58:47
root / root
0644
ss1.py
25.569 KB
April 19 2020 21:13:39
root / root
0644
ss1.pyc
31.667 KB
April 10 2024 04:58:47
root / root
0644
ss1.pyo
31.072 KB
April 10 2024 04:58:44
root / root
0644
svkill.py
4.75 KB
April 10 2024 04:57:37
root / root
0755
svkill.pyc
5.802 KB
April 10 2024 04:58:47
root / root
0644
svkill.pyo
5.802 KB
April 10 2024 04:58:47
root / root
0644
switch.py
1.522 KB
April 19 2020 21:13:39
root / root
0644
switch.pyc
2.853 KB
April 10 2024 04:58:47
root / root
0644
switch.pyo
2.853 KB
April 10 2024 04:58:47
root / root
0644
tkman.py
8.793 KB
April 10 2024 04:57:37
root / root
0755
tkman.pyc
8.876 KB
April 10 2024 04:58:47
root / root
0644
tkman.pyo
8.876 KB
April 10 2024 04:58:47
root / root
0644
wish.py
0.608 KB
April 19 2020 21:13:39
root / root
0644
wish.pyc
0.72 KB
April 10 2024 04:58:47
root / root
0644
wish.pyo
0.72 KB
April 10 2024 04:58:47
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF