rapid7 / metasploit-framework

Metasploit Framework
https://www.metasploit.com/
Other
34k stars 13.94k forks source link

Python Extension Modules #6349

Open mubix opened 8 years ago

mubix commented 8 years ago

Since you can't submit a pull request to the wiki I'll post it here

https://github.com/rapid7/metasploit-framework/wiki/Python-Extension

It would be nice to have on the Python Extension wiki page a list of the available modules out of the box. As well as a possible way of compiling new ones.

UserDict
__builtin__
__main__
_abcoll
_bisect
_codecs
_collections
_csv
_ctypes
_functools
_heapq
_io
_locale
_lsprof
_md5
_multibytecodec
_random
_sha
_sha256
_sha512
_socket
_sre
_ssl
_struct
_subprocess
_symtable
_warnings
_weakref
_weakrefset
_winreg
abc
array
audioop
binascii
cPickle
cStringIO
cmath
copy
copy_reg
datetime
errno
exceptions
future_builtins
gc
genericpath
imageop
imp
itertools
linecache
marshal
math
met_imported_code
meterpreter_bindings
meterpreter_stderr
mmap
msvcrt
nt
ntpath
operator
os
os.path
parser
select
signal
stat
strop
sys
thread
time
types
unicodedata
warnings
weakref
xml
xml.dom
xml.dom.NodeFilter
xml.dom.domreg
xml.dom.minicompat
xml.dom.minidom
xml.dom.xmlbuilder
xxsubtype
zipimport
zlib
OJ commented 8 years ago

That's actually not the full list. This is:

