Skip to content

Commit

Permalink
Adding a few missing files to the last commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
rsundahl committed Mar 8, 2018
1 parent c864a76 commit a6c77eb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions READHOOK.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ apt-get update -y && apt-get install -y curl netcat socat wget
```
### (2) Get readhook components
```
wget -q -O /tmp/basehook.so https://github.com/polyverse/readhook/releases/download/jenkins/basehook.so
wget -q -O /tmp/fullhook.so https://github.com/polyverse/readhook/releases/download/jenkins/fullhook.so
wget -q -O /tmp/basehook.so https://github.com/polyverse/readhook/releases/download/v1.2.1/basehook.so
wget -q -O /tmp/fullhook.so https://github.com/polyverse/readhook/releases/download/v1.2.1/fullhook.so
```
### (2) Start socat with readhook in front of libc
socat -T600 TCP4-LISTEN:8080,reuseaddr SYSTEM:"/usr/bin/env LD_PRELOAD='/tmp/fullhook.so:/tmp/basehook.so' /bin/cat"
Expand Down
Binary file added app/fullhook
Binary file not shown.
13 changes: 13 additions & 0 deletions src/noophook.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#define _GNU_SOURCE
#include <dlfcn.h> // For dlsym()
#include <stdio.h> // For i/o

// NOOP read function for testing if LD_PRELOAD can be injected quietly.
typedef
ssize_t Read(int fd, void *buf, size_t count);
ssize_t read(int fd, void *buf, size_t count) {
Read *libc_read = (Read *) dlsym(RTLD_NEXT, "read");
ssize_t result = libc_read(fd, buf, count);

return result;
} // read()
6 changes: 6 additions & 0 deletions src/nullhook.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define _GNU_SOURCE
#include <stdlib.h>

ssize_t dummy(int fd, void *buf, size_t count) {
return 0;
} // dummy()

0 comments on commit a6c77eb

Please sign in to comment.