aboutsummaryrefslogtreecommitdiffstats
path: root/glougloud
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2012-11-29 11:18:38 +0100
committerLaurent Ghigonis <laurent@p1sec.com>2012-11-29 11:18:38 +0100
commit88ebb948f3e2aee4ebc1ec4e67e5326267327ed2 (patch)
tree797ebfd9b8b747f40b512b1f4dbf2f9c40947592 /glougloud
parentmove glougloud to old (diff)
downloadglouglou-88ebb948f3e2aee4ebc1ec4e67e5326267327ed2.tar.xz
glouglou-88ebb948f3e2aee4ebc1ec4e67e5326267327ed2.zip
add very basic glougloud
Diffstat (limited to 'glougloud')
-rw-r--r--glougloud/Makefile20
-rw-r--r--glougloud/README.txt39
-rw-r--r--glougloud/glougloud.c74
3 files changed, 133 insertions, 0 deletions
diff --git a/glougloud/Makefile b/glougloud/Makefile
new file mode 100644
index 0000000..f3ac56c
--- /dev/null
+++ b/glougloud/Makefile
@@ -0,0 +1,20 @@
+PROG = glougloud
+OBJS = glougloud.o
+CFLAGS+=-Wall -g
+LDFLAGS=-levent -lglouglou
+
+PREFIX=/usr/local
+BINDIR=$(PREFIX)/bin
+
+all:
+ make $(OBJS)
+ $(CC) $(OBJS) -o $(PROG) $(LDFLAGS)
+
+install: $(PROG)
+ @echo "installation of $(PROG)"
+ mkdir -p $(BINDIR)
+ install -m 0755 $(PROG) $(BINDIR)
+
+clean:
+ rm -f $(PROG) $(OBJS) *~
+
diff --git a/glougloud/README.txt b/glougloud/README.txt
new file mode 100644
index 0000000..23c0cd3
--- /dev/null
+++ b/glougloud/README.txt
@@ -0,0 +1,39 @@
+glougloud - glouglou daemon, for network traffic visualisation in real time
+
+glougloud listen on port 4430 for probes and port 4431 for clients.
+glougloud probes can be network monitoring probes, system process tracker
+probes...
+glougloud clients can be graphical visualisation clients, command line monitoring
+clients ...
+
+Requirements
+============
+
+* libglouglou
+
+Known to work on OpenBSD 5.1 and Linux 3.4
+
+Installation
+============
+
+git clone git@meg:glouglou
+
+sudo useradd -d /var/empty/ -s /sbin/nologin _glougloud
+
+make && sudo make install
+
+Usage
+=====
+
+* Run the daemon
+
+sudo glougloud
+
+It logs to /var/log/glougloud.
+For the moment it monitors on lo0 interface.
+
+* Connect manualy to the daemon
+
+nc -vvv -u 127.0.0.1 4431 |hexdump -C
+
+You get a copy of all what the probes send
diff --git a/glougloud/glougloud.c b/glougloud/glougloud.c
new file mode 100644
index 0000000..45fca17
--- /dev/null
+++ b/glougloud/glougloud.c
@@ -0,0 +1,74 @@
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/wait.h>
+#include <sys/ioctl.h>
+
+#include <net/if.h>
+#include <netinet/in.h>
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <err.h>
+#include <errno.h>
+#include <unistd.h>
+#include <signal.h>
+#include <string.h>
+
+#include <libglouglou.h>
+
+struct gg_server *ggserv_probes;
+struct gg_server *ggserv_clients;
+struct event_base *ev_base;
+
+#if defined(__OPENBSD__)
+void __dead
+#else
+void
+#endif
+usage(void)
+{
+ extern char *__progname;
+
+ fprintf(stderr, "usage: %s [-vi]",
+ __progname);
+ exit(1);
+}
+
+static void
+sig_handler(int sig, short why, void *data)
+{
+ //log_info("got signal %d", sig);
+ if (sig == SIGINT || sig == SIGTERM)
+ event_base_loopexit(ev_base, NULL);
+}
+
+int
+main(int argc, char **argv)
+{
+ int loglevel = 0;
+ int op;
+
+ while ((op = getopt(argc, argv, "hv")) != -1) {
+ switch (op) {
+ case 'h':
+ usage();
+ /* NOTREACHED */
+ case 'v':
+ loglevel++;
+ break;
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ }
+
+ ev_base = event_base_new();
+
+ ggserv_probes = gg_server_start(ev_base, "127.0.0.1", 4430, NULL, NULL, NULL);
+ ggserv_clients = gg_server_start(ev_base, "127.0.0.1", 4431, NULL, NULL, NULL);
+
+ event_base_dispatch(ev_base);
+
+ return 0;
+}