Commit af50b329 authored by thesw4rm's avatar thesw4rm 💬

Sike this is the real initial commit

parent ed63d3dd
cmake_minimum_required(VERSION 3.13)
project(c_router C)
project(command C)
#INCLUDE_DIRECTORIES(/usr/include/libnetfilter_queue)
set(CMAKE_C_STANDARD 11)
set(LINUXSRC "/home/ytpillai/linux")
add_executable(server main.c main.h tcp_pkt_struct.h )
target_link_libraries(server netfilter_queue mnl)
add_executable(server main.c tcp_pkt_struct.h )
target_link_libraries(server netfilter_queue)
......@@ -182,17 +182,13 @@ static void modify_handshk_pkt(full_tcp_pkt_t *pkt, int pkt_len) {
printf("\nPacket intercepted: \n");
if (pkt->tcp_header.syn == 1 && pkt->tcp_header.ack == 0) {
printf("\tPacket type: SYN\n");
pkt_meta *metadata =
(pkt_meta *)((unsigned char *)pkt + pkt_len - METADATA_SIZE);
char secret_ip[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &metadata->ip_addr, secret_ip, INET_ADDRSTRLEN);
printf("\nSECRET IP: %s\n", secret_ip);
}
}
static int cb(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg, struct nfq_data *nfa, void *data) {
u_int32_t id;
......
/*
* =====================================================================================
*
* Filename: main.h
*
* Description
*
* Version: 1.0
* Created: 09/14/2019 11:37:05 PM
* Revision: none
* Compiler: gcc
*
* Author: swarm
* Organization:
*
* =====================================================================================
*/
This diff is collapsed.
......@@ -12,18 +12,6 @@
typedef uint32_t addr_t;
typedef uint16_t port_t;
#define METADATA_SIZE 12
#pragma pack(push, 1)
typedef struct {
uint32_t padding; // All zeroes
uint8_t exp_opt; // Should be experimental option assigned by IANA
uint8_t exp_opt_len;
uint16_t exp_opt_id;
//uint16_t exp_opt_exid; // ExID for experimental option
uint32_t ip_addr;
} pkt_meta;
#pragma pack(pop)
#pragma pack(push, 1)
typedef struct {
struct iphdr ipv4_header;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment