Python获取类属性及其它(vim看源码常用、__dict__)
假如現(xiàn)在類的名字為protocol
查看protocol屬性
print (protocol.__dict__)查看protocol的key
print (protocol.__dict__.keys()){'historyPosition': 1, 'lineBufferIndex': 0, 'historyLines': [b'2222'], 'keyHandlers': {b'\x10': <bound method HistoricRecvLine.handle_UP of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\r': <bound method HoneyPotInteractiveProtocol.handle_RETURN of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'[LEFT_ARROW]': <bound method RecvLine.handle_LEFT of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\x08': <bound method RecvLine.handle_BACKSPACE of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\x01': <bound method RecvLine.handle_HOME of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\x1b': <bound method HoneyPotInteractiveProtocol.handle_ESC of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'[END]': <bound method RecvLine.handle_END of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\x15': <bound method HoneyPotInteractiveProtocol.handle_CTRL_U of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\x16': <bound method HoneyPotInteractiveProtocol.handle_CTRL_V of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\x02': <bound method RecvLine.handle_LEFT of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'[UP_ARROW]': <bound method HistoricRecvLine.handle_UP of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\x05': <bound method RecvLine.handle_END of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\x7f': <bound method RecvLine.handle_BACKSPACE of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'[RIGHT_ARROW]': <bound method RecvLine.handle_RIGHT of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\x0b': <bound method HoneyPotInteractiveProtocol.handle_CTRL_K of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\t': <bound method HoneyPotInteractiveProtocol.handle_TAB of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'[INSERT]': <bound method RecvLine.handle_INSERT of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'[DOWN_ARROW]': <bound method HistoricRecvLine.handle_DOWN of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\n': <bound method HoneyPotInteractiveProtocol.handle_RETURN of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'[DELETE]': <bound method RecvLine.handle_DELETE of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'[HOME]': <bound method RecvLine.handle_HOME of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\x03': <bound method HoneyPotInteractiveProtocol.handle_CTRL_C of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\x0e': <bound method HistoricRecvLine.handle_DOWN of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\x04': <bound method HoneyPotInteractiveProtocol.handle_CTRL_D of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\x06': <bound method RecvLine.handle_RIGHT of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>, b'\x0c': <bound method HoneyPotInteractiveProtocol.handle_CTRL_L of <cowrie.shell.protocol.HoneyPotInteractiveProtocol object at 0x7fd25878db00>>}, 'hostname': 'zy03', 'environ': {'TERM': 'xterm', 'TMOUT': '1800', 'HOME': '/root', 'LOGNAME': 'root', 'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'SHELL': '/bin/bash', 'USER': 'root'}, 'realClientIP': '192.168.32.206', 'password_input': False, 'clientIP': '192.168.32.206', 'kippoIP': '192.168.32.109', 'cmdstack': [<cowrie.shell.honeypot.HoneyPotShell object at 0x7fd258714c50>], 'cwd': '/root', 'ps': (b'root@zy03:~# ', b'> '), 'terminal': <cowrie.insults.insults.LoggingServerProtocol object at 0x7fd25878d8d0>, 'pp': None, 'logintime': 1565255526.4570975, 'realClientPort': 3372, 'fs': <cowrie.shell.fs.HoneyPotFilesystem object at 0x7fd258e77470>, 'data': None, 'lineBuffer': [], '_TimeoutMixin__timeoutCall': <DelayedCall 0x7fd258714c18 [178.4536166191101s] called=0 cancelled=0 TimeoutMixin.__timedOut()>, 'user': <cowrie.shell.session.SSHSessionForCowrieUser object at 0x7fd258e77da0>, 'timeOut': 180, 'factory': None, 'mode': 'insert'}
總結(jié)
以上是生活随笔為你收集整理的Python获取类属性及其它(vim看源码常用、__dict__)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 静态和动态web的区别与联系
- 下一篇: twisted系列教程十四— pre-f