반응형
간단한 자동명령 수행
참조: pwntools install 및 Getting Started(ftp 접속)
1.소스
''' write by SpeeDr00t ''' from pwn import * class cshell : ''' get shell ''' def __init__(self) : self.handle = '' def get_shell(self) : self.handle = process('/bin/sh') self.handle.sendline('pwd') print self.handle.recvline() + "\n" return self.handle def send_cmd(self,cmd,until_str='$' ) : self.handle.sendline(cmd) r = self.handle.recvuntil(until_str) print r + "\n" def close(self) : self.handle.close() def __del__(self) : self.handle.close() if __name__ == "__main__": c = cshell() c.get_shell() c.send_cmd('adb shell') c.send_cmd('su','#') c.send_cmd('ls -l /tmp','#')
결과
반응형