def test(): port = 1112 sockfd = 20 command = ["/bin/uname", "-i", "-o"] sc = shellcode.reusefd(sockfd) sc += shellcode.helloworld() testing.run_tcp_client_expect_recv_data(sc, "127.0.0.1", port, sockfd, "Hello World!\n") expect = subprocess.check_output(command) sc = shellcode.reusefd(sockfd) sc += shellcode.execve_sh() testing.run_tcp_client_expect_recv_data_using_send_data(sc, "127.0.0.1", port, sockfd, expect, "uname -i -o\nexit\n") sc = shellcode.reusefd(sockfd) sc += shellcode.execve(["/bin/sh"]) testing.run_tcp_client_expect_recv_data_using_send_data(sc, "127.0.0.1", port, sockfd, expect, "uname -i -o\nexit\n")
def test(): command = ["/bin/uname", "-s", "-n", "-r", "-v", "-m", "-p", "-i", "-o"] sc = shellcode.execve(command) expect = subprocess.check_output(command) testing.verify_no_nulls(sc) testing.run_expecting_output(sc, expect)