__future__
__phello__
_abcoll
_LWPCookieJar
_MozillaCookieJar
_osx_support
_pyio
_strptime
_threading_local
_weakrefset
abc
aifc
antigravity
anydbm
argparse
ast
asynchat
asyncore
atexit
audiodev
base64
BaseHTTPServer
Bastion
bdb
binhex
bisect
calendar
cgi
CGIHTTPServer
cgitb
chunk
cmd
code
codecs
codeop
collections
colorsys
commands
compileall
compiler
compiler.ast
compiler.consts
compiler.future
compiler.misc
compiler.pyassem
compiler.pycodegen
compiler.symbols
compiler.syntax
compiler.transformer
compiler.visitor
ConfigParser
contextlib
Cookie
cookielib
copy
copy_reg
cProfile
csv
ctypes
ctypes._endian
ctypes.util
ctypes.wintypes
dbhash
decimal
difflib
dircache
dis
doctest
DocXMLRPCServer
dumbdbm
dummy_thread
dummy_threading
email
email._parseaddr
email.base64mime
email.charset
email.encoders
email.errors
email.feedparser
email.generator
email.header
email.iterators
email.message
email.parser
email.quoprimime
email.utils
email.mime
email.mime.application
email.mime.audio
email.mime.base
email.mime.image
email.mime.message
email.mime.multipart
email.mime.nonmultipart
email.mime.text
encodings
encodings.aliases
encodings.ascii
encodings.base64_codec
encodings.big5
encodings.big5hkscs
encodings.bz2_codec
encodings.charmap
encodings.cp037
encodings.cp1006
encodings.cp1026
encodings.cp1140
encodings.cp1250
encodings.cp1251
encodings.cp1252
encodings.cp1253
encodings.cp1254
encodings.cp1255
encodings.cp1256
encodings.cp1257
encodings.cp1258
encodings.cp424
encodings.cp437
encodings.cp500
encodings.cp720
encodings.cp737
encodings.cp775
encodings.cp850
encodings.cp852
encodings.cp855
encodings.cp856
encodings.cp857
encodings.cp858
encodings.cp860
encodings.cp861
encodings.cp862
encodings.cp863
encodings.cp864
encodings.cp865
encodings.cp866
encodings.cp869
encodings.cp874
encodings.cp875
encodings.cp932
encodings.cp949
encodings.cp950
encodings.euc_jis_2004
encodings.euc_jisx0213
encodings.euc_jp
encodings.euc_kr
encodings.gb18030
encodings.gb2312
encodings.gbk
encodings.hex_codec
encodings.hp_roman8
encodings.hz
encodings.idna
encodings.iso2022_jp
encodings.iso2022_jp_1
encodings.iso2022_jp_2
encodings.iso2022_jp_2004
encodings.iso2022_jp_3
encodings.iso2022_jp_ext
encodings.iso2022_kr
encodings.iso8859_1
encodings.iso8859_10
encodings.iso8859_11
encodings.iso8859_13
encodings.iso8859_14
encodings.iso8859_15
encodings.iso8859_16
encodings.iso8859_2
encodings.iso8859_3
encodings.iso8859_4
encodings.iso8859_5
encodings.iso8859_6
encodings.iso8859_7
encodings.iso8859_8
encodings.iso8859_9
encodings.johab
encodings.koi8_r
encodings.koi8_u
encodings.latin_1
encodings.mac_arabic
encodings.mac_centeuro
encodings.mac_croatian
encodings.mac_cyrillic
encodings.mac_farsi
encodings.mac_greek
encodings.mac_iceland
encodings.mac_latin2
encodings.mac_roman
encodings.mac_romanian
encodings.mac_turkish
encodings.mbcs
encodings.palmos
encodings.ptcp154
encodings.punycode
encodings.quopri_codec
encodings.raw_unicode_escape
encodings.rot_13
encodings.shift_jis
encodings.shift_jis_2004
encodings.shift_jisx0213
encodings.string_escape
encodings.tis_620
encodings.undefined
encodings.unicode_escape
encodings.unicode_internal
encodings.utf_16
encodings.utf_16_be
encodings.utf_16_le
encodings.utf_32
encodings.utf_32_be
encodings.utf_32_le
encodings.utf_7
encodings.utf_8
encodings.utf_8_sig
encodings.uu_codec
encodings.zlib_codec
filecmp
fileinput
fnmatch
formatter
fpformat
fractions
ftplib
functools
genericpath
getopt
getpass
gettext
glob
gzip
hashlib
heapq
hmac
htmlentitydefs
htmllib
HTMLParser
httplib
ihooks
imaplib
imghdr
importlib
imputil
inspect
io
json
json.decoder
json.encoder
json.scanner
json.tool
keyword
linecache
locale
logging
logging.config
logging.handlers
macpath
macurl2path
mailbox
mailcap
markupbase
md5
meterpreter
meterpreter.core
meterpreter.elevate
meterpreter.fs
meterpreter.incognito
meterpreter.kiwi
meterpreter.sys
meterpreter.tlv
meterpreter.transport
meterpreter.user
meterpreter.extapi
meterpreter.extapi.adsi
mhlib
mimetools
mimetypes
MimeWriter
mimify
modulefinder
multifile
multiprocessing
multiprocessing.connection
multiprocessing.forking
multiprocessing.heap
multiprocessing.managers
multiprocessing.pool
multiprocessing.process
multiprocessing.queues
multiprocessing.reduction
multiprocessing.sharedctypes
multiprocessing.synchronize
multiprocessing.util
multiprocessing.dummy
multiprocessing.dummy.connection
mutex
netrc
new
nntplib
ntpath
nturl2path
numbers
opcode
optparse
os
os2emxpath
pdb
pickle
pickletools
pipes
pkgutil
platform
plistlib
popen2
poplib
posixfile
posixpath
pprint
profile
pstats
pty
py_compile
pyclbr
pydoc
Queue
quopri
random
re
repr
rexec
rfc822
rlcompleter
robotparser
runpy
sched
sets
sgmllib
sha
shelve
shlex
shutil
SimpleHTTPServer
SimpleXMLRPCServer
site
smtpd
smtplib
sndhdr
socket
SocketServer
sqlite3
sqlite3.dbapi2
sqlite3.dump
sre
sre_compile
sre_constants
sre_parse
ssl
stat
statvfs
string
StringIO
stringold
stringprep
struct
subprocess
sunau
sunaudio
symbol
symtable
sysconfig
tabnanny
tarfile
telnetlib
tempfile
textwrap
this
threading
timeit
toaiff
token
tokenize
trace
traceback
tty
types
urllib
urllib2
urlparse
user
UserDict
UserList
UserString
uu
uuid
warnings
wave
weakref
webbrowser
whichdb
wsgiref
wsgiref.handlers
wsgiref.headers
wsgiref.simple_server
wsgiref.util
wsgiref.validate
xdrlib
xml
xml.dom
xml.dom.domreg
xml.dom.expatbuilder
xml.dom.minicompat
xml.dom.minidom
xml.dom.NodeFilter
xml.dom.pulldom
xml.dom.xmlbuilder
xml.etree
xml.etree.cElementTree
xml.etree.ElementInclude
xml.etree.ElementPath
xml.etree.ElementTree
xml.parsers
xml.parsers.expat
xml.sax
xml.sax._exceptions
xml.sax.expatreader
xml.sax.handler
xml.sax.saxutils
xml.sax.xmlreader
xmllib
xmlrpclib
zipfile
Total modules: 429
OJ commented 8 years ago

