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