mirror of
https://github.com/qilingframework/qiling.git
synced 2026-10-12 02:21:40 +00:00
renew code for picohttpd
This commit is contained in:
+1
-1
Submodule examples/rootfs updated: 15c8d84287...54756aecff
@@ -1,19 +1,20 @@
|
||||
all: server arm_server
|
||||
all: x64_server arm_server
|
||||
|
||||
clean:
|
||||
@rm -rf *.o
|
||||
@rm -rf server
|
||||
@rm -rf x64_server
|
||||
@rm -rf arm_server
|
||||
@rm -rf armeb_server
|
||||
|
||||
server: main.o httpd.o
|
||||
gcc -o server $^
|
||||
x64_server: main.o httpd.o
|
||||
gcc -o x64_server $^
|
||||
@rm -rf *.o
|
||||
|
||||
main.o: main.c httpd.h
|
||||
gcc -c -o main.o main.c
|
||||
x64_main.o: main.c httpd.h
|
||||
gcc -c -o x64_main.o main.c
|
||||
|
||||
httpd.o: httpd.c httpd.h
|
||||
gcc -c -o httpd.o httpd.c
|
||||
x64_httpd.o: httpd.c httpd.h
|
||||
gcc -c -o x64_httpd.o httpd.c
|
||||
|
||||
arm_server: arm_main.o arm_httpd.o
|
||||
arm-linux-gnueabi-gcc-10 -o arm_server $^
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
#include "httpd.h"
|
||||
|
||||
int main(int c, char** v, int argc, const char **argv)
|
||||
#define PORT_DEFAULT "12913"
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
serve_forever("12913");
|
||||
const char *PORT;
|
||||
|
||||
if (argc < 2) {
|
||||
PORT = PORT_DEFAULT;
|
||||
} else {
|
||||
PORT = argv[1];
|
||||
}
|
||||
|
||||
fprintf(stderr, "port is %s.\n", PORT);
|
||||
|
||||
serve_forever(PORT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -352,7 +352,7 @@ class ELFTest(unittest.TestCase):
|
||||
except:
|
||||
pass
|
||||
|
||||
ql = Qiling(["../examples/rootfs/armeb_linux/bin/armeb_udp_test","20009"], "../examples/rootfs/armeb_linux", multithread=True)
|
||||
ql = Qiling(["../examples/rootfs/armeb_linux/bin/armeb_udp_test","20010"], "../examples/rootfs/armeb_linux", multithread=True)
|
||||
ql.os.set_syscall("write", check_write, QL_INTERCEPT.ENTER)
|
||||
ql.run()
|
||||
|
||||
@@ -362,7 +362,7 @@ class ELFTest(unittest.TestCase):
|
||||
|
||||
def test_http_elf_linux_x8664(self):
|
||||
def picohttpd():
|
||||
ql = Qiling(["../examples/rootfs/x8664_linux/bin/picohttpd"], "../examples/rootfs/x8664_linux", multithread=True, verbose=QL_VERBOSE.DEBUG)
|
||||
ql = Qiling(["../examples/rootfs/x8664_linux/bin/picohttpd","12911"], "../examples/rootfs/x8664_linux", multithread=True, verbose=QL_VERBOSE.DEBUG)
|
||||
ql.run()
|
||||
|
||||
|
||||
@@ -371,12 +371,12 @@ class ELFTest(unittest.TestCase):
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
f = os.popen("curl http://127.0.0.1:12913")
|
||||
f = os.popen("curl http://127.0.0.1:12911")
|
||||
self.assertEqual("httpd_test_successful", f.read())
|
||||
|
||||
def test_http_elf_linux_arm(self):
|
||||
def picohttpd():
|
||||
ql = Qiling(["../examples/rootfs/arm_linux/bin/picohttpd"], "../examples/rootfs/arm_linux", multithread=True, verbose=QL_VERBOSE.DEBUG)
|
||||
ql = Qiling(["../examples/rootfs/arm_linux/bin/picohttpd","12912"], "../examples/rootfs/arm_linux", multithread=True, verbose=QL_VERBOSE.DEBUG)
|
||||
ql.run()
|
||||
|
||||
|
||||
@@ -385,7 +385,7 @@ class ELFTest(unittest.TestCase):
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
f = os.popen("curl http://127.0.0.1:12913")
|
||||
f = os.popen("curl http://127.0.0.1:12912")
|
||||
self.assertEqual("httpd_test_successful", f.read())
|
||||
|
||||
def test_http_elf_linux_armeb(self):
|
||||
|
||||
Reference in New Issue
Block a user