Sorry to be clear, that's the list of python-based libs that are imported on top of the ones that are native (part of the C python code).

psychomario commented 8 years ago

It looks like this list isn't accurate, multiprocessing doesn't seem to be present:


meterpreter > python_execute 'import multiprocessing'
[-] Content written to stderr:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named multiprocessing

meterpreter > python_execute 'import multiprocessing.forking'
[-] Content written to stderr:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named multiprocessing.forking
wchen-r7 commented 8 years ago

^ to follow up on that, here's a list of all the modules that couldn't load for me:

ImportError: No module named _LWPCookieJar
ImportError: No module named _MozillaCookieJar
ImportError: No module named anydbm
ImportError: No module named ast
ImportError: No module named dbhash
ImportError: No module named doctest
ImportError: No module named dumbdbm
ImportError: No module named big5
ImportError: No module named big5hkscs
ImportError: No module named bz2_codec
ImportError: No module named cp932
ImportError: No module named cp949
ImportError: No module named cp950
ImportError: No module named euc_jis_2004
ImportError: No module named euc_jisx0213
ImportError: No module named euc_jp
ImportError: No module named euc_kr
ImportError: No module named gb18030
ImportError: No module named gb2312
ImportError: No module named gbk
ImportError: No module named hz
ImportError: No module named iso2022_jp
ImportError: No module named iso2022_jp_1
ImportError: No module named iso2022_jp_2
ImportError: No module named iso2022_jp_2004
ImportError: No module named iso2022_jp_3
ImportError: No module named iso2022_jp_ext
ImportError: No module named iso2022_kr
ImportError: No module named johab
ImportError: No module named shift_jis
ImportError: No module named shift_jis_2004
ImportError: No module named shift_jisx0213
ImportError: No module named mimify
ImportError: No module named pty
ImportError: No module named smtpd
ImportError: No module named sqlite3
ImportError: No module named sqlite3.dbapi2
ImportError: No module named sqlite3.dump
ImportError: No module named tty
ImportError: No module named cElementTree
ImportError: No module named expat
ImportError: No module named expatreader
wchen-r7 commented 8 years ago

I'll go ahead and document the modules from OJ's list, but without the ones I couldn't load.

OJ commented 8 years ago

So multiprocessing now imports correctly as of https://github.com/rapid7/metasploit-payloads/pull/57 but clearly there are more that need work. Thanks for compiling this list @wchen-r7. My guess is that some of them won't load because of dependencies on others, so fixing one will result in others getting fixed too. Some might require external work. We'll see.

I'll add it to the todo list :)

wchen-r7 commented 8 years ago

@OJ Thanks. Should I leave this issue open after I update the Python Extension doc, or should I close this?

OJ commented 8 years ago

I think leave it open and assign to me :)

wchen-r7 commented 8 years ago

ok cool.

github-actions[bot] commented 3 years ago

Hi!

This issue has been left open with no activity for a while now.

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.