immunio 1.2.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -5
  3. data/ext/immunio/Rakefile +14 -6
  4. data/lib/immunio/context.rb +2 -0
  5. data/lib/immunio/plugins/action_view.rb +7 -668
  6. data/lib/immunio/plugins/action_view/action_view.rb +22 -0
  7. data/lib/immunio/plugins/action_view/active_support_hash.rb +29 -0
  8. data/lib/immunio/plugins/action_view/cache_store.rb +24 -0
  9. data/lib/immunio/plugins/action_view/erubi.rb +38 -0
  10. data/lib/immunio/plugins/action_view/erubis.rb +39 -0
  11. data/lib/immunio/plugins/action_view/fragment_caching.rb +29 -0
  12. data/lib/immunio/plugins/action_view/haml.rb +46 -0
  13. data/lib/immunio/plugins/action_view/slim.rb +42 -0
  14. data/lib/immunio/plugins/action_view/template.rb +431 -0
  15. data/lib/immunio/plugins/action_view/template_rendering.rb +45 -0
  16. data/lib/immunio/plugins/http_tracker.rb +2 -0
  17. data/lib/immunio/plugins/io.rb +34 -0
  18. data/lib/immunio/version.rb +1 -1
  19. data/lua-hooks/Makefile +36 -9
  20. data/lua-hooks/ext/luajit/COPYRIGHT +1 -1
  21. data/lua-hooks/ext/luajit/Makefile +22 -15
  22. data/lua-hooks/ext/luajit/README +2 -2
  23. data/lua-hooks/ext/luajit/doc/bluequad-print.css +1 -1
  24. data/lua-hooks/ext/luajit/doc/bluequad.css +1 -1
  25. data/lua-hooks/ext/luajit/doc/changes.html +69 -3
  26. data/lua-hooks/ext/luajit/doc/contact.html +10 -3
  27. data/lua-hooks/ext/luajit/doc/ext_c_api.html +2 -2
  28. data/lua-hooks/ext/luajit/doc/ext_ffi.html +2 -2
  29. data/lua-hooks/ext/luajit/doc/ext_ffi_api.html +2 -2
  30. data/lua-hooks/ext/luajit/doc/ext_ffi_semantics.html +3 -4
  31. data/lua-hooks/ext/luajit/doc/ext_ffi_tutorial.html +2 -2
  32. data/lua-hooks/ext/luajit/doc/ext_jit.html +3 -3
  33. data/lua-hooks/ext/luajit/doc/ext_profiler.html +2 -2
  34. data/lua-hooks/ext/luajit/doc/extensions.html +47 -20
  35. data/lua-hooks/ext/luajit/doc/faq.html +2 -2
  36. data/lua-hooks/ext/luajit/doc/install.html +74 -45
  37. data/lua-hooks/ext/luajit/doc/luajit.html +5 -5
  38. data/lua-hooks/ext/luajit/doc/running.html +3 -3
  39. data/lua-hooks/ext/luajit/doc/status.html +13 -8
  40. data/lua-hooks/ext/luajit/dynasm/dasm_arm.h +1 -1
  41. data/lua-hooks/ext/luajit/dynasm/dasm_arm.lua +1 -1
  42. data/lua-hooks/ext/luajit/dynasm/dasm_arm64.h +1 -1
  43. data/lua-hooks/ext/luajit/dynasm/dasm_arm64.lua +1 -1
  44. data/lua-hooks/ext/luajit/dynasm/dasm_mips.h +8 -5
  45. data/lua-hooks/ext/luajit/dynasm/dasm_mips.lua +66 -11
  46. data/lua-hooks/ext/luajit/dynasm/dasm_mips64.lua +12 -0
  47. data/lua-hooks/ext/luajit/dynasm/dasm_ppc.h +1 -1
  48. data/lua-hooks/ext/luajit/dynasm/dasm_ppc.lua +1 -1
  49. data/lua-hooks/ext/luajit/dynasm/dasm_proto.h +1 -1
  50. data/lua-hooks/ext/luajit/dynasm/dasm_x64.lua +1 -1
  51. data/lua-hooks/ext/luajit/dynasm/dasm_x86.h +1 -1
  52. data/lua-hooks/ext/luajit/dynasm/dasm_x86.lua +5 -1
  53. data/lua-hooks/ext/luajit/dynasm/dynasm.lua +2 -2
  54. data/lua-hooks/ext/luajit/etc/luajit.1 +1 -1
  55. data/lua-hooks/ext/luajit/etc/luajit.pc +1 -1
  56. data/lua-hooks/ext/luajit/src/Makefile +15 -11
  57. data/lua-hooks/ext/luajit/src/Makefile.dep +16 -16
  58. data/lua-hooks/ext/luajit/src/host/buildvm.c +2 -2
  59. data/lua-hooks/ext/luajit/src/host/buildvm.h +1 -1
  60. data/lua-hooks/ext/luajit/src/host/buildvm_asm.c +9 -4
  61. data/lua-hooks/ext/luajit/src/host/buildvm_fold.c +2 -2
  62. data/lua-hooks/ext/luajit/src/host/buildvm_lib.c +1 -1
  63. data/lua-hooks/ext/luajit/src/host/buildvm_libbc.h +14 -3
  64. data/lua-hooks/ext/luajit/src/host/buildvm_peobj.c +27 -3
  65. data/lua-hooks/ext/luajit/src/host/genlibbc.lua +1 -1
  66. data/lua-hooks/ext/luajit/src/host/genminilua.lua +6 -5
  67. data/lua-hooks/ext/luajit/src/host/minilua.c +1 -1
  68. data/lua-hooks/ext/luajit/src/jit/bc.lua +1 -1
  69. data/lua-hooks/ext/luajit/src/jit/bcsave.lua +8 -8
  70. data/lua-hooks/ext/luajit/src/jit/dis_arm.lua +2 -2
  71. data/lua-hooks/ext/luajit/src/jit/dis_arm64.lua +1216 -0
  72. data/lua-hooks/ext/luajit/src/jit/dis_arm64be.lua +12 -0
  73. data/lua-hooks/ext/luajit/src/jit/dis_mips.lua +35 -20
  74. data/lua-hooks/ext/luajit/src/jit/dis_mips64.lua +17 -0
  75. data/lua-hooks/ext/luajit/src/jit/dis_mips64el.lua +17 -0
  76. data/lua-hooks/ext/luajit/src/jit/dis_mipsel.lua +1 -1
  77. data/lua-hooks/ext/luajit/src/jit/dis_ppc.lua +2 -2
  78. data/lua-hooks/ext/luajit/src/jit/dis_x64.lua +1 -1
  79. data/lua-hooks/ext/luajit/src/jit/dis_x86.lua +7 -4
  80. data/lua-hooks/ext/luajit/src/jit/dump.lua +17 -12
  81. data/lua-hooks/ext/luajit/src/jit/p.lua +3 -2
  82. data/lua-hooks/ext/luajit/src/jit/v.lua +2 -2
  83. data/lua-hooks/ext/luajit/src/jit/zone.lua +1 -1
  84. data/lua-hooks/ext/luajit/src/lauxlib.h +14 -20
  85. data/lua-hooks/ext/luajit/src/lib_aux.c +38 -27
  86. data/lua-hooks/ext/luajit/src/lib_base.c +12 -5
  87. data/lua-hooks/ext/luajit/src/lib_bit.c +1 -1
  88. data/lua-hooks/ext/luajit/src/lib_debug.c +5 -5
  89. data/lua-hooks/ext/luajit/src/lib_ffi.c +2 -2
  90. data/lua-hooks/ext/luajit/src/lib_init.c +16 -16
  91. data/lua-hooks/ext/luajit/src/lib_io.c +6 -7
  92. data/lua-hooks/ext/luajit/src/lib_jit.c +14 -4
  93. data/lua-hooks/ext/luajit/src/lib_math.c +1 -5
  94. data/lua-hooks/ext/luajit/src/lib_os.c +1 -1
  95. data/lua-hooks/ext/luajit/src/lib_package.c +14 -23
  96. data/lua-hooks/ext/luajit/src/lib_string.c +1 -5
  97. data/lua-hooks/ext/luajit/src/lib_table.c +21 -1
  98. data/lua-hooks/ext/luajit/src/lj.supp +3 -3
  99. data/lua-hooks/ext/luajit/src/lj_alloc.c +174 -83
  100. data/lua-hooks/ext/luajit/src/lj_api.c +97 -18
  101. data/lua-hooks/ext/luajit/src/lj_arch.h +54 -22
  102. data/lua-hooks/ext/luajit/src/lj_asm.c +172 -53
  103. data/lua-hooks/ext/luajit/src/lj_asm.h +1 -1
  104. data/lua-hooks/ext/luajit/src/lj_asm_arm.h +19 -16
  105. data/lua-hooks/ext/luajit/src/lj_asm_arm64.h +2022 -0
  106. data/lua-hooks/ext/luajit/src/lj_asm_mips.h +564 -158
  107. data/lua-hooks/ext/luajit/src/lj_asm_ppc.h +19 -18
  108. data/lua-hooks/ext/luajit/src/lj_asm_x86.h +578 -92
  109. data/lua-hooks/ext/luajit/src/lj_bc.c +1 -1
  110. data/lua-hooks/ext/luajit/src/lj_bc.h +1 -1
  111. data/lua-hooks/ext/luajit/src/lj_bcdump.h +1 -1
  112. data/lua-hooks/ext/luajit/src/lj_bcread.c +1 -1
  113. data/lua-hooks/ext/luajit/src/lj_bcwrite.c +1 -1
  114. data/lua-hooks/ext/luajit/src/lj_buf.c +1 -1
  115. data/lua-hooks/ext/luajit/src/lj_buf.h +1 -1
  116. data/lua-hooks/ext/luajit/src/lj_carith.c +1 -1
  117. data/lua-hooks/ext/luajit/src/lj_carith.h +1 -1
  118. data/lua-hooks/ext/luajit/src/lj_ccall.c +172 -7
  119. data/lua-hooks/ext/luajit/src/lj_ccall.h +21 -5
  120. data/lua-hooks/ext/luajit/src/lj_ccallback.c +71 -17
  121. data/lua-hooks/ext/luajit/src/lj_ccallback.h +1 -1
  122. data/lua-hooks/ext/luajit/src/lj_cconv.c +4 -2
  123. data/lua-hooks/ext/luajit/src/lj_cconv.h +1 -1
  124. data/lua-hooks/ext/luajit/src/lj_cdata.c +7 -5
  125. data/lua-hooks/ext/luajit/src/lj_cdata.h +1 -1
  126. data/lua-hooks/ext/luajit/src/lj_clib.c +5 -5
  127. data/lua-hooks/ext/luajit/src/lj_clib.h +1 -1
  128. data/lua-hooks/ext/luajit/src/lj_cparse.c +11 -6
  129. data/lua-hooks/ext/luajit/src/lj_cparse.h +1 -1
  130. data/lua-hooks/ext/luajit/src/lj_crecord.c +70 -14
  131. data/lua-hooks/ext/luajit/src/lj_crecord.h +1 -1
  132. data/lua-hooks/ext/luajit/src/lj_ctype.c +1 -1
  133. data/lua-hooks/ext/luajit/src/lj_ctype.h +8 -8
  134. data/lua-hooks/ext/luajit/src/lj_debug.c +1 -1
  135. data/lua-hooks/ext/luajit/src/lj_debug.h +1 -1
  136. data/lua-hooks/ext/luajit/src/lj_def.h +6 -9
  137. data/lua-hooks/ext/luajit/src/lj_dispatch.c +3 -3
  138. data/lua-hooks/ext/luajit/src/lj_dispatch.h +2 -1
  139. data/lua-hooks/ext/luajit/src/lj_emit_arm.h +5 -4
  140. data/lua-hooks/ext/luajit/src/lj_emit_arm64.h +419 -0
  141. data/lua-hooks/ext/luajit/src/lj_emit_mips.h +100 -20
  142. data/lua-hooks/ext/luajit/src/lj_emit_ppc.h +4 -4
  143. data/lua-hooks/ext/luajit/src/lj_emit_x86.h +116 -25
  144. data/lua-hooks/ext/luajit/src/lj_err.c +34 -13
  145. data/lua-hooks/ext/luajit/src/lj_err.h +1 -1
  146. data/lua-hooks/ext/luajit/src/lj_errmsg.h +1 -1
  147. data/lua-hooks/ext/luajit/src/lj_ff.h +1 -1
  148. data/lua-hooks/ext/luajit/src/lj_ffrecord.c +58 -49
  149. data/lua-hooks/ext/luajit/src/lj_ffrecord.h +1 -1
  150. data/lua-hooks/ext/luajit/src/lj_frame.h +33 -6
  151. data/lua-hooks/ext/luajit/src/lj_func.c +4 -2
  152. data/lua-hooks/ext/luajit/src/lj_func.h +1 -1
  153. data/lua-hooks/ext/luajit/src/lj_gc.c +16 -7
  154. data/lua-hooks/ext/luajit/src/lj_gc.h +1 -1
  155. data/lua-hooks/ext/luajit/src/lj_gdbjit.c +31 -1
  156. data/lua-hooks/ext/luajit/src/lj_gdbjit.h +1 -1
  157. data/lua-hooks/ext/luajit/src/lj_ir.c +69 -96
  158. data/lua-hooks/ext/luajit/src/lj_ir.h +29 -18
  159. data/lua-hooks/ext/luajit/src/lj_ircall.h +24 -30
  160. data/lua-hooks/ext/luajit/src/lj_iropt.h +9 -9
  161. data/lua-hooks/ext/luajit/src/lj_jit.h +67 -9
  162. data/lua-hooks/ext/luajit/src/lj_lex.c +1 -1
  163. data/lua-hooks/ext/luajit/src/lj_lex.h +1 -1
  164. data/lua-hooks/ext/luajit/src/lj_lib.c +1 -1
  165. data/lua-hooks/ext/luajit/src/lj_lib.h +1 -1
  166. data/lua-hooks/ext/luajit/src/lj_load.c +1 -1
  167. data/lua-hooks/ext/luajit/src/lj_mcode.c +11 -10
  168. data/lua-hooks/ext/luajit/src/lj_mcode.h +1 -1
  169. data/lua-hooks/ext/luajit/src/lj_meta.c +1 -1
  170. data/lua-hooks/ext/luajit/src/lj_meta.h +1 -1
  171. data/lua-hooks/ext/luajit/src/lj_obj.c +1 -1
  172. data/lua-hooks/ext/luajit/src/lj_obj.h +7 -3
  173. data/lua-hooks/ext/luajit/src/lj_opt_dce.c +1 -1
  174. data/lua-hooks/ext/luajit/src/lj_opt_fold.c +84 -17
  175. data/lua-hooks/ext/luajit/src/lj_opt_loop.c +1 -1
  176. data/lua-hooks/ext/luajit/src/lj_opt_mem.c +3 -3
  177. data/lua-hooks/ext/luajit/src/lj_opt_narrow.c +24 -22
  178. data/lua-hooks/ext/luajit/src/lj_opt_sink.c +11 -6
  179. data/lua-hooks/ext/luajit/src/lj_opt_split.c +11 -2
  180. data/lua-hooks/ext/luajit/src/lj_parse.c +9 -7
  181. data/lua-hooks/ext/luajit/src/lj_parse.h +1 -1
  182. data/lua-hooks/ext/luajit/src/lj_profile.c +1 -1
  183. data/lua-hooks/ext/luajit/src/lj_profile.h +1 -1
  184. data/lua-hooks/ext/luajit/src/lj_record.c +201 -117
  185. data/lua-hooks/ext/luajit/src/lj_record.h +1 -1
  186. data/lua-hooks/ext/luajit/src/lj_snap.c +72 -26
  187. data/lua-hooks/ext/luajit/src/lj_snap.h +1 -1
  188. data/lua-hooks/ext/luajit/src/lj_state.c +6 -6
  189. data/lua-hooks/ext/luajit/src/lj_state.h +2 -2
  190. data/lua-hooks/ext/luajit/src/lj_str.c +1 -1
  191. data/lua-hooks/ext/luajit/src/lj_str.h +1 -1
  192. data/lua-hooks/ext/luajit/src/lj_strfmt.c +7 -3
  193. data/lua-hooks/ext/luajit/src/lj_strfmt.h +1 -1
  194. data/lua-hooks/ext/luajit/src/lj_strfmt_num.c +4 -3
  195. data/lua-hooks/ext/luajit/src/lj_strscan.c +1 -1
  196. data/lua-hooks/ext/luajit/src/lj_strscan.h +1 -1
  197. data/lua-hooks/ext/luajit/src/lj_tab.c +1 -2
  198. data/lua-hooks/ext/luajit/src/lj_tab.h +1 -1
  199. data/lua-hooks/ext/luajit/src/lj_target.h +3 -3
  200. data/lua-hooks/ext/luajit/src/lj_target_arm.h +1 -1
  201. data/lua-hooks/ext/luajit/src/lj_target_arm64.h +239 -7
  202. data/lua-hooks/ext/luajit/src/lj_target_mips.h +111 -22
  203. data/lua-hooks/ext/luajit/src/lj_target_ppc.h +1 -1
  204. data/lua-hooks/ext/luajit/src/lj_target_x86.h +21 -4
  205. data/lua-hooks/ext/luajit/src/lj_trace.c +63 -18
  206. data/lua-hooks/ext/luajit/src/lj_trace.h +2 -1
  207. data/lua-hooks/ext/luajit/src/lj_traceerr.h +1 -1
  208. data/lua-hooks/ext/luajit/src/lj_udata.c +1 -1
  209. data/lua-hooks/ext/luajit/src/lj_udata.h +1 -1
  210. data/lua-hooks/ext/luajit/src/lj_vm.h +5 -1
  211. data/lua-hooks/ext/luajit/src/lj_vmevent.c +1 -1
  212. data/lua-hooks/ext/luajit/src/lj_vmevent.h +1 -1
  213. data/lua-hooks/ext/luajit/src/lj_vmmath.c +1 -1
  214. data/lua-hooks/ext/luajit/src/ljamalg.c +1 -1
  215. data/lua-hooks/ext/luajit/src/lua.h +9 -1
  216. data/lua-hooks/ext/luajit/src/luaconf.h +3 -7
  217. data/lua-hooks/ext/luajit/src/luajit.c +69 -54
  218. data/lua-hooks/ext/luajit/src/luajit.h +4 -4
  219. data/lua-hooks/ext/luajit/src/lualib.h +1 -1
  220. data/lua-hooks/ext/luajit/src/msvcbuild.bat +12 -4
  221. data/lua-hooks/ext/luajit/src/vm_arm.dasc +1 -1
  222. data/lua-hooks/ext/luajit/src/vm_arm64.dasc +255 -32
  223. data/lua-hooks/ext/luajit/src/vm_mips.dasc +26 -23
  224. data/lua-hooks/ext/luajit/src/vm_mips64.dasc +5062 -0
  225. data/lua-hooks/ext/luajit/src/vm_ppc.dasc +1 -1
  226. data/lua-hooks/ext/luajit/src/vm_x64.dasc +24 -25
  227. data/lua-hooks/ext/luajit/src/vm_x86.dasc +77 -4
  228. data/lua-hooks/libluahooks.darwin.a +0 -0
  229. data/lua-hooks/libluahooks.linux.a +0 -0
  230. data/lua-hooks/options.mk +1 -1
  231. metadata +37 -77
  232. data/lua-hooks/ext/all.c +0 -69
  233. data/lua-hooks/ext/libinjection/COPYING +0 -37
  234. data/lua-hooks/ext/libinjection/libinjection.h +0 -65
  235. data/lua-hooks/ext/libinjection/libinjection_html5.c +0 -847
  236. data/lua-hooks/ext/libinjection/libinjection_html5.h +0 -54
  237. data/lua-hooks/ext/libinjection/libinjection_sqli.c +0 -2301
  238. data/lua-hooks/ext/libinjection/libinjection_sqli.h +0 -295
  239. data/lua-hooks/ext/libinjection/libinjection_sqli_data.h +0 -9349
  240. data/lua-hooks/ext/libinjection/libinjection_xss.c +0 -531
  241. data/lua-hooks/ext/libinjection/libinjection_xss.h +0 -21
  242. data/lua-hooks/ext/libinjection/lualib.c +0 -145
  243. data/lua-hooks/ext/libinjection/module.mk +0 -5
  244. data/lua-hooks/ext/lpeg/HISTORY +0 -96
  245. data/lua-hooks/ext/lpeg/lpcap.c +0 -537
  246. data/lua-hooks/ext/lpeg/lpcap.h +0 -56
  247. data/lua-hooks/ext/lpeg/lpcode.c +0 -1014
  248. data/lua-hooks/ext/lpeg/lpcode.h +0 -40
  249. data/lua-hooks/ext/lpeg/lpeg-128.gif +0 -0
  250. data/lua-hooks/ext/lpeg/lpeg.html +0 -1445
  251. data/lua-hooks/ext/lpeg/lpprint.c +0 -244
  252. data/lua-hooks/ext/lpeg/lpprint.h +0 -36
  253. data/lua-hooks/ext/lpeg/lptree.c +0 -1303
  254. data/lua-hooks/ext/lpeg/lptree.h +0 -82
  255. data/lua-hooks/ext/lpeg/lptypes.h +0 -149
  256. data/lua-hooks/ext/lpeg/lpvm.c +0 -364
  257. data/lua-hooks/ext/lpeg/lpvm.h +0 -58
  258. data/lua-hooks/ext/lpeg/makefile +0 -55
  259. data/lua-hooks/ext/lpeg/module.mk +0 -6
  260. data/lua-hooks/ext/lpeg/re.html +0 -498
  261. data/lua-hooks/ext/lua-cmsgpack/.gitignore +0 -13
  262. data/lua-hooks/ext/lua-cmsgpack/CMakeLists.txt +0 -45
  263. data/lua-hooks/ext/lua-cmsgpack/README.md +0 -115
  264. data/lua-hooks/ext/lua-cmsgpack/lua_cmsgpack.c +0 -970
  265. data/lua-hooks/ext/lua-cmsgpack/module.mk +0 -2
  266. data/lua-hooks/ext/lua-cmsgpack/test.lua +0 -570
  267. data/lua-hooks/ext/lua-snapshot/LICENSE +0 -7
  268. data/lua-hooks/ext/lua-snapshot/Makefile +0 -12
  269. data/lua-hooks/ext/lua-snapshot/README.md +0 -18
  270. data/lua-hooks/ext/lua-snapshot/dump.lua +0 -15
  271. data/lua-hooks/ext/lua-snapshot/module.mk +0 -2
  272. data/lua-hooks/ext/lua-snapshot/snapshot.c +0 -462
  273. data/lua-hooks/ext/luautf8/README.md +0 -152
  274. data/lua-hooks/ext/luautf8/lutf8lib.c +0 -1274
  275. data/lua-hooks/ext/luautf8/module.mk +0 -2
  276. data/lua-hooks/ext/luautf8/unidata.h +0 -3064
  277. data/lua-hooks/ext/module.mk +0 -15
  278. data/lua-hooks/ext/modules.h +0 -17
  279. data/lua-hooks/ext/perf/luacpu.c +0 -114
  280. data/lua-hooks/ext/perf/lualoadavg.c +0 -40
  281. data/lua-hooks/ext/perf/luameminfo.c +0 -38
  282. data/lua-hooks/ext/perf/luaoslib.c +0 -203
  283. data/lua-hooks/ext/perf/module.mk +0 -5
  284. data/lua-hooks/ext/sha1/luasha1.c +0 -74
  285. data/lua-hooks/ext/sha1/module.mk +0 -5
  286. data/lua-hooks/ext/sha1/sha1.c +0 -145
  287. data/lua-hooks/ext/sha2/luasha256.c +0 -77
  288. data/lua-hooks/ext/sha2/module.mk +0 -5
  289. data/lua-hooks/ext/sha2/sha256.c +0 -196
  290. data/lua-hooks/ext/sysutils/lua_utils.c +0 -56
  291. data/lua-hooks/ext/sysutils/module.mk +0 -2
