Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion examples/rootfs
Submodule rootfs updated 316 files
1 change: 0 additions & 1 deletion examples/src/linux/picohttpd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $^
Expand Down
Binary file added examples/src/linux/picohttpd/picohttpd
Binary file not shown.
2 changes: 2 additions & 0 deletions examples/src/linux/picohttpd/readme.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
copy from: https://gist.github.com/laobubu/d6d0e9beb934b60b2e552c2d03e1409e

compile armeb with https://crosstool-ng.github.io/docs/internals/ , with linux kernel
2 changes: 1 addition & 1 deletion tests/test_debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/test_elf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 13 additions & 10 deletions tests/test_elf_multithread.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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__":
Expand Down