diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 6ab9b2bf3..baf7ff053 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -13,7 +13,7 @@ jobs: os: [windows-latest, ubuntu-20.04] python-version: [3.8, 3.9] include: - - os: ubuntu-18.04 + - os: ubuntu-20.04 python-version: 3.9 container: Docker diff --git a/examples/rootfs b/examples/rootfs index 54756aecf..422b460e9 160000 --- a/examples/rootfs +++ b/examples/rootfs @@ -1 +1 @@ -Subproject commit 54756aecffddc8b22843ddcb8a92afd1b0e545a3 +Subproject commit 422b460e95f118bc6769834314040ef5a98b311e diff --git a/examples/src/linux/picohttpd/Makefile b/examples/src/linux/picohttpd/Makefile index 8cd91a626..e6b0864d2 100644 --- a/examples/src/linux/picohttpd/Makefile +++ b/examples/src/linux/picohttpd/Makefile @@ -4,7 +4,6 @@ clean: @rm -rf *.o @rm -rf x64_server @rm -rf arm_server - @rm -rf armeb_server x64_server: main.o httpd.o gcc -o x64_server $^ diff --git a/examples/src/linux/picohttpd/picohttpd b/examples/src/linux/picohttpd/picohttpd new file mode 100755 index 000000000..90963e835 Binary files /dev/null and b/examples/src/linux/picohttpd/picohttpd differ diff --git a/examples/src/linux/picohttpd/readme.txt b/examples/src/linux/picohttpd/readme.txt index 32ad9edb1..3ebba350a 100644 --- a/examples/src/linux/picohttpd/readme.txt +++ b/examples/src/linux/picohttpd/readme.txt @@ -1 +1,3 @@ copy from: https://gist.github.com/laobubu/d6d0e9beb934b60b2e552c2d03e1409e + +compile armeb with https://crosstool-ng.github.io/docs/internals/ , with linux kernel diff --git a/tests/test_debugger.py b/tests/test_debugger.py index 9003fe1cb..8893f246c 100644 --- a/tests/test_debugger.py +++ b/tests/test_debugger.py @@ -122,7 +122,7 @@ def gdb_test_client(): del ql def test_gdbdebug_armeb(self): - ql = Qiling(["../examples/rootfs/armeb_linux/bin/armeb_hello"], "../examples/rootfs/armeb_linux", verbose=QL_VERBOSE.DEBUG) + ql = Qiling(["../examples/rootfs/armeb_linux_oldlibc/bin/armeb_hello"], "../examples/rootfs/armeb_linux_oldlibc", verbose=QL_VERBOSE.DEBUG) ql.debugger = True # some random command test just to make sure we covered most of the command diff --git a/tests/test_elf.py b/tests/test_elf.py index 48d071865..678e79782 100644 --- a/tests/test_elf.py +++ b/tests/test_elf.py @@ -1077,12 +1077,12 @@ def test_elf_linux_x8664_getdents(self): del ql def test_elf_linux_armeb(self): - ql = Qiling(["../examples/rootfs/armeb_linux/bin/armeb_hello"], "../examples/rootfs/armeb_linux", verbose=QL_VERBOSE.DEBUG) + ql = Qiling(["../examples/rootfs/armeb_linux_oldlibc/bin/armeb_hello"], "../examples/rootfs/armeb_linux_oldlibc", verbose=QL_VERBOSE.DEBUG) ql.run() del ql def test_elf_linux_armeb_static(self): - ql = Qiling(["../examples/rootfs/armeb_linux/bin/armeb_hello_static"], "../examples/rootfs/armeb_linux", verbose=QL_VERBOSE.DEFAULT) + ql = Qiling(["../examples/rootfs/armeb_linux_oldlibc/bin/armeb_hello_static"], "../examples/rootfs/armeb_linux_oldlibc", verbose=QL_VERBOSE.DEFAULT) ql.run() del ql diff --git a/tests/test_elf_multithread.py b/tests/test_elf_multithread.py index 6188b8111..5d16f5a7a 100644 --- a/tests/test_elf_multithread.py +++ b/tests/test_elf_multithread.py @@ -3,7 +3,7 @@ # Cross Platform and Multi Architecture Advanced Binary Emulation Framework # -import http.client, platform, sys, os, threading, time, unittest +import http.client, platform, socket, sys, os, threading, time, unittest sys.path.append("..") from qiling import Qiling @@ -176,7 +176,7 @@ def check_write(ql, write_fd, write_buf, write_count, *args, **kw): except: pass buf_out = None - ql = Qiling(["../examples/rootfs/armeb_linux/bin/armeb_multithreading"], "../examples/rootfs/armeb_linux", multithread=True, verbose=QL_VERBOSE.DEBUG) + ql = Qiling(["../examples/rootfs/armeb_linux_oldlibc/bin/armeb_multithreading"], "../examples/rootfs/armeb_linux_oldlibc", multithread=True, verbose=QL_VERBOSE.DEBUG) ql.os.set_syscall("write", check_write, QL_INTERCEPT.ENTER) ql.run() @@ -266,7 +266,7 @@ def check_write(ql, write_fd, write_buf, write_count, *args, **kw): ql.buf_out = buf except: pass - ql = Qiling(["../examples/rootfs/armeb_linux/bin/armeb_tcp_test","20003"], "../examples/rootfs/armeb_linux", multithread=True) + ql = Qiling(["../examples/rootfs/armeb_linux_oldlibc/bin/armeb_tcp_test","20003"], "../examples/rootfs/armeb_linux_oldlibc", multithread=True) ql.os.set_syscall("write", check_write, QL_INTERCEPT.ENTER) ql.run() @@ -352,7 +352,7 @@ def check_write(ql, write_fd, write_buf, write_count, *args, **kw): except: pass - ql = Qiling(["../examples/rootfs/armeb_linux/bin/armeb_udp_test","20010"], "../examples/rootfs/armeb_linux", multithread=True) + ql = Qiling(["../examples/rootfs/armeb_linux_oldlibc/bin/armeb_udp_test","20010"], "../examples/rootfs/armeb_linux_oldlibc", multithread=True) ql.os.set_syscall("write", check_write, QL_INTERCEPT.ENTER) ql.run() @@ -392,18 +392,21 @@ def picohttpd(): def test_http_elf_linux_armeb(self): def picohttpd(): - ql = Qiling(["../examples/rootfs/armeb_linux/bin/picohttpd"], "../examples/rootfs/armeb_linux", multithread=True, verbose=QL_VERBOSE.DEBUG) + ql = Qiling(["../examples/rootfs/armeb_linux/bin/picohttpd","12913"], "../examples/rootfs/armeb_linux", multithread=True, verbose=QL_VERBOSE.DEBUG) ql.run() picohttpd_thread = threading.Thread(target=picohttpd, daemon=True) picohttpd_thread.start() time.sleep(1) - - f = http.client.HTTPConnection('localhost', 12913, timeout=10) - f.request("GET", "/") - response = f.getresponse() - self.assertEqual("httpd_test_successful", response.read().decode()) + + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: + s.connect(("localhost", 12913)) + s.sendall(b"GET / HTTP/1.1\r\nHost: 127.0.0.1:12913\r\nUser-Agent: curl/7.74.0\r\nAccept: */*\r\n\r\n") + data = s.recv(1024) + + res = data.decode("UTF-8",'replace') + self.assertIn("httpd_test_successful", res) if __name__ == "__main__":