exposing Java private fields with reflection
This commit is contained in:
12
classes/private/no_respect.py
Normal file
12
classes/private/no_respect.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# In the Jython registry:
|
||||
# python.security.respectJavaAccessibility = false
|
||||
# Setting this to false will allow Jython to provide access to
|
||||
# non-public fields, methods, and constructors of Java objects.
|
||||
|
||||
import Confidential
|
||||
|
||||
message = Confidential("text you shoudn't see")
|
||||
for name in dir(message):
|
||||
attr = getattr(message, name)
|
||||
if not callable(attr): # ignore methods
|
||||
print name, '=', attr
|
||||
Reference in New Issue
Block a user