ciphertable.lua 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. local M = {};
  2. local ciphers = {};
  3. ciphers[0xC030] = "ECDHE-RSA-AES256-GCM-SHA384";
  4. ciphers[0xC02C] = "ECDHE-ECDSA-AES256-GCM-SHA384";
  5. ciphers[0xC028] = "ECDHE-RSA-AES256-SHA384";
  6. ciphers[0xC024] = "ECDHE-ECDSA-AES256-SHA384";
  7. ciphers[0xC014] = "ECDHE-RSA-AES256-SHA";
  8. ciphers[0xC00A] = "ECDHE-ECDSA-AES256-SHA";
  9. ciphers[0xC022] = "SRP-DSS-AES-256-CBC-SHA";
  10. ciphers[0xC021] = "SRP-RSA-AES-256-CBC-SHA";
  11. ciphers[0x00A3] = "DHE-DSS-AES256-GCM-SHA384";
  12. ciphers[0x009F] = "DHE-RSA-AES256-GCM-SHA384";
  13. ciphers[0x006B] = "DHE-RSA-AES256-SHA256";
  14. ciphers[0x006A] = "DHE-DSS-AES256-SHA256";
  15. ciphers[0x0039] = "DHE-RSA-AES256-SHA";
  16. ciphers[0x0038] = "DHE-DSS-AES256-SHA";
  17. ciphers[0x0088] = "DHE-RSA-CAMELLIA256-SHA";
  18. ciphers[0x0087] = "DHE-DSS-CAMELLIA256-SHA";
  19. ciphers[0xC019] = "AECDH-AES256-SHA";
  20. ciphers[0xC020] = "SRP-AES-256-CBC-SHA";
  21. ciphers[0x00A7] = "ADH-AES256-GCM-SHA384";
  22. ciphers[0x006D] = "ADH-AES256-SHA256";
  23. ciphers[0x003A] = "ADH-AES256-SHA";
  24. ciphers[0x0089] = "ADH-CAMELLIA256-SHA";
  25. ciphers[0xC032] = "ECDH-RSA-AES256-GCM-SHA384";
  26. ciphers[0xC02E] = "ECDH-ECDSA-AES256-GCM-SHA384";
  27. ciphers[0xC02A] = "ECDH-RSA-AES256-SHA384";
  28. ciphers[0xC026] = "ECDH-ECDSA-AES256-SHA384";
  29. ciphers[0xC00F] = "ECDH-RSA-AES256-SHA";
  30. ciphers[0xC005] = "ECDH-ECDSA-AES256-SHA";
  31. ciphers[0x009D] = "AES256-GCM-SHA384";
  32. ciphers[0x003D] = "AES256-SHA256";
  33. ciphers[0x0035] = "AES256-SHA";
  34. ciphers[0x0084] = "CAMELLIA256-SHA";
  35. ciphers[0x008D] = "PSK-AES256-CBC-SHA";
  36. ciphers[0xC012] = "ECDHE-RSA-DES-CBC3-SHA";
  37. ciphers[0xC008] = "ECDHE-ECDSA-DES-CBC3-SHA";
  38. ciphers[0xC01C] = "SRP-DSS-3DES-EDE-CBC-SHA";
  39. ciphers[0xC01B] = "SRP-RSA-3DES-EDE-CBC-SHA";
  40. ciphers[0x0016] = "EDH-RSA-DES-CBC3-SHA";
  41. ciphers[0x0013] = "EDH-DSS-DES-CBC3-SHA";
  42. ciphers[0xC017] = "AECDH-DES-CBC3-SHA";
  43. ciphers[0xC01A] = "SRP-3DES-EDE-CBC-SHA";
  44. ciphers[0x001B] = "ADH-DES-CBC3-SHA";
  45. ciphers[0xC00D] = "ECDH-RSA-DES-CBC3-SHA";
  46. ciphers[0xC003] = "ECDH-ECDSA-DES-CBC3-SHA";
  47. ciphers[0x000A] = "DES-CBC3-SHA";
  48. ciphers[0x0700C0] = "DES-CBC3-MD5";
  49. ciphers[0x008B] = "PSK-3DES-EDE-CBC-SHA";
  50. ciphers[0xC02F] = "ECDHE-RSA-AES128-GCM-SHA256";
  51. ciphers[0xC02B] = "ECDHE-ECDSA-AES128-GCM-SHA256";
  52. ciphers[0xC027] = "ECDHE-RSA-AES128-SHA256";
  53. ciphers[0xC023] = "ECDHE-ECDSA-AES128-SHA256";
  54. ciphers[0xC013] = "ECDHE-RSA-AES128-SHA";
  55. ciphers[0xC009] = "ECDHE-ECDSA-AES128-SHA";
  56. ciphers[0xC01F] = "SRP-DSS-AES-128-CBC-SHA";
  57. ciphers[0xC01E] = "SRP-RSA-AES-128-CBC-SHA";
  58. ciphers[0x00A2] = "DHE-DSS-AES128-GCM-SHA256";
  59. ciphers[0x009E] = "DHE-RSA-AES128-GCM-SHA256";
  60. ciphers[0x0067] = "DHE-RSA-AES128-SHA256";
  61. ciphers[0x0040] = "DHE-DSS-AES128-SHA256";
  62. ciphers[0x0033] = "DHE-RSA-AES128-SHA";
  63. ciphers[0x0032] = "DHE-DSS-AES128-SHA";
  64. ciphers[0x009A] = "DHE-RSA-SEED-SHA";
  65. ciphers[0x0099] = "DHE-DSS-SEED-SHA";
  66. ciphers[0x0045] = "DHE-RSA-CAMELLIA128-SHA";
  67. ciphers[0x0044] = "DHE-DSS-CAMELLIA128-SHA";
  68. ciphers[0xC018] = "AECDH-AES128-SHA";
  69. ciphers[0xC01D] = "SRP-AES-128-CBC-SHA";
  70. ciphers[0x00A6] = "ADH-AES128-GCM-SHA256";
  71. ciphers[0x006C] = "ADH-AES128-SHA256";
  72. ciphers[0x0034] = "ADH-AES128-SHA";
  73. ciphers[0x009B] = "ADH-SEED-SHA";
  74. ciphers[0x0046] = "ADH-CAMELLIA128-SHA";
  75. ciphers[0xC031] = "ECDH-RSA-AES128-GCM-SHA256";
  76. ciphers[0xC02D] = "ECDH-ECDSA-AES128-GCM-SHA256";
  77. ciphers[0xC029] = "ECDH-RSA-AES128-SHA256";
  78. ciphers[0xC025] = "ECDH-ECDSA-AES128-SHA256";
  79. ciphers[0xC00E] = "ECDH-RSA-AES128-SHA";
  80. ciphers[0xC004] = "ECDH-ECDSA-AES128-SHA";
  81. ciphers[0x009C] = "AES128-GCM-SHA256";
  82. ciphers[0x003C] = "AES128-SHA256";
  83. ciphers[0x002F] = "AES128-SHA";
  84. ciphers[0x0096] = "SEED-SHA";
  85. ciphers[0x0041] = "CAMELLIA128-SHA";
  86. ciphers[0x0007] = "IDEA-CBC-SHA";
  87. ciphers[0x050080] = "IDEA-CBC-MD5";
  88. ciphers[0x030080] = "RC2-CBC-MD5";
  89. ciphers[0x008C] = "PSK-AES128-CBC-SHA";
  90. ciphers[0xC011] = "ECDHE-RSA-RC4-SHA";
  91. ciphers[0xC007] = "ECDHE-ECDSA-RC4-SHA";
  92. ciphers[0xC016] = "AECDH-RC4-SHA";
  93. ciphers[0x0018] = "ADH-RC4-MD5";
  94. ciphers[0xC00C] = "ECDH-RSA-RC4-SHA";
  95. ciphers[0xC002] = "ECDH-ECDSA-RC4-SHA";
  96. ciphers[0x0005] = "RC4-SHA";
  97. ciphers[0x0004] = "RC4-MD5";
  98. ciphers[0x010080] = "RC4-MD5";
  99. ciphers[0x008A] = "PSK-RC4-SHA";
  100. ciphers[0x0015] = "EDH-RSA-DES-CBC-SHA";
  101. ciphers[0x0012] = "EDH-DSS-DES-CBC-SHA";
  102. ciphers[0x001A] = "ADH-DES-CBC-SHA";
  103. ciphers[0x0009] = "DES-CBC-SHA";
  104. ciphers[0x060040] = "DES-CBC-MD5";
  105. ciphers[0x0014] = "EXP-EDH-RSA-DES-CBC-SHA";
  106. ciphers[0x0011] = "EXP-EDH-DSS-DES-CBC-SHA";
  107. ciphers[0x0019] = "EXP-ADH-DES-CBC-SHA";
  108. ciphers[0x0008] = "EXP-DES-CBC-SHA";
  109. ciphers[0x0006] = "EXP-RC2-CBC-MD5";
  110. ciphers[0x040080] = "EXP-RC2-CBC-MD5";
  111. ciphers[0x0017] = "EXP-ADH-RC4-MD5";
  112. ciphers[0x0003] = "EXP-RC4-MD5";
  113. ciphers[0x020080] = "EXP-RC4-MD5";
  114. ciphers[0xC010] = "ECDHE-RSA-NULL-SHA";
  115. ciphers[0xC006] = "ECDHE-ECDSA-NULL-SHA";
  116. ciphers[0xC015] = "AECDH-NULL-SHA";
  117. ciphers[0xC00B] = "ECDH-RSA-NULL-SHA";
  118. ciphers[0xC001] = "ECDH-ECDSA-NULL-SHA";
  119. ciphers[0x003B] = "NULL-SHA256";
  120. ciphers[0x0002] = "NULL-SHA";
  121. ciphers[0x0001] = "NULL-MD5";
  122. ciphers[0x0066] = "DHE-DSS-RC4-SHA";
  123. M.ciphers = ciphers;
  124. function M.find(name)
  125. for k,v in pairs(ciphers) do
  126. if v == name then
  127. return k
  128. end
  129. end
  130. end
  131. -- Turns a hex-dump of a TLS client hello message into the list of supported ciphers (2 byte ciphers).
  132. function M.parse_list_tls(str)
  133. local result = "";
  134. str:gsub("....", function (code)
  135. local cipher = ciphers[tonumber(code, 16)];
  136. if cipher then
  137. if #result > 0 then
  138. result = result .. ":";
  139. end
  140. result = result .. cipher;
  141. else
  142. print("Cipher " .. code .. " not found!");
  143. end
  144. end);
  145. return result;
  146. end
  147. -- Turns a hex-dump of a SSL client hello message into the list of supported ciphers (3 byte ciphers).
  148. function M.parse_list_ssl(str)
  149. local result = "";
  150. str:gsub("......", function (code)
  151. local cipher = ciphers[tonumber(code, 16)];
  152. if cipher then
  153. if #result > 0 then
  154. result = result .. ":";
  155. end
  156. result = result .. cipher;
  157. else
  158. print("Cipher " .. code .. " not found!");
  159. end
  160. end);
  161. return result;
  162. end
  163. if arg then
  164. if arg[1] == "ssl" then
  165. _G.print(M.parse_list_ssl(arg[2]));
  166. elseif arg[1] == "tls" then
  167. _G.print(M.parse_list_tls(arg[2]));
  168. end
  169. end
  170. return M;