감사 이벤트 테이블
감사 이벤트 테이블 (Audit events table)
이 표는 CPython 런타임과 표준 라이브러리 전체에서 sys.audit() 또는 PySys_Audit() 호출로 발생하는 모든 이벤트를 담고 있어요. 이런 호출은 3.8 이상에서 추가됐어요 (PEP 578 참고). 이 이벤트를 처리하는 방법은 sys.addaudithook()과 PySys_AddAuditHook()을 보세요.
CPython 구현 세부사항: 이 표는 CPython 문서에서 생성된 것으로, 다른 구현에서 발생하는 이벤트를 나타내지 않을 수 있어요. 실제 발생하는 이벤트는 런타임별 문서를 확인하세요.
표의 각 행은 이벤트 이름 / 인자 / 참조로 구성돼요. 주요 이벤트들을 그룹별로 살펴볼게요.
본문
스레드·빌트인·코드 실행
_thread.start_new_thread— function, args, kwargsbuiltins.breakpoint— breakpointhookbuiltins.id— idbuiltins.input,builtins.input/result— prompt / resultcode.__new__— code, filename, name, argcount, posonlyargcount, kwonlyargcount, nlocals, stacksize, flagscompile— source, filenameexec— code_objectfunction.__new__— codeimport— module, filename, sys.path, sys.meta_path, sys.path_hooks
인터프리터·런타임 (cpython.*)
cpython.PyConfig_Set (name, value), cpython.PyInterpreterState_Clear, cpython.PyInterpreterState_New, cpython._PySys_ClearAuditHooks, cpython.remote_debugger_script (script_path), cpython.run_command (command), cpython.run_file (filename), cpython.run_interactivehook (hook), cpython.run_module (module-name), cpython.run_startup (filename), cpython.run_stdin.
ctypes
ctypes.addressof (obj), ctypes.call_function (func_pointer, arguments), ctypes.cdata (address), ctypes.cdata/buffer (pointer, size, offset), ctypes.create_string_buffer (init, size), ctypes.create_unicode_buffer (init, size), ctypes.dlopen (name), ctypes.dlsym (library, name), ctypes.dlsym/handle (handle, name), ctypes.get_errno, ctypes.get_last_error, ctypes.memoryview_at (address, size, readonly), ctypes.set_errno (errno), ctypes.set_exception (code), ctypes.set_last_error (error), ctypes.string_at (ptr, size), ctypes.wstring_at (ptr, size), ctypes.PyObj_FromPtr (obj).
파일·운영 체제 (os.*)
open (path, mode, flags), os.add_dll_directory (path), os.chdir (path), os.chflags, os.chmod (path, mode, dir_fd), os.chown, os.exec (path, args, env), os.fork, os.forkpty, os.fwalk, os.getxattr, os.kill (pid, sig), os.killpg, os.link, os.listdir, os.listdrives, os.listmounts, os.listvolumes, os.listxattr, os.lockf, os.mkdir, os.posix_spawn, os.putenv, os.remove, os.removexattr, os.rename, os.rmdir, os.scandir, os.setxattr, os.spawn, os.startfile, os.startfile/2, os.symlink, os.system (command), os.truncate, os.unsetenv, os.utime, os.walk.
파일 디스크립터·fcntl
fcntl.fcntl (fd, cmd, arg), fcntl.flock (fd, operation), fcntl.ioctl (fd, request, arg), fcntl.lockf (fd, cmd, len, start, whence), mmap.__new__ (fileno, length, access, offset), msvcrt.get_osfhandle (fd), msvcrt.locking (fd, mode, nbytes), msvcrt.open_osfhandle (handle, flags).
객체·GC·경로
object.__delattr__ (obj, name), object.__getattr__ (obj, name), object.__setattr__ (obj, name, value), gc.get_objects (generation), gc.get_referents (objs), gc.get_referrers (objs), glob.glob (pathname, recursive), glob.glob/2, pathlib.Path.glob (self, pattern), pathlib.Path.rglob (self, pattern).
네트워킹
http.client.connect (self, host, port), http.client.send (self, data), ftplib.connect, ftplib.sendcmd, imaplib.open, imaplib.send, poplib.connect, poplib.putline, smtplib.connect, smtplib.send, socket.__new__ (self, family, type, protocol), socket.bind (self, address), socket.connect, socket.getaddrinfo, socket.gethostbyaddr, socket.gethostbyname, socket.gethostname, socket.getnameinfo, socket.getservbyname, socket.getservbyport, socket.sendmsg, socket.sendto, socket.sethostname, urllib.Request.
데이터·DB·프로세스
marshal.dumps, marshal.load, marshal.loads, pickle.find_class (module, name), sqlite3.connect (database), sqlite3.connect/handle, sqlite3.enable_load_extension, sqlite3.load_extension, subprocess.Popen (executable, args, cwd, env), pty.spawn (argv), resource.prlimit, resource.setrlimit, signal.pthread_kill, time.sleep (seconds).
sys · 기타
sys._current_exceptions, sys._current_frames, sys._getframe (frame), sys._getframemodulename (depth), sys.addaudithook, sys.excepthook, sys.monitoring.register_callback, sys.remote_exec (pid), sys.set_asyncgen_hooks_finalizer, sys.set_asyncgen_hooks_firstiter, sys.setprofile, sys.settrace, sys.unraisablehook, pdb.Pdb, setopencodehook, ensurepip.bootstrap, syslog.*, tempfile.mkdtemp (fullpath), tempfile.mkstemp (fullpath), webbrowser.open (url), shutil.*, winreg.*.
내부 전용 이벤트
다음 이벤트는 CPython의 어떤 공개 API에도 대응하지 않는 내부적으로 발생하는 것들이에요.
_winapi.CreateFile,_winapi.CreateJunction,_winapi.CreateNamedPipe,_winapi.CreatePipe,_winapi.CreateProcess,_winapi.OpenProcess(process_id, desired_access),_winapi.TerminateProcess(handle, exit_code)_posixsubprocess.fork_exec(exec_list, args, env) — 3.14에서 추가된 내부 감사 이벤트