Default.js 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. import FlowControl from "../../FlowControl.js";
  2. import Arithmetic from "../../operations/Arithmetic.js";
  3. import Base from "../../operations/Base.js";
  4. import Base58 from "../../operations/Base58.js";
  5. import Base64 from "../../operations/Base64.js";
  6. import BCD from "../../operations/BCD.js";
  7. import BitwiseOp from "../../operations/BitwiseOp.js";
  8. import ByteRepr from "../../operations/ByteRepr.js";
  9. import Convert from "../../operations/Convert.js";
  10. import DateTime from "../../operations/DateTime.js";
  11. import Endian from "../../operations/Endian.js";
  12. import Entropy from "../../operations/Entropy.js";
  13. import Filetime from "../../operations/Filetime.js";
  14. import FileType from "../../operations/FileType.js";
  15. import Hexdump from "../../operations/Hexdump.js";
  16. import HTML from "../../operations/HTML.js";
  17. import MAC from "../../operations/MAC.js";
  18. import MorseCode from "../../operations/MorseCode.js";
  19. import MS from "../../operations/MS.js";
  20. import NetBIOS from "../../operations/NetBIOS.js";
  21. import Numberwang from "../../operations/Numberwang.js";
  22. import OS from "../../operations/OS.js";
  23. import OTP from "../../operations/OTP.js";
  24. import PHP from "../../operations/PHP.js";
  25. import QuotedPrintable from "../../operations/QuotedPrintable.js";
  26. import Rotate from "../../operations/Rotate.js";
  27. import SeqUtils from "../../operations/SeqUtils.js";
  28. import StrUtils from "../../operations/StrUtils.js";
  29. import Tidy from "../../operations/Tidy.js";
  30. import Unicode from "../../operations/Unicode.js";
  31. import UUID from "../../operations/UUID.js";
  32. /**
  33. * Default module.
  34. *
  35. * The Default module is for operations that are expected to be very commonly used or
  36. * do not require any libraries. This module is loaded into the app at compile time.
  37. *
  38. * Libraries:
  39. * - Utils.js
  40. * - otp
  41. * - crypto
  42. * - bignumber.js
  43. *
  44. * @author n1474335 [n1474335@gmail.com]
  45. * @copyright Crown Copyright 2017
  46. * @license Apache-2.0
  47. */
  48. let OpModules = typeof self === "undefined" ? {} : self.OpModules || {};
  49. OpModules.Default = {
  50. "To Hexdump": Hexdump.runTo,
  51. "From Hexdump": Hexdump.runFrom,
  52. "To Hex": ByteRepr.runToHex,
  53. "From Hex": ByteRepr.runFromHex,
  54. "To Octal": ByteRepr.runToOct,
  55. "From Octal": ByteRepr.runFromOct,
  56. "To Charcode": ByteRepr.runToCharcode,
  57. "From Charcode": ByteRepr.runFromCharcode,
  58. "To Decimal": ByteRepr.runToDecimal,
  59. "From Decimal": ByteRepr.runFromDecimal,
  60. "To Binary": ByteRepr.runToBinary,
  61. "From Binary": ByteRepr.runFromBinary,
  62. "To Hex Content": ByteRepr.runToHexContent,
  63. "From Hex Content": ByteRepr.runFromHexContent,
  64. "To Base64": Base64.runTo,
  65. "From Base64": Base64.runFrom,
  66. "Show Base64 offsets": Base64.runOffsets,
  67. "To Base32": Base64.runTo32,
  68. "From Base32": Base64.runFrom32,
  69. "To Base58": Base58.runTo,
  70. "From Base58": Base58.runFrom,
  71. "To Base": Base.runTo,
  72. "From Base": Base.runFrom,
  73. "To BCD": BCD.runToBCD,
  74. "From BCD": BCD.runFromBCD,
  75. "To HTML Entity": HTML.runToEntity,
  76. "From HTML Entity": HTML.runFromEntity,
  77. "Strip HTML tags": HTML.runStripTags,
  78. "Parse colour code": HTML.runParseColourCode,
  79. "Unescape Unicode Characters": Unicode.runUnescape,
  80. "To Quoted Printable": QuotedPrintable.runTo,
  81. "From Quoted Printable": QuotedPrintable.runFrom,
  82. "Swap endianness": Endian.runSwapEndianness,
  83. "ROT13": Rotate.runRot13,
  84. "ROT47": Rotate.runRot47,
  85. "Rotate left": Rotate.runRotl,
  86. "Rotate right": Rotate.runRotr,
  87. "Bit shift left": BitwiseOp.runBitShiftLeft,
  88. "Bit shift right": BitwiseOp.runBitShiftRight,
  89. "XOR": BitwiseOp.runXor,
  90. "XOR Brute Force": BitwiseOp.runXorBrute,
  91. "OR": BitwiseOp.runXor,
  92. "NOT": BitwiseOp.runNot,
  93. "AND": BitwiseOp.runAnd,
  94. "ADD": BitwiseOp.runAdd,
  95. "SUB": BitwiseOp.runSub,
  96. "To Morse Code": MorseCode.runTo,
  97. "From Morse Code": MorseCode.runFrom,
  98. "Format MAC addresses": MAC.runFormat,
  99. "Encode NetBIOS Name": NetBIOS.runEncodeName,
  100. "Decode NetBIOS Name": NetBIOS.runDecodeName,
  101. "Offset checker": StrUtils.runOffsetChecker,
  102. "To Upper case": StrUtils.runUpper,
  103. "To Lower case": StrUtils.runLower,
  104. "Split": StrUtils.runSplit,
  105. "Filter": StrUtils.runFilter,
  106. "Escape string": StrUtils.runEscape,
  107. "Unescape string": StrUtils.runUnescape,
  108. "Head": StrUtils.runHead,
  109. "Tail": StrUtils.runTail,
  110. "Hamming Distance": StrUtils.runHamming,
  111. "Remove whitespace": Tidy.runRemoveWhitespace,
  112. "Remove null bytes": Tidy.runRemoveNulls,
  113. "Drop bytes": Tidy.runDropBytes,
  114. "Take bytes": Tidy.runTakeBytes,
  115. "Pad lines": Tidy.runPad,
  116. "Reverse": SeqUtils.runReverse,
  117. "Sort": SeqUtils.runSort,
  118. "Unique": SeqUtils.runUnique,
  119. "Count occurrences": SeqUtils.runCount,
  120. "Add line numbers": SeqUtils.runAddLineNumbers,
  121. "Remove line numbers": SeqUtils.runRemoveLineNumbers,
  122. "Expand alphabet range": SeqUtils.runExpandAlphRange,
  123. "Convert distance": Convert.runDistance,
  124. "Convert area": Convert.runArea,
  125. "Convert mass": Convert.runMass,
  126. "Convert speed": Convert.runSpeed,
  127. "Convert data units": Convert.runDataSize,
  128. "Parse UNIX file permissions": OS.runParseUnixPerms,
  129. "Parse DateTime": DateTime.runParse,
  130. "Translate DateTime Format": DateTime.runTranslateFormat,
  131. "From UNIX Timestamp": DateTime.runFromUnixTimestamp,
  132. "To UNIX Timestamp": DateTime.runToUnixTimestamp,
  133. "Sleep": DateTime.runSleep,
  134. "Microsoft Script Decoder": MS.runDecodeScript,
  135. "Entropy": Entropy.runEntropy,
  136. "Frequency distribution": Entropy.runFreqDistrib,
  137. "Chi Square": Entropy.runChiSq,
  138. "Detect File Type": FileType.runDetect,
  139. "Scan for Embedded Files": FileType.runScanForEmbeddedFiles,
  140. "Generate UUID": UUID.runGenerateV4,
  141. "Numberwang": Numberwang.run,
  142. "Generate TOTP": OTP.runTOTP,
  143. "Generate HOTP": OTP.runHOTP,
  144. "Fork": FlowControl.runFork,
  145. "Merge": FlowControl.runMerge,
  146. "Register": FlowControl.runRegister,
  147. "Label": FlowControl.runComment,
  148. "Jump": FlowControl.runJump,
  149. "Conditional Jump": FlowControl.runCondJump,
  150. "Return": FlowControl.runReturn,
  151. "Comment": FlowControl.runComment,
  152. "PHP Deserialize": PHP.runDeserialize,
  153. "Sum": Arithmetic.runSum,
  154. "Subtract": Arithmetic.runSub,
  155. "Multiply": Arithmetic.runMulti,
  156. "Divide": Arithmetic.runDiv,
  157. "Mean": Arithmetic.runMean,
  158. "Median": Arithmetic.runMedian,
  159. "Standard Deviation": Arithmetic.runStdDev,
  160. "Windows Filetime to UNIX Timestamp": Filetime.runFromFiletimeToUnix,
  161. "UNIX Timestamp to Windows Filetime": Filetime.runToFiletimeFromUnix,
  162. /*
  163. Highlighting functions.
  164. This is a temporary solution as highlighting should be entirely
  165. overhauled at some point.
  166. */
  167. "From Base64-highlight": Base64.highlightFrom,
  168. "From Base64-highlightReverse": Base64.highlightTo,
  169. "To Base64-highlight": Base64.highlightTo,
  170. "To Base64-highlightReverse": Base64.highlightFrom,
  171. "From Hex-highlight": ByteRepr.highlightFrom,
  172. "From Hex-highlightReverse": ByteRepr.highlightTo,
  173. "To Hex-highlight": ByteRepr.highlightTo,
  174. "To Hex-highlightReverse": ByteRepr.highlightFrom,
  175. "From Charcode-highlight": ByteRepr.highlightFrom,
  176. "From Charcode-highlightReverse": ByteRepr.highlightTo,
  177. "To Charcode-highlight": ByteRepr.highlightTo,
  178. "To Charcode-highlightReverse": ByteRepr.highlightFrom,
  179. "From Binary-highlight": ByteRepr.highlightFromBinary,
  180. "From Binary-highlightReverse": ByteRepr.highlightToBinary,
  181. "To Binary-highlight": ByteRepr.highlightToBinary,
  182. "To Binary-highlightReverse": ByteRepr.highlightFromBinary,
  183. "From Hexdump-highlight": Hexdump.highlightFrom,
  184. "From Hexdump-highlightReverse": Hexdump.highlightTo,
  185. "To Hexdump-highlight": Hexdump.highlightTo,
  186. "To Hexdump-highlightReverse": Hexdump.highlightFrom,
  187. };
  188. export default OpModules;