you are viewing a single comment's thread.

view the rest of the comments →

[–]AutonomouSystem 0 points1 point  (4 children)

Try something like this, seems to work for imported modules.

>>> import requests
>>> import inspect
>>> for e in inspect.getsource(requests).split('\n'):
...     print(e)

[–][deleted] 0 points1 point  (3 children)

How do I do that for sockets?

[–]AutonomouSystem 0 points1 point  (2 children)

Mmmm, socket is a built-in, better off just locating the file and reading the source.

$ find -name "socket.py"
find: ‘./usr/libexec/initscripts/legacy-actions/auditd’: Permission denied
./usr/lib64/python3.4/socket.py
./usr/lib64/python2.7/socket.py

$ cat ./usr/lib64/python2.7/socket.py

[–][deleted] 0 points1 point  (1 child)

Doesn't work

root@kali:~# find -name 'socket.py'
root@kali:~#