This is a very simple HTTP server for Unix, using fork(). It's very easy to use
- include header
httpd.h
- write your route method, handling requests.
- call
serve_forever("12913")
to start serving on port 12913
/* | |
* 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 3 of the License, or | |
* (at your option) any later version. | |
*/ | |
#include <arpa/inet.h> | |
#include <linux/if_packet.h> | |
#include <stdio.h> |
body { | |
font-family: Helvetica, arial, sans-serif; | |
font-size: 14px; | |
line-height: 1.6; | |
padding-top: 10px; | |
padding-bottom: 10px; | |
background-color: white; | |
padding: 30px; } | |
body > *:first-child { |
#!/usr/bin/env python3 | |
# Tcp Port Forwarding (Reverse Proxy) | |
# Author : WangYihang <wangyihanger@gmail.com> | |
''' | |
+-----------------------------+ +---------------------------------------------+ +--------------------------------+ | |
| My Laptop (Alice) | | Intermediary Server (Bob) | | Internal Server (Carol) | | |
+-----------------------------+ +----------------------+----------------------+ +--------------------------------+ | |
| $ ssh -p 1022 carol@1.2.3.4 |<------->| IF 1: 1.2.3.4 | IF 2: 192.168.1.1 |<------->| IF 1: 192.168.1.2 | | |
| carol@1.2.3.4's password: | +----------------------+----------------------+ +--------------------------------+ |
# ref: https://play.golang.org/p/OeEmT_CXyO | |
package main | |
import ( | |
"fmt" | |
"runtime" | |
"strconv" | |
"strings" | |
"sync" | |
) |
/** | |
* More info? | |
* a.dotreppe@aspyct.org | |
* http://aspyct.org | |
* | |
* Hope it helps :) | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> |
/* | |
C socket server example, handles multiple clients using threads | |
Compile | |
gcc server.c -lpthread -o server | |
*/ | |
#include<stdio.h> | |
#include<string.h> //strlen | |
#include<stdlib.h> //strlen | |
#include<sys/socket.h> |
; This is a snippet of the original file in https://github.com/geyslan/SLAE/blob/master/1st.assignment/shell_bind_tcp.asm | |
global _start | |
section .text | |
_start: | |
; syscalls (/usr/include/asm/unistd_32.h) | |
; socketcall numbers (/usr/include/linux/net.h) |
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"net/http" | |
"sync" | |
"time" | |
) |
/* | |
An example of using raw sockets. | |
You can capture packets by tcpdump: | |
tcpdump -X -s0 -i lo -p udp | |
*/ | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <stdio.h> |