summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/lib/monkey/examples
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 11:19:16 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 12:07:37 +0000
commitb485aab7e71c1625cfc27e0f92c9509f42378458 (patch)
treeae9abe108601079d1679194de237c9a435ae5b55 /src/fluent-bit/lib/monkey/examples
parentAdding upstream version 1.44.3. (diff)
downloadnetdata-b485aab7e71c1625cfc27e0f92c9509f42378458.tar.xz
netdata-b485aab7e71c1625cfc27e0f92c9509f42378458.zip
Adding upstream version 1.45.3+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/fluent-bit/lib/monkey/examples')
-rw-r--r--src/fluent-bit/lib/monkey/examples/README1
-rw-r--r--src/fluent-bit/lib/monkey/examples/hello.c68
-rw-r--r--src/fluent-bit/lib/monkey/examples/hello.py12
-rw-r--r--src/fluent-bit/lib/monkey/examples/image.h256
-rw-r--r--src/fluent-bit/lib/monkey/examples/list.c91
-rw-r--r--src/fluent-bit/lib/monkey/examples/list.py24
-rw-r--r--src/fluent-bit/lib/monkey/examples/quiz.c124
-rw-r--r--src/fluent-bit/lib/monkey/examples/quiz.py298
8 files changed, 874 insertions, 0 deletions
diff --git a/src/fluent-bit/lib/monkey/examples/README b/src/fluent-bit/lib/monkey/examples/README
new file mode 100644
index 000000000..bbb5b22c4
--- /dev/null
+++ b/src/fluent-bit/lib/monkey/examples/README
@@ -0,0 +1 @@
+These sample files show the usage of the Monkey library. They're under the GPLv2.
diff --git a/src/fluent-bit/lib/monkey/examples/hello.c b/src/fluent-bit/lib/monkey/examples/hello.c
new file mode 100644
index 000000000..d54c3dde7
--- /dev/null
+++ b/src/fluent-bit/lib/monkey/examples/hello.c
@@ -0,0 +1,68 @@
+/* Monkey HTTP Daemon
+ * ------------------
+ * Copyright (C) 2012, Lauri Kasanen <cand@gmx.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <libmonkey.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+/*
+ * This example shows how to start the server, and point it to /tmp.
+ * It also creates /tmp/index.html.
+*/
+
+static void write_index() {
+
+ const char *path = "/tmp/index.html";
+
+ FILE *f = fopen(path, "w");
+ if (!f) exit(1);
+
+ fprintf(f, "<html><body><h2>Hello Monkey</h2></body></html>");
+
+ fclose(f);
+}
+
+int main() {
+
+ int ret;
+
+ write_index();
+
+ // All defaults. Bind to all interfaces, port 2001, default plugins, /tmp.
+ // No callbacks are used.
+ mklib_ctx ctx = mklib_init(NULL, 0, 0, "/tmp");
+ if (!ctx) return 1;
+
+ // The default has no index files, let's set index.html as one.
+ ret = mklib_config(ctx, MKC_INDEXFILE, "index.html", NULL);
+ if (!ret) return 1;
+
+ // Start the server.
+ mklib_start(ctx);
+
+ // I'm now free to do my own things. I'm just going to wait for a keypress.
+ printf("All set and running! Visit me, I default to localhost:2001.\n");
+ printf("Press a key to exit.\n");
+ getchar();
+
+ mklib_stop(ctx);
+
+ return 0;
+}
diff --git a/src/fluent-bit/lib/monkey/examples/hello.py b/src/fluent-bit/lib/monkey/examples/hello.py
new file mode 100644
index 000000000..bf4b5becd
--- /dev/null
+++ b/src/fluent-bit/lib/monkey/examples/hello.py
@@ -0,0 +1,12 @@
+import monkey
+
+f = open('/tmp/index.html', 'w')
+f.write("<html><body><h2>Hello Monkey</h2></body></html>")
+f.close()
+
+monkey.init(None, 0, 0, '/tmp/')
+monkey.configure(indexfile='index.html')
+
+monkey.start()
+raw_input("Press enter to stop the server...")
+monkey.stop()
diff --git a/src/fluent-bit/lib/monkey/examples/image.h b/src/fluent-bit/lib/monkey/examples/image.h
new file mode 100644
index 000000000..31b4ba992
--- /dev/null
+++ b/src/fluent-bit/lib/monkey/examples/image.h
@@ -0,0 +1,256 @@
+#ifndef MONKEY_HEAD_PNG_H
+#define MONKEY_HEAD_PNG_H
+static const unsigned char monkey_head_png[] = {
+0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
+0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x28,
+0x08, 0x06, 0x00, 0x00, 0x00, 0xb8, 0x87, 0x79, 0x71, 0x00, 0x00, 0x00,
+0x04, 0x73, 0x42, 0x49, 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64,
+0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x03,
+0x2c, 0x00, 0x00, 0x03, 0x2c, 0x01, 0x90, 0x94, 0x1c, 0x83, 0x00, 0x00,
+0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61,
+0x72, 0x65, 0x00, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x6e, 0x6b, 0x73, 0x63,
+0x61, 0x70, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x9b, 0xee, 0x3c, 0x1a, 0x00,
+0x00, 0x0b, 0x41, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xc5, 0x99, 0x7b,
+0x6c, 0x5b, 0xd7, 0x7d, 0xc7, 0x3f, 0xe7, 0xdc, 0x07, 0x49, 0x51, 0xd4,
+0x83, 0xa2, 0x1e, 0xf1, 0x53, 0xb2, 0x5d, 0x5b, 0x88, 0xd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xf5, 0xf7, 0x9f, 0x1d, 0xf9, 0xd5, 0xbd, 0x23, 0xfb, 0x97, 0x96, 0x72,
+0x51, 0x1d, 0xde, 0x0f, 0xea, 0x0f, 0x00, 0x01, 0x80, 0x30, 0x31, 0x82,
+0x75, 0xc8, 0xb2, 0x25, 0x48, 0xab, 0x5a, 0xbf, 0x13, 0xc0, 0x9b, 0xdb,
+0xf0, 0x54, 0x16, 0x77, 0x76, 0x04, 0x2f, 0x9b, 0x28, 0xfa, 0xad, 0xc2,
+0xbe, 0x9a, 0x5d, 0xa7, 0xbe, 0xf6, 0x2b, 0x7f, 0xc9, 0x97, 0x67, 0xe2,
+0xc0, 0xa6, 0x95, 0xae, 0xb4, 0xbe, 0xaf, 0x94, 0x6a, 0x05, 0xe4, 0xa2,
+0x0c, 0x80, 0xe3, 0x29, 0x8e, 0x92, 0x95, 0x5f, 0xa8, 0xdd, 0xd3, 0xde,
+0xf5, 0xeb, 0x78, 0x4b, 0xb9, 0x90, 0x17, 0x84, 0x11, 0x77, 0x5b, 0xf7,
+0x48, 0xa5, 0x1e, 0x52, 0xd0, 0x0c, 0x84, 0x00, 0x7b, 0x2e, 0x94, 0x03,
+0x8c, 0x03, 0x7d, 0x0a, 0x5e, 0xac, 0xdd, 0xd5, 0xb1, 0x4f, 0xd7, 0xd9,
+0x87, 0xe4, 0x7f, 0x01, 0x9c, 0x0b, 0xc5, 0xc1, 0xee, 0xb9, 0xae, 0x42,
+0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
+};
+#endif
diff --git a/src/fluent-bit/lib/monkey/examples/list.c b/src/fluent-bit/lib/monkey/examples/list.c
new file mode 100644
index 000000000..7156fd2c2
--- /dev/null
+++ b/src/fluent-bit/lib/monkey/examples/list.c
@@ -0,0 +1,91 @@
+/* Monkey HTTP Daemon
+ * ------------------
+ * Copyright (C) 2012, Lauri Kasanen <cand@gmx.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <libmonkey.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+/*
+ * This example shows a directory listing of /tmp, with no access to files. Fun eh?
+*/
+
+enum {
+ bufsize = 4096
+};
+static char buf[bufsize];
+
+static int list(const mklib_session *sr, const char *vhost, const char *url,
+ const char *get, unsigned long getlen,
+ const char *post, unsigned long postlen,
+ unsigned int *status, const char **content, unsigned long *content_len,
+ char *header) {
+
+ sprintf(buf, "<html><body><h2>Hello friend. You asked for %s.</h2>\n", url);
+ strcat(buf, "<pre>");
+
+ FILE *f = popen("ls -lh /tmp", "r");
+ if (!f) exit(1);
+
+
+ char mybuf[bufsize - 200];
+
+ while (fgets(mybuf, bufsize - 200, f)) {
+ // Note: this is dangerous. Only used for demonstration purposes.
+ strcat(buf, mybuf);
+ }
+ pclose(f);
+
+ strcat(buf, "</pre></body></html>");
+
+ *content = buf;
+ *content_len = strlen(buf);
+ sprintf(header, "Content-type: text/html");
+
+ // TRUE here means we handled this request.
+ return MKLIB_TRUE;
+}
+
+/* The callback setting interface can't check the callback for compatibility.
+ * This makes sure the callback function has the right arguments. */
+static cb_data listf = list;
+
+int main() {
+
+ // Bind to all interfaces, port 2001, default plugins, no directory.
+ // Lacking the directory means that no files can be accessed, just what we want.
+ // We use the data callback.
+ mklib_ctx ctx = mklib_init(NULL, 0, 0, NULL);
+ if (!ctx) return 1;
+
+ mklib_callback_set(ctx, MKCB_DATA, listf);
+
+ // Start the server.
+ mklib_start(ctx);
+
+ // I'm now free to do my own things. I'm just going to wait for a keypress.
+ printf("All set and running! Visit me, I default to localhost:2001.\n");
+ printf("Press a key to exit.\n");
+ getchar();
+
+ mklib_stop(ctx);
+
+ return 0;
+}
diff --git a/src/fluent-bit/lib/monkey/examples/list.py b/src/fluent-bit/lib/monkey/examples/list.py
new file mode 100644
index 000000000..d401d4280
--- /dev/null
+++ b/src/fluent-bit/lib/monkey/examples/list.py
@@ -0,0 +1,24 @@
+import monkey
+import subprocess
+
+content = ''
+
+def list_cb(vhost, url, get, get_len, post, post_len, header):
+ global content
+ content = "<html><body><h2>Hello friend. You asked for %s.</h2>\n"
+ content += "<pre>"
+ content += subprocess.check_output(['ls', '-lh', '/tmp'])
+ content += "</pre></body></html>"
+
+ ret = {}
+ ret['return'] = 1
+ ret['content'] = content
+ ret['content_len'] = len(ret['content'])
+
+ return ret
+
+monkey.init(None, 0, 0, None)
+monkey.set_callback('data', list_cb)
+monkey.start()
+raw_input("Press enter to stop the server...")
+monkey.stop()
diff --git a/src/fluent-bit/lib/monkey/examples/quiz.c b/src/fluent-bit/lib/monkey/examples/quiz.c
new file mode 100644
index 000000000..9914cb794
--- /dev/null
+++ b/src/fluent-bit/lib/monkey/examples/quiz.c
@@ -0,0 +1,124 @@
+/* Monkey HTTP Daemon
+ * ------------------
+ * Copyright (C) 2012, Lauri Kasanen <cand@gmx.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <libmonkey.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "image.h"
+
+/*
+ * This example shows a simple quiz. It includes POST data handling, and
+ * an image embedded in the code.
+*/
+
+enum {
+ bufsize = 4096
+};
+static char buf[bufsize];
+
+static void front() {
+
+ sprintf(buf, "<html><body><center><h2>Hello friend."
+ " Have you seen this guy?</h2>\n"
+ "<br><br><img src=\"/image.png\">"
+ "<br><br><form action=/ method=post>"
+ "<input type=radio name=q1 value=yes>Why yes I have<br>"
+ "<input type=radio name=q1 value=no>No, who's he?<br>"
+ "<input type=radio name=q1 value=who>Canada<hr width='20%%'>"
+ "<input type=submit>"
+ "</form>"
+ "</center></body></html>");
+
+}
+
+static void points() {
+
+ sprintf(buf, "<html><body><center><h2>Correct!</h2>\n"
+ "<br><br><a href='http://monkey-project.com'>Visit him.</a>"
+ "</center></body></html>");
+
+}
+
+static void wrong() {
+
+ sprintf(buf, "<html><body><center><h2>I'm a sad puppy.</h2>\n"
+ "</center></body></html>");
+}
+
+static int list(const mklib_session *sr, const char *vhost, const char *url,
+ const char *get, unsigned long getlen,
+ const char *post, unsigned long postlen,
+ unsigned int *status, const char **content, unsigned long *content_len,
+ char *header) {
+
+ if (strcmp(url, "/image.png") == 0) {
+ *content = (char *) monkey_head_png;
+ *content_len = sizeof(monkey_head_png);
+ sprintf(header, "Content-type: image/png");
+
+ return MKLIB_TRUE;
+ }
+
+ if (!post) {
+ front();
+ } else {
+ if (strstr(post, "q1=who") || strstr(post, "q1=yes"))
+ points();
+ else
+ wrong();
+ }
+
+ *content = buf;
+ *content_len = strlen(buf);
+ sprintf(header, "Content-type: text/html");
+
+
+ // TRUE here means we handled this request.
+ return MKLIB_TRUE;
+}
+
+/* The callback setting interface can't check the callback for compatibility.
+ * This makes sure the callback function has the right arguments. */
+static cb_data listf = list;
+
+int main() {
+
+ // Bind to all interfaces, port 2001, default plugins, no directory.
+ // Lacking the directory means that no files can be accessed, just what we want.
+ // We use the data callback.
+ mklib_ctx ctx = mklib_init(NULL, 0, 0, NULL);
+ if (!ctx) return 1;
+
+ mklib_callback_set(ctx, MKCB_DATA, listf);
+
+ // Start the server.
+ mklib_start(ctx);
+
+ // I'm now free to do my own things. I'm just going to wait for a keypress.
+ printf("All set and running! Visit me, I default to localhost:2001.\n");
+ printf("Press a key to exit.\n");
+ getchar();
+
+ mklib_stop(ctx);
+
+ return 0;
+}
diff --git a/src/fluent-bit/lib/monkey/examples/quiz.py b/src/fluent-bit/lib/monkey/examples/quiz.py
new file mode 100644
index 000000000..96dfa31bd
--- /dev/null
+++ b/src/fluent-bit/lib/monkey/examples/quiz.py
@@ -0,0 +1,298 @@
+import monkey
+
+content = ''
+
+image = ''.join(chr(x) for x in
+[
+0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
+0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x28,
+0x08, 0x06, 0x00, 0x00, 0x00, 0xb8, 0x87, 0x79, 0x71, 0x00, 0x00, 0x00,
+0x04, 0x73, 0x42, 0x49, 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64,
+0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x03,
+0x2c, 0x00, 0x00, 0x03, 0x2c, 0x01, 0x90, 0x94, 0x1c, 0x83, 0x00, 0x00,
+0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61,
+0x72, 0x65, 0x00, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x6e, 0x6b, 0x73, 0x63,
+0x61, 0x70, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x9b, 0xee, 0x3c, 0x1a, 0x00,
+0x00, 0x0b, 0x41, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xc5, 0x99, 0x7b,
+0x6c, 0x5b, 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0xf2, 0x86, 0x46, 0x1a, 0x36, 0xde, 0x4a,
+0x5d, 0x43, 0x1a, 0x4f, 0xd7, 0xfb, 0x3c, 0x5d, 0x6e, 0x2e, 0xf3, 0x5b,
+0xf5, 0xf7, 0x9f, 0x1d, 0xf9, 0xd5, 0xbd, 0x23, 0xfb, 0x97, 0x96, 0x72,
+0x51, 0x1d, 0xde, 0x0f, 0xea, 0x0f, 0x00, 0x01, 0x80, 0x30, 0x31, 0x82,
+0x75, 0xc8, 0xb2, 0x25, 0x48, 0xab, 0x5a, 0xbf, 0x13, 0xc0, 0x9b, 0xdb,
+0xf0, 0x54, 0x16, 0x77, 0x76, 0x04, 0x2f, 0x9b, 0x28, 0xfa, 0xad, 0xc2,
+0xbe, 0x9a, 0x5d, 0xa7, 0xbe, 0xf6, 0x2b, 0x7f, 0xc9, 0x97, 0x67, 0xe2,
+0xc0, 0xa6, 0x95, 0xae, 0xb4, 0xbe, 0xaf, 0x94, 0x6a, 0x05, 0xe4, 0xa2,
+0x0c, 0x80, 0xe3, 0x29, 0x8e, 0x92, 0x95, 0x5f, 0xa8, 0xdd, 0xd3, 0xde,
+0xf5, 0xeb, 0x78, 0x4b, 0xb9, 0x90, 0x17, 0x84, 0x11, 0x77, 0x5b, 0xf7,
+0x48, 0xa5, 0x1e, 0x52, 0xd0, 0x0c, 0x84, 0x00, 0x7b, 0x2e, 0x94, 0x03,
+0x8c, 0x03, 0x7d, 0x0a, 0x5e, 0xac, 0xdd, 0xd5, 0xb1, 0x4f, 0xd7, 0xd9,
+0x87, 0xe4, 0x7f, 0x01, 0x9c, 0x0b, 0xc5, 0xc1, 0xee, 0xb9, 0xae, 0x42,
+0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
+])
+
+def front():
+ global content
+ content = "<html><body><center><h2>Hello friend. Have you seen this guy?</h2>\n<br><br><img src=\"/image.png\"><br><br><form action=/ method=post><input type=radio name=q1 value=yes>Why yes I have<br><input type=radio name=q1 value=no>No, who's he?<br><input type=radio name=q1 value=who>Canada<hr width='20%%'><input type=submit></form></center></body></html>"
+
+def points():
+ global content
+ content = "<html><body><center><h2>Correct!</h2>\n<br><br><a href='http://monkey-project.com'>Visit him.</a></center></body></html>"
+
+def wrong():
+ global content
+ content = "<html><body><center><h2>I'm a sad puppy.</h2>\n</center></body></html>"
+
+def listf(vhost, url, get, get_len, post, post_len, header):
+ global content
+ global image
+ ret = {}
+ if url == '/image.png':
+ ret['content'] = image
+ ret['content_len'] = len(ret['content'])
+ ret['return'] = 1
+ return ret
+ if post is None:
+ front()
+ elif 'q1=who' in post or 'q1=yes' in post:
+ points()
+ else:
+ wrong()
+
+ ret['content'] = content
+ ret['content_len'] = len(ret['content'])
+ ret['return'] = 1
+
+ return ret
+
+monkey.init(None, 0, 0, None)
+monkey.set_callback('data', listf)
+monkey.start()
+raw_input("Press enter to stop the server...")
+monkey.stop()