@@ -1,5 +0,0 @@
1
- SRC += \
2
- ext/sha1/luasha1.c
3
-
4
- SPECIAL_SRC += \
5
- ext/sha1/sha1.c
@@ -1,145 +0,0 @@
1
- /*
2
- * SHA-1 hash in C
3
- *
4
- * Copyright (c) 2014 Project Nayuki
5
- * http://www.nayuki.io/page/fast-sha1-hash-implementation-in-x86-assembly
6
- *
7
- * (MIT License)
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
9
- * this software and associated documentation files (the "Software"), to deal in
10
- * the Software without restriction, including without limitation the rights to
11
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
12
- * the Software, and to permit persons to whom the Software is furnished to do so,
13
- * subject to the following conditions:
14
- * - The above copyright notice and this permission notice shall be included in
15
- * all copies or substantial portions of the Software.
16
- * - The Software is provided "as is", without warranty of any kind, express or
17
- * implied, including but not limited to the warranties of merchantability,
18
- * fitness for a particular purpose and noninfringement. In no event shall the
19
- * authors or copyright holders be liable for any claim, damages or other
20
- * liability, whether in an action of contract, tort or otherwise, arising from,
21
- * out of or in connection with the Software or the use or other dealings in the
22
- * Software.
23
- */
24
-
25
- #include <stdint.h>
26
-
27
-
28
- void sha1_compress(uint32_t state[5], const uint8_t block[64]) {
29
- #define SCHEDULE(i) \
30
- temp = schedule[(i - 3) & 0xF] ^ schedule[(i - 8) & 0xF] ^ schedule[(i - 14) & 0xF] ^ schedule[(i - 16) & 0xF]; \
31
- schedule[i & 0xF] = temp << 1 | temp >> 31;
32
-
33
- #define LOADSCHEDULE(i) \
34
- schedule[i] = \
35
- (uint32_t)block[i * 4 + 0] << 24 \
36
- | (uint32_t)block[i * 4 + 1] << 16 \
37
- | (uint32_t)block[i * 4 + 2] << 8 \
38
- | (uint32_t)block[i * 4 + 3];
39
-
40
- #define ROUND0a(a, b, c, d, e, i) LOADSCHEDULE(i) ROUNDTAIL(a, b, e, ((b & c) | (~b & d)) , i, 0x5A827999)
41
- #define ROUND0b(a, b, c, d, e, i) SCHEDULE(i) ROUNDTAIL(a, b, e, ((b & c) | (~b & d)) , i, 0x5A827999)
42
- #define ROUND1(a, b, c, d, e, i) SCHEDULE(i) ROUNDTAIL(a, b, e, (b ^ c ^ d) , i, 0x6ED9EBA1)
43
- #define ROUND2(a, b, c, d, e, i) SCHEDULE(i) ROUNDTAIL(a, b, e, ((b & c) ^ (b & d) ^ (c & d)), i, 0x8F1BBCDC)
44
- #define ROUND3(a, b, c, d, e, i) SCHEDULE(i) ROUNDTAIL(a, b, e, (b ^ c ^ d) , i, 0xCA62C1D6)
45
-
46
- #define ROUNDTAIL(a, b, e, f, i, k) \
47
- e += (a << 5 | a >> 27) + f + UINT32_C(k) + schedule[i & 0xF]; \
48
- b = b << 30 | b >> 2;
49
-
50
- uint32_t a = state[0];
51
- uint32_t b = state[1];
52
- uint32_t c = state[2];
53
- uint32_t d = state[3];
54
- uint32_t e = state[4];
55
-
56
- uint32_t schedule[16];
57
- uint32_t temp;
58
- ROUND0a(a, b, c, d, e, 0)
59
- ROUND0a(e, a, b, c, d, 1)
60
- ROUND0a(d, e, a, b, c, 2)
61
- ROUND0a(c, d, e, a, b, 3)
62
- ROUND0a(b, c, d, e, a, 4)
63
- ROUND0a(a, b, c, d, e, 5)
64
- ROUND0a(e, a, b, c, d, 6)
65
- ROUND0a(d, e, a, b, c, 7)
66
- ROUND0a(c, d, e, a, b, 8)
67
- ROUND0a(b, c, d, e, a, 9)
68
- ROUND0a(a, b, c, d, e, 10)
69
- ROUND0a(e, a, b, c, d, 11)
70
- ROUND0a(d, e, a, b, c, 12)
71
- ROUND0a(c, d, e, a, b, 13)
72
- ROUND0a(b, c, d, e, a, 14)
73
- ROUND0a(a, b, c, d, e, 15)
74
- ROUND0b(e, a, b, c, d, 16)
75
- ROUND0b(d, e, a, b, c, 17)
76
- ROUND0b(c, d, e, a, b, 18)
77
- ROUND0b(b, c, d, e, a, 19)
78
- ROUND1(a, b, c, d, e, 20)
79
- ROUND1(e, a, b, c, d, 21)
80
- ROUND1(d, e, a, b, c, 22)
81
- ROUND1(c, d, e, a, b, 23)
82
- ROUND1(b, c, d, e, a, 24)
83
- ROUND1(a, b, c, d, e, 25)
84
- ROUND1(e, a, b, c, d, 26)
85
- ROUND1(d, e, a, b, c, 27)
86
- ROUND1(c, d, e, a, b, 28)
87
- ROUND1(b, c, d, e, a, 29)
88
- ROUND1(a, b, c, d, e, 30)
89
- ROUND1(e, a, b, c, d, 31)
90
- ROUND1(d, e, a, b, c, 32)
91
- ROUND1(c, d, e, a, b, 33)
92
- ROUND1(b, c, d, e, a, 34)
93
- ROUND1(a, b, c, d, e, 35)
94
- ROUND1(e, a, b, c, d, 36)
95
- ROUND1(d, e, a, b, c, 37)
96
- ROUND1(c, d, e, a, b, 38)
97
- ROUND1(b, c, d, e, a, 39)
98
- ROUND2(a, b, c, d, e, 40)
99
- ROUND2(e, a, b, c, d, 41)
100
- ROUND2(d, e, a, b, c, 42)
101
- ROUND2(c, d, e, a, b, 43)
102
- ROUND2(b, c, d, e, a, 44)
103
- ROUND2(a, b, c, d, e, 45)
104
- ROUND2(e, a, b, c, d, 46)
105
- ROUND2(d, e, a, b, c, 47)
106
- ROUND2(c, d, e, a, b, 48)
107
- ROUND2(b, c, d, e, a, 49)
108
- ROUND2(a, b, c, d, e, 50)
109
- ROUND2(e, a, b, c, d, 51)
110
- ROUND2(d, e, a, b, c, 52)
111
- ROUND2(c, d, e, a, b, 53)
112
- ROUND2(b, c, d, e, a, 54)
113
- ROUND2(a, b, c, d, e, 55)
114
- ROUND2(e, a, b, c, d, 56)
115
- ROUND2(d, e, a, b, c, 57)
116
- ROUND2(c, d, e, a, b, 58)
117
- ROUND2(b, c, d, e, a, 59)
118
- ROUND3(a, b, c, d, e, 60)
119
- ROUND3(e, a, b, c, d, 61)
120
- ROUND3(d, e, a, b, c, 62)
121
- ROUND3(c, d, e, a, b, 63)
122
- ROUND3(b, c, d, e, a, 64)
123
- ROUND3(a, b, c, d, e, 65)
124
- ROUND3(e, a, b, c, d, 66)
125
- ROUND3(d, e, a, b, c, 67)
126
- ROUND3(c, d, e, a, b, 68)
127
- ROUND3(b, c, d, e, a, 69)
128
- ROUND3(a, b, c, d, e, 70)
129
- ROUND3(e, a, b, c, d, 71)
130
- ROUND3(d, e, a, b, c, 72)
131
- ROUND3(c, d, e, a, b, 73)
132
- ROUND3(b, c, d, e, a, 74)
133
- ROUND3(a, b, c, d, e, 75)
134
- ROUND3(e, a, b, c, d, 76)
135
- ROUND3(d, e, a, b, c, 77)
136
- ROUND3(c, d, e, a, b, 78)
137
- ROUND3(b, c, d, e, a, 79)
138
-
139
- state[0] += a;
140
- state[1] += b;
141
- state[2] += c;
142
- state[3] += d;
143
- state[4] += e;
144
- }
145
-
@@ -1,77 +0,0 @@
1
- #include <stdint.h>
2
- #include <stdio.h>
3
- #include <string.h>
4
-
5
- #define LUA_LIB
6
- #include "lua.h"
7
- #include "lauxlib.h"
8
-
9
- // Link this program with an external C or x86 compression function
10
- extern void sha256_compress(uint32_t state[8], const uint8_t block[64]);
11
-
12
- /* This function is implements the padding and blocking around the SHA2 compression function
13
- *
14
- * Copyright (c) 2014 Project Nayuki
15
- * http://www.nayuki.io/page/fast-sha2-hashes-in-x86-assembly
16
- */
17
- static void
18
- sha256_hash(const uint8_t *message, uint32_t len, uint32_t hash[8]) {
19
- hash[0] = UINT32_C(0x6A09E667);
20
- hash[1] = UINT32_C(0xBB67AE85);
21
- hash[2] = UINT32_C(0x3C6EF372);
22
- hash[3] = UINT32_C(0xA54FF53A);
23
- hash[4] = UINT32_C(0x510E527F);
24
- hash[5] = UINT32_C(0x9B05688C);
25
- hash[6] = UINT32_C(0x1F83D9AB);
26
- hash[7] = UINT32_C(0x5BE0CD19);
27
-
28
- uint32_t i;
29
- for (i = 0; len - i >= 64; i += 64)
30
- sha256_compress(hash, message + i);
31
-
32
- uint8_t block[64];
33
- uint32_t rem = len - i;
34
- memcpy(block, message + i, rem);
35
-
36
- block[rem] = 0x80;
37
- rem++;
38
- if (64 - rem >= 8)
39
- memset(block + rem, 0, 56 - rem);
40
- else {
41
- memset(block + rem, 0, 64 - rem);
42
- sha256_compress(hash, block);
43
- memset(block, 0, 56);
44
- }
45
-
46
- uint64_t longLen = ((uint64_t)len) << 3;
47
- for (i = 0; i < 8; i++)
48
- block[64 - 1 - i] = (uint8_t)(longLen >> (i * 8));
49
- sha256_compress(hash, block);
50
- }
51
-
52
- /* Immunio Lua bindings */
53
-
54
- static int
55
- lua_sha256(lua_State *L) {
56
- uint32_t hash[8] = {};
57
- char buf[65];
58
- size_t slen = 0;
59
-
60
- const char *input = luaL_checklstring(L, 1, &slen);
61
- sha256_hash(input, slen, hash);
62
- sprintf(buf, "%08x%08x%08x%08x%08x%08x%08x%08x", hash[0], hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7]);
63
- lua_pushlstring(L, buf, 64);
64
- return 1;
65
- }
66
-
67
- static const luaL_Reg libsha256[] = {
68
- {"sha256", lua_sha256},
69
- {NULL, NULL}
70
- };
71
-
72
- int
73
- luaopen_sha256(lua_State *L) {
74
- // luaL_checkversion(L);
75
- luaL_register(L, "sha2", libsha256);
76
- return 1;
77
- }
@@ -1,5 +0,0 @@
1
- SRC += \
2
- ext/sha2/luasha256.c
3
-
4
- SPECIAL_SRC += \
5
- ext/sha2/sha256.c
@@ -1,196 +0,0 @@
1
- /*
2
- * SHA-256 hash in C
3
- *
4
- * Copyright (c) 2014 Project Nayuki
5
- * http://www.nayuki.io/page/fast-sha2-hashes-in-x86-assembly
6
- *
7
- * (MIT License)
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
9
- * this software and associated documentation files (the "Software"), to deal in
10
- * the Software without restriction, including without limitation the rights to
11
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
12
- * the Software, and to permit persons to whom the Software is furnished to do so,
13
- * subject to the following conditions:
14
- * - The above copyright notice and this permission notice shall be included in
15
- * all copies or substantial portions of the Software.
16
- * - The Software is provided "as is", without warranty of any kind, express or
17
- * implied, including but not limited to the warranties of merchantability,
18
- * fitness for a particular purpose and noninfringement. In no event shall the
19
- * authors or copyright holders be liable for any claim, damages or other
20
- * liability, whether in an action of contract, tort or otherwise, arising from,
21
- * out of or in connection with the Software or the use or other dealings in the
22
- * Software.
23
- */
24
-
25
- #include <stdint.h>
26
-
27
-
28
- void sha256_compress(uint32_t state[8], const uint8_t block[64]) {
29
- // 32-bit right rotation
30
- #define ROR(x, i) \
31
- (((x) << (32 - (i))) | ((x) >> (i)))
32
-
33
- #define LOADSCHEDULE(i) \
34
- schedule[i] = \
35
- (uint32_t)block[i * 4 + 0] << 24 \
36
- | (uint32_t)block[i * 4 + 1] << 16 \
37
- | (uint32_t)block[i * 4 + 2] << 8 \
38
- | (uint32_t)block[i * 4 + 3];
39
-
40
- #define SCHEDULE(i) \
41
- schedule[i] = schedule[i - 16] + schedule[i - 7] \
42
- + (ROR(schedule[i - 15], 7) ^ ROR(schedule[i - 15], 18) ^ (schedule[i - 15] >> 3)) \
43
- + (ROR(schedule[i - 2], 17) ^ ROR(schedule[i - 2], 19) ^ (schedule[i - 2] >> 10));
44
-
45
- #define ROUND(a, b, c, d, e, f, g, h, i, k) \
46
- h += (ROR(e, 6) ^ ROR(e, 11) ^ ROR(e, 25)) + (g ^ (e & (f ^ g))) + UINT32_C(k) + schedule[i]; \
47
- d += h; \
48
- h += (ROR(a, 2) ^ ROR(a, 13) ^ ROR(a, 22)) + ((a & (b | c)) | (b & c));
49
-
50
- uint32_t schedule[64];
51
- LOADSCHEDULE( 0)
52
- LOADSCHEDULE( 1)
53
- LOADSCHEDULE( 2)
54
- LOADSCHEDULE( 3)
55
- LOADSCHEDULE( 4)
56
- LOADSCHEDULE( 5)
57
- LOADSCHEDULE( 6)
58
- LOADSCHEDULE( 7)
59
- LOADSCHEDULE( 8)
60
- LOADSCHEDULE( 9)
61
- LOADSCHEDULE(10)
62
- LOADSCHEDULE(11)
63
- LOADSCHEDULE(12)
64
- LOADSCHEDULE(13)
65
- LOADSCHEDULE(14)
66
- LOADSCHEDULE(15)
67
- SCHEDULE(16)
68
- SCHEDULE(17)
69
- SCHEDULE(18)
70
- SCHEDULE(19)
71
- SCHEDULE(20)
72
- SCHEDULE(21)
73
- SCHEDULE(22)
74
- SCHEDULE(23)
75
- SCHEDULE(24)
76
- SCHEDULE(25)
77
- SCHEDULE(26)
78
- SCHEDULE(27)
79
- SCHEDULE(28)
80
- SCHEDULE(29)
81
- SCHEDULE(30)
82
- SCHEDULE(31)
83
- SCHEDULE(32)
84
- SCHEDULE(33)
85
- SCHEDULE(34)
86
- SCHEDULE(35)
87
- SCHEDULE(36)
88
- SCHEDULE(37)
89
- SCHEDULE(38)
90
- SCHEDULE(39)
91
- SCHEDULE(40)
92
- SCHEDULE(41)
93
- SCHEDULE(42)
94
- SCHEDULE(43)
95
- SCHEDULE(44)
96
- SCHEDULE(45)
97
- SCHEDULE(46)
98
- SCHEDULE(47)
99
- SCHEDULE(48)
100
- SCHEDULE(49)
101
- SCHEDULE(50)
102
- SCHEDULE(51)
103
- SCHEDULE(52)
104
- SCHEDULE(53)
105
- SCHEDULE(54)
106
- SCHEDULE(55)
107
- SCHEDULE(56)
108
- SCHEDULE(57)
109
- SCHEDULE(58)
110
- SCHEDULE(59)
111
- SCHEDULE(60)
112
- SCHEDULE(61)
113
- SCHEDULE(62)
114
- SCHEDULE(63)
115
-
116
- uint32_t a = state[0];
117
- uint32_t b = state[1];
118
- uint32_t c = state[2];
119
- uint32_t d = state[3];
120
- uint32_t e = state[4];
121
- uint32_t f = state[5];
122
- uint32_t g = state[6];
123
- uint32_t h = state[7];
124
- ROUND(a, b, c, d, e, f, g, h, 0, 0x428A2F98)
125
- ROUND(h, a, b, c, d, e, f, g, 1, 0x71374491)
126
- ROUND(g, h, a, b, c, d, e, f, 2, 0xB5C0FBCF)
127
- ROUND(f, g, h, a, b, c, d, e, 3, 0xE9B5DBA5)
128
- ROUND(e, f, g, h, a, b, c, d, 4, 0x3956C25B)
129
- ROUND(d, e, f, g, h, a, b, c, 5, 0x59F111F1)
130
- ROUND(c, d, e, f, g, h, a, b, 6, 0x923F82A4)
131
- ROUND(b, c, d, e, f, g, h, a, 7, 0xAB1C5ED5)
132
- ROUND(a, b, c, d, e, f, g, h, 8, 0xD807AA98)
133
- ROUND(h, a, b, c, d, e, f, g, 9, 0x12835B01)
134
- ROUND(g, h, a, b, c, d, e, f, 10, 0x243185BE)
135
- ROUND(f, g, h, a, b, c, d, e, 11, 0x550C7DC3)
136
- ROUND(e, f, g, h, a, b, c, d, 12, 0x72BE5D74)
137
- ROUND(d, e, f, g, h, a, b, c, 13, 0x80DEB1FE)
138
- ROUND(c, d, e, f, g, h, a, b, 14, 0x9BDC06A7)
139
- ROUND(b, c, d, e, f, g, h, a, 15, 0xC19BF174)
140
- ROUND(a, b, c, d, e, f, g, h, 16, 0xE49B69C1)
141
- ROUND(h, a, b, c, d, e, f, g, 17, 0xEFBE4786)
142
- ROUND(g, h, a, b, c, d, e, f, 18, 0x0FC19DC6)
143
- ROUND(f, g, h, a, b, c, d, e, 19, 0x240CA1CC)
144
- ROUND(e, f, g, h, a, b, c, d, 20, 0x2DE92C6F)
145
- ROUND(d, e, f, g, h, a, b, c, 21, 0x4A7484AA)
146
- ROUND(c, d, e, f, g, h, a, b, 22, 0x5CB0A9DC)
147
- ROUND(b, c, d, e, f, g, h, a, 23, 0x76F988DA)
148
- ROUND(a, b, c, d, e, f, g, h, 24, 0x983E5152)
149
- ROUND(h, a, b, c, d, e, f, g, 25, 0xA831C66D)
150
- ROUND(g, h, a, b, c, d, e, f, 26, 0xB00327C8)
151
- ROUND(f, g, h, a, b, c, d, e, 27, 0xBF597FC7)
152
- ROUND(e, f, g, h, a, b, c, d, 28, 0xC6E00BF3)
153
- ROUND(d, e, f, g, h, a, b, c, 29, 0xD5A79147)
154
- ROUND(c, d, e, f, g, h, a, b, 30, 0x06CA6351)
155
- ROUND(b, c, d, e, f, g, h, a, 31, 0x14292967)
156
- ROUND(a, b, c, d, e, f, g, h, 32, 0x27B70A85)
157
- ROUND(h, a, b, c, d, e, f, g, 33, 0x2E1B2138)
158
- ROUND(g, h, a, b, c, d, e, f, 34, 0x4D2C6DFC)
159
- ROUND(f, g, h, a, b, c, d, e, 35, 0x53380D13)
160
- ROUND(e, f, g, h, a, b, c, d, 36, 0x650A7354)
161
- ROUND(d, e, f, g, h, a, b, c, 37, 0x766A0ABB)
162
- ROUND(c, d, e, f, g, h, a, b, 38, 0x81C2C92E)
163
- ROUND(b, c, d, e, f, g, h, a, 39, 0x92722C85)
164
- ROUND(a, b, c, d, e, f, g, h, 40, 0xA2BFE8A1)
165
- ROUND(h, a, b, c, d, e, f, g, 41, 0xA81A664B)
166
- ROUND(g, h, a, b, c, d, e, f, 42, 0xC24B8B70)
167
- ROUND(f, g, h, a, b, c, d, e, 43, 0xC76C51A3)
168
- ROUND(e, f, g, h, a, b, c, d, 44, 0xD192E819)
169
- ROUND(d, e, f, g, h, a, b, c, 45, 0xD6990624)
170
- ROUND(c, d, e, f, g, h, a, b, 46, 0xF40E3585)
171
- ROUND(b, c, d, e, f, g, h, a, 47, 0x106AA070)
172
- ROUND(a, b, c, d, e, f, g, h, 48, 0x19A4C116)
173
- ROUND(h, a, b, c, d, e, f, g, 49, 0x1E376C08)
174
- ROUND(g, h, a, b, c, d, e, f, 50, 0x2748774C)
175
- ROUND(f, g, h, a, b, c, d, e, 51, 0x34B0BCB5)
176
- ROUND(e, f, g, h, a, b, c, d, 52, 0x391C0CB3)
177
- ROUND(d, e, f, g, h, a, b, c, 53, 0x4ED8AA4A)
178
- ROUND(c, d, e, f, g, h, a, b, 54, 0x5B9CCA4F)
179
- ROUND(b, c, d, e, f, g, h, a, 55, 0x682E6FF3)
180
- ROUND(a, b, c, d, e, f, g, h, 56, 0x748F82EE)
181
- ROUND(h, a, b, c, d, e, f, g, 57, 0x78A5636F)
182
- ROUND(g, h, a, b, c, d, e, f, 58, 0x84C87814)
183
- ROUND(f, g, h, a, b, c, d, e, 59, 0x8CC70208)
184
- ROUND(e, f, g, h, a, b, c, d, 60, 0x90BEFFFA)
185
- ROUND(d, e, f, g, h, a, b, c, 61, 0xA4506CEB)
186
- ROUND(c, d, e, f, g, h, a, b, 62, 0xBEF9A3F7)
187
- ROUND(b, c, d, e, f, g, h, a, 63, 0xC67178F2)
188
- state[0] += a;
189
- state[1] += b;
190
- state[2] += c;
191
- state[3] += d;
192
- state[4] += e;
193
- state[5] += f;
194
- state[6] += g;
195
- state[7] += h;
196
- }
@@ -1,56 +0,0 @@
1
- #define LUA_LIB
2
- #include <lua.h>
3
- #include <lauxlib.h>
4
-
5
- #ifdef _WIN32
6
- #define WIN32_LEAN_AND_MEAN
7
- #include <windows.h>
8
- #else
9
- #include <sys/utsname.h>
10
- #endif /* _WIN32 */
11
-
12
- static int lua_uname(lua_State *L)
13
- {
14
- #ifdef _WIN32
15
- const char *name;
16
- SYSTEM_INFO info;
17
- lua_pushliteral(L, "Windows");
18
- name = getenv("COMPUTERNAME");
19
- lua_pushstring(L, name ? name : "");
20
- memset(&info, 0, sizeof(info));
21
- GetSystemInfo(&info);
22
- if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
23
- lua_pushliteral(L, "AMD64");
24
- else if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
25
- lua_pushliteral(L, "X86");
26
- else if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM)
27
- lua_pushliteral(L, "ARM");
28
- else if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
29
- lua_pushliteral(L, "IA64");
30
- else if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
31
- lua_pushstring(L, "");
32
- return 3;
33
- #else
34
- struct utsname info;
35
- if (uname(&info) >= 0)
36
- {
37
- lua_pushstring(L, info.sysname);
38
- lua_pushstring(L, info.nodename);
39
- lua_pushstring(L, info.machine);
40
- return 3;
41
- }
42
- lua_pushstring(L, "Unknown");
43
- return 1;
44
- #endif
45
- }
46
-
47
- static const luaL_Reg sys_utils[] = {
48
- {"uname", lua_uname},
49
- {NULL, NULL}
50
- };
51
-
52
- int luaopen_sysutils(lua_State *L) {
53
- // luaL_checkversion(L);
54
- luaL_register(L, "sysutils", sys_utils);
55
- return 1;
56
- }