debug server can send 'custom' packet for netgenie to send out

This commit is contained in:
Beau Kujath committed 2023-07-14 16:31:43 -06:00
1 parent 12ebe3fed5
commit be26be504a
3 files changed
+48 -29

No files matched your search

+11 -9
View File
@@ -353,23 +353,22 @@ void handle_ip(const struct arguments *args,
// START: create debug tcp session and write packets to it
// START: create debug tcp session after 10 packets,
// then forward to debug server (only packets 30-50 for testing purposes)
debug_set += 1;
if (debug_set == 20) { // make connection with debug server
if (debug_set == 10) { // make connection with debug server
log_android(ANDROID_LOG_ERROR, "handling debug socket init");
debug_socket_init(args, epoll_fd);
} else if(debug_set < 20) {
log_android(ANDROID_LOG_ERROR, "Waiting for more packets to start debug sesh --> %d/20", debug_set);
} else if (debug_set > 20 && debug_set < 40 && debug_set < 45) {
log_android(ANDROID_LOG_ERROR, "Waiting for more packets to start writing to the debug sesh --> %d/40", debug_set);
} else if (debug_set > 50 && debug_set < 60){ // forward outgoing packets to debug server
} else if(debug_set < 10) {
log_android(ANDROID_LOG_ERROR, "Waiting for more packets to start debug sesh --> %d/10", debug_set);
} else if (debug_set > 10 && debug_set < 20) {
log_android(ANDROID_LOG_ERROR, "Waiting for more packets to start writing to the debug sesh --> %d/30", debug_set);
} else if (debug_set > 30 && debug_set < 50){ // forward outgoing packets to debug server
log_android(ANDROID_LOG_ERROR, "Finished writing to debug server --> %d", debug_set);
write_debug_socket(args, epoll_fd,pkt, length);
}
// END: debug session
if (dport == 50508 || sport == 50508) { // if debug session
log_android(ANDROID_LOG_ERROR, "Found debug IP packet, change uid..");
uid = -1;
@@ -377,6 +376,9 @@ void handle_ip(const struct arguments *args,
redirect = NULL;
}
// END: debug session handling
log_android(ANDROID_LOG_ERROR,
"BPB Packet v%d %s/%u > %s/%u proto %d flags %s uid %d",
version, source, sport, dest, dport, protocol, flags, uid);
+4 -14
View File
@@ -439,24 +439,12 @@ jboolean handle_tcp(const struct arguments *args,
int debug_socket_init(const struct arguments *args, int epoll_fd);
void read_debug_socket();
void write_debug_socket(const struct arguments *args, int epoll_fd, const uint8_t *buffer, size_t length);
void add_debug_session(const struct arguments * args, int epoll_fd);
void create_syn_packet(char** out_packet, int* out_packet_len);
void write_debug_ack(const struct arguments *args, int epoll_fd, uint32_t seq_num);
struct ng_session *get_debug_session(const struct arguments *args);
@@ -467,6 +455,8 @@ void handle_debug_packet(const struct arguments *args, int epoll_fd, const uint8
void queue_tcp(const struct arguments *args,
const struct tcphdr *tcphdr,
const char *session, struct tcp_session *cur,