-
Notifications
You must be signed in to change notification settings - Fork 29
/
server.hpp
executable file
·99 lines (66 loc) · 1.91 KB
/
server.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef _GSC_SERVER_HPP_
#define _GSC_SERVER_HPP_
#ifdef __cplusplus
extern "C" {
#endif
/* default stuff */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* va_args */
#include <stdarg.h>
/* cdecl_injected_closer() */
#include "gsc.hpp"
#include <dlfcn.h>
#include <pthread.h>
// for getpid()
#include <sys/types.h>
#include <unistd.h> // also for usleep()
// for time()
#include <time.h>
#include <inttypes.h> // int16_t
// NET
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h> /* mprotect */
#include "cracking.hpp"
typedef struct
{
int create_socket;
int new_socket;
struct sockaddr_in address;
socklen_t addrlen;
} TCP_connection;
#define BUFFER_OUT 4096
void startServerAsThread(int port, int debug);
static void mythread(void *arg);
int cdecl_injected_shell(int a, int b, int c);
int cdecl_return_0();
int cdecl_return_1();
int cdecl_print(int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9);
int TCP_server_start(TCP_connection *conn, int port);
int TCP_wait_for_client(TCP_connection *conn);
int TCP_close_connection(TCP_connection *conn);
int TCP_read_all_bugged(TCP_connection *conn, void *buffer, int bufferLen, int *outMsgLen);
int TCP_read_all(TCP_connection *conn, void *buffer, int bufferLen, int *outMsgLen);
int TCP_write(TCP_connection *conn, const char *str, ...);
#define MAX_ROWS 16
#define MAX_COLS 16
#define MAX_CHARS 64
int parseRequest(char *toParse, char table[MAX_ROWS][MAX_COLS][MAX_CHARS]);
int handleRequest(char lol[MAX_ROWS][MAX_COLS][MAX_CHARS]);
void input(char *buffer, int len);
// now in cracking.hpp
//int singleHexToNumber(char hexchar);
//int hexToBuffer(char *hex, char *buffer, int bufferLen);
int readMemoryRange(void *from, void *buffer, int bytes);
#ifdef __cplusplus
}
#endif
#endif