Skip to content

Instantly share code, notes, and snippets.

@luto
Created June 23, 2020 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luto/7592f5f48272714e1208d650fb2df6b1 to your computer and use it in GitHub Desktop.
Save luto/7592f5f48272714e1208d650fb2df6b1 to your computer and use it in GitHub Desktop.
Mitogen Test
import mitogen
def file_contains(s, path):
with open(path, 'rb') as f:
return s in f.read()
@mitogen.main()
def main(router):
server = router.ssh(hostname='cygnus.uberspace.de')
print(server.call(file_contains, 'luto', '/etc/passwd'))
print(server.call(file_contains, 'carlos', '/etc/passwd'))
$ pip install mitogen
$ python mitogen_test.py
True
False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment