Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-------------------------------
- # poc.py
- #-------------------------------
- #!/usr/bin/env python3
- import getpass
- normal = input('Normal input: ')
- hidden = getpass.getpass('Hidden input: ')
- print('Normal is {0}'.format(normal))
- print('Hidden is {0}'.format(hidden))
- #-------------------------------
- # poc-test.py
- #-------------------------------
- #!/usr/bin/env python3
- import pexpect
- child = pexpect.spawn('python3 poc.py')
- #child.expect('Normal input: ')
- child.sendline('Hello')
- #child.expect('Hidden input: ')
- child.sendline('World')
- for line in child.readlines():
- print(line.decode('utf-8'), end='')
- #-------------------------------
- # poc.exp
- #-------------------------------
- #!/usr/bin/expect -df
- set timeout -1
- spawn ./poc.py
- ## normal
- send -- "NORMAL\r"
- ## hidden
- sleep 0.05 # getpass needs some time - 0.04 doesn't work
- send -- "HIDDEN\r"
- expect eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement