Default.js 8.4 KB

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