├── .gitattributes
├── .gitignore
├── README.md
└── SCReverser
├── Be.HexEditor
├── App.ico
├── Be.HexEditor.csproj
├── BitControl.cs
├── BitControl.de.resx
├── BitControl.designer.cs
├── BitControl.resx
├── BitInfo.cs
├── Core
│ ├── CoreUtil.cs
│ ├── FormEx.cs
│ ├── IScalingItem.cs
│ ├── MenuStripEx.cs
│ ├── ToolStripButtonEx.cs
│ ├── ToolStripEx.cs
│ ├── ToolStripMenuItemEx.cs
│ └── ToolStripSplitButtonEx.cs
├── FormAbout.cs
├── FormAbout.de.resx
├── FormAbout.it.resx
├── FormAbout.ja.resx
├── FormAbout.resx
├── FormAbout.ru.resx
├── FormAbout.zh-Hans.resx
├── FormFind.cs
├── FormFind.de.resx
├── FormFind.it.resx
├── FormFind.ja.resx
├── FormFind.resx
├── FormFind.ru.resx
├── FormFind.zh-Hans.resx
├── FormGoTo.cs
├── FormGoTo.de.resx
├── FormGoTo.it.resx
├── FormGoTo.ja.resx
├── FormGoTo.resx
├── FormGoTo.ru.resx
├── FormGoTo.zh-Hans.resx
├── FormHexEditor.Designer.cs
├── FormHexEditor.cs
├── FormHexEditor.de.resx
├── FormHexEditor.it.resx
├── FormHexEditor.ja.resx
├── FormHexEditor.resx
├── FormHexEditor.ru.resx
├── FormHexEditor.zh-Hans.resx
├── FormOptions.Designer.cs
├── FormOptions.cs
├── FormOptions.de.resx
├── FormOptions.it.resx
├── FormOptions.ja.resx
├── FormOptions.resx
├── FormOptions.ru.resx
├── FormOptions.zh-Hans.resx
├── Images
│ ├── 256ico.pdn
│ ├── CopyHS.png
│ ├── CutHS.png
│ ├── FindHS.png
│ ├── FindNextHS.png
│ ├── Logo.pdn
│ ├── Logo.png
│ ├── PasteHS.png
│ ├── openHS.png
│ └── saveHS.png
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── RecentFileHandler.Designer.cs
├── RecentFileHandler.cs
├── Resources
│ ├── Copy16.png
│ ├── Copy24.png
│ ├── Copy32.png
│ ├── Cut16.png
│ ├── Cut24.png
│ ├── Cut32.png
│ ├── Find16.png
│ ├── Find24.png
│ ├── Find32.png
│ ├── FindNext16.png
│ ├── FindNext24.png
│ ├── FindNext32.png
│ ├── FolderOpen_16.png
│ ├── FolderOpen_24.png
│ ├── FolderOpen_32.png
│ ├── Paste16.png
│ ├── Paste24.png
│ ├── Paste32.png
│ ├── Save24.png
│ ├── Save32.png
│ ├── ThanksTo.rtf
│ ├── folder_Open_32xLG.png
│ └── save16.png
├── ScalingImages.Designer.cs
├── ScalingImages.resx
├── UCAbout.cs
├── UCAbout.de.resx
├── UCAbout.it.resx
├── UCAbout.ja.resx
├── UCAbout.resx
├── UCAbout.zh-Hans.resx
├── Util.cs
├── W32.cs
├── app.config
├── app.manifest
├── images.Designer.cs
├── images.resx
├── img
│ ├── HexBox.bmp
│ ├── banner.JPG
│ ├── banner.bmp
│ └── logo.jpg
├── strings.Designer.cs
├── strings.de.resx
├── strings.it.resx
├── strings.ja.resx
├── strings.resx
├── strings.ru.resx
└── strings.zh-Hans.resx
├── Be.Windows.Forms.HexBox
├── AssemblyInfo.cs
├── Be.Windows.Forms.HexBox.csproj
├── Be.Windows.Forms.HexBox.xml
├── BuiltInContextMenu.cs
├── ByteCharConverters.cs
├── ByteCollection.cs
├── BytePositionInfo.cs
├── DataBlock.cs
├── DataMap.cs
├── DynamicByteProvider.cs
├── DynamicFileByteProvider.cs
├── FileByteProvider.cs
├── FileDataBlock.cs
├── FindOptions.cs
├── HexBox.bmp
├── HexBox.cs
├── HexBox.resx
├── HexCasing.cs
├── IByteProvider.cs
├── MemoryDataBlock.cs
├── NativeMethods.cs
├── Properties
│ ├── Resources.Designer.cs
│ └── Resources.resx
└── Util.cs
├── Resources
├── ImagesForReadme
│ ├── 2017-10-31 19_44_12-Open.png
│ ├── 2017-10-31 19_44_53-SCReverser.png
│ ├── 2017-10-31 19_45_13-SCReverser.png
│ ├── 2017-10-31 19_45_21-SCReverser.png
│ ├── 2017-10-31 19_45_26-SCReverser.png
│ └── 2017-10-31 19_46_34-SCReverser.png
├── NEOContracts.txt
├── SmartContractJumps.avm
├── SmartContractJumps.json
├── SmartContractSample.avm
├── SmartContractSample.json
└── protocol.testnet.json
├── SCReverser.Core
├── Attributes
│ └── OpCodeArgumentAttribute.cs
├── Collections
│ ├── InstructionCollection.cs
│ ├── KeyValueCollection.cs
│ ├── MethodCollection.cs
│ ├── ModuleCollection.cs
│ ├── OcurrenceCollection.cs
│ ├── OffsetRelationCache.cs
│ └── StackCollection.cs
├── Converters
│ └── UInt32HexTypeConverter.cs
├── Delegates
│ ├── OnCheckOcurrenceDelegate.cs
│ ├── OnInstructionDelegate.cs
│ ├── OnJumpDelegate.cs
│ ├── OnMethodDelegate.cs
│ ├── OnModuleDelegate.cs
│ ├── OnProgressDelegate.cs
│ └── OnStateChangedDelegate.cs
├── Enums
│ ├── DebuggerState.cs
│ ├── InstructionFlag.cs
│ ├── OffsetIndexRelation.cs
│ ├── OpCodeFlag.cs
│ ├── RowBorderStyle.cs
│ └── TemplateFlags.cs
├── Exceptions
│ └── OpCodeNotFoundException.cs
├── Extensions
│ └── ByteArrayExtensions.cs
├── FEditConfig.Designer.cs
├── FEditConfig.cs
├── FEditConfig.resx
├── Helpers
│ └── JsonHelper.cs
├── Interfaces
│ ├── DebuggerBase.cs
│ ├── FRememberForm.cs
│ ├── FRememberFormT.cs
│ ├── IDebugger.cs
│ ├── IInitClassStream.cs
│ ├── IRemember.cs
│ ├── IReverseTemplate.cs
│ ├── IReverser.cs
│ ├── IStartEnd.cs
│ ├── IWritable.cs
│ ├── ReverseTemplateT2.cs
│ ├── ReverseTemplateT3.cs
│ └── ReverserBase.cs
├── OpCodeArguments
│ ├── OpCodeByteArgument.cs
│ ├── OpCodeByteArrayArgument.cs
│ ├── OpCodeByteArrayFromByteArgument.cs
│ ├── OpCodeByteArrayFromIntArgument.cs
│ ├── OpCodeByteArrayFromUShortArgument.cs
│ ├── OpCodeCall_IArgument.cs
│ ├── OpCodeEmptyArgument.cs
│ ├── OpCodeIntArgument.cs
│ ├── OpCodeShortArgument.cs
│ ├── OpCodeShortArgumentBigEndian.cs
│ ├── OpCodeUShortArgument.cs
│ └── OpCodeUShortArgumentBigEndian.cs
├── Properties
│ └── AssemblyInfo.cs
├── Remembers
│ └── RememberForm.cs
├── SCReverser.Core.csproj
├── Types
│ ├── IndexOffset.cs
│ ├── Instruction.cs
│ ├── Jump.cs
│ ├── Method.cs
│ ├── Module.cs
│ ├── Ocurrence.cs
│ ├── OcurrenceParams.cs
│ ├── OpCode.cs
│ ├── ReverseResult.cs
│ ├── StackItem.cs
│ ├── StreamModule.cs
│ └── UnusableCodeChartParams.cs
└── packages.config
├── SCReverser.NEO
├── FOpen.Designer.cs
├── FOpen.cs
├── FOpen.resx
├── GlobalSuppressions.cs
├── Internals
│ ├── CachedScriptTable.cs
│ ├── EFake.cs
│ ├── ETriggerType.cs
│ ├── NeoEngine.cs
│ ├── NeoFakeDbCache.cs
│ ├── NeoStackItem.cs
│ └── NullBlockChain.cs
├── NeoConfig.cs
├── NeoDebugger.cs
├── NeoOpCode.cs
├── NeoReverser.cs
├── NeoTemplate.cs
├── OpCodeArguments
│ └── OpCodeVarByteArrayArgument.cs
├── Properties
│ └── AssemblyInfo.cs
├── Res.Designer.cs
├── Res.resx
├── Resources
│ └── Logo.png
├── SCReverser.NEO.csproj
├── app.config
└── packages.config
├── SCReverser.Tests
├── NEO.cs
├── Properties
│ └── AssemblyInfo.cs
├── SCReverser.Tests.csproj
├── app.config
└── packages.config
├── SCReverser.sln
└── SCReverser
├── App.config
├── Controls
├── UCOcurrence.Designer.cs
├── UCOcurrence.cs
├── UCOcurrence.resx
├── UCPJump.cs
├── UStacks.Designer.cs
├── UStacks.cs
└── UStacks.resx
├── FMain.Designer.cs
├── FMain.cs
├── FMain.resx
├── FMainBase.cs
├── GlobalSuppressions.cs
├── Program.cs
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
├── Red4SecLoco.ico
├── RemMain.cs
├── Res.Designer.cs
├── Res.resx
├── Resources
├── AddFileIcon.png
├── ConfigIcon.png
├── Format.png
├── Into.png
├── OpenIcon.png
├── Out.png
├── Over.png
├── PlayIcon.png
├── SaveIcon.png
└── Stop.png
└── SCReverser.csproj
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SCReverser - Reverse engineer for Smart Contracts
2 |
3 | SCReverser allows you to perform debugging and reverse engineering on smart contracts.
4 |
5 | Contains a plugin through which you can read NEO smart contracts
6 |
7 | It is possible to open:
8 | - Contract addresses
9 | - Hexadecimal values
10 | - Values in Base64
11 | - Files
12 |
13 | 
14 |
15 | It is possible to see the value in hexadecimal and a tree of the methods found
16 |
17 | 
18 |
19 | Extracts strings statistics
20 |
21 | 
22 |
23 | Extracts OpCode statistics
24 |
25 | 
26 |
27 | Extracts SysCalls statistics
28 |
29 | 
30 |
31 | And much more!
32 |
33 | Uses the real chain of blocks for debugging!
34 |
35 | 
36 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/App.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/App.ico
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/BitControl.designer.cs:
--------------------------------------------------------------------------------
1 | namespace Be.HexEditor
2 | {
3 | partial class BitControl
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BitControl));
32 | this.lblValue = new System.Windows.Forms.Label();
33 | this.lblBit = new System.Windows.Forms.Label();
34 | this.pnBitsEditor = new System.Windows.Forms.Panel();
35 | this.pnBitsHeader = new System.Windows.Forms.Panel();
36 | this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
37 | this.flowLayoutPanel.SuspendLayout();
38 | this.SuspendLayout();
39 | //
40 | // lblValue
41 | //
42 | resources.ApplyResources(this.lblValue, "lblValue");
43 | this.lblValue.Name = "lblValue";
44 | //
45 | // lblBit
46 | //
47 | resources.ApplyResources(this.lblBit, "lblBit");
48 | this.lblBit.Name = "lblBit";
49 | //
50 | // pnBitsEditor
51 | //
52 | resources.ApplyResources(this.pnBitsEditor, "pnBitsEditor");
53 | this.pnBitsEditor.Name = "pnBitsEditor";
54 | //
55 | // pnBitsHeader
56 | //
57 | resources.ApplyResources(this.pnBitsHeader, "pnBitsHeader");
58 | this.flowLayoutPanel.SetFlowBreak(this.pnBitsHeader, true);
59 | this.pnBitsHeader.Name = "pnBitsHeader";
60 | //
61 | // flowLayoutPanel
62 | //
63 | this.flowLayoutPanel.Controls.Add(this.lblBit);
64 | this.flowLayoutPanel.Controls.Add(this.pnBitsHeader);
65 | this.flowLayoutPanel.Controls.Add(this.lblValue);
66 | this.flowLayoutPanel.Controls.Add(this.pnBitsEditor);
67 | resources.ApplyResources(this.flowLayoutPanel, "flowLayoutPanel");
68 | this.flowLayoutPanel.Name = "flowLayoutPanel";
69 | //
70 | // BitControl
71 | //
72 | resources.ApplyResources(this, "$this");
73 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
74 | this.Controls.Add(this.flowLayoutPanel);
75 | this.Name = "BitControl";
76 | this.flowLayoutPanel.ResumeLayout(false);
77 | this.flowLayoutPanel.PerformLayout();
78 | this.ResumeLayout(false);
79 |
80 | }
81 |
82 | #endregion
83 |
84 | private System.Windows.Forms.Label lblValue;
85 | private System.Windows.Forms.Label lblBit;
86 | private System.Windows.Forms.Panel pnBitsEditor;
87 | private System.Windows.Forms.Panel pnBitsHeader;
88 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel;
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/BitInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections;
5 |
6 | namespace Be.HexEditor
7 | {
8 | public class BitInfo
9 | {
10 | private byte _value;
11 |
12 | public byte Value
13 | {
14 | get { return _value; }
15 | set { _value = value; }
16 | }
17 |
18 | public long Position { get; set; }
19 |
20 | public BitInfo(byte value, long position)
21 | {
22 | _value = value;
23 | Position = position;
24 | }
25 |
26 | public override string ToString()
27 | {
28 | var result = string.Format("{0}{1}{2}{3}{4}{5}{6}{7}"
29 | , GetBitAsString(7)
30 | , GetBitAsString(6)
31 | , GetBitAsString(5)
32 | , GetBitAsString(4)
33 | , GetBitAsString(3)
34 | , GetBitAsString(2)
35 | , GetBitAsString(1)
36 | , GetBitAsString(0)
37 | );
38 | return result;
39 | }
40 |
41 | public string GetBitAsString(int index)
42 | {
43 | if (this[index])
44 | return "1";
45 | else
46 | return "0";
47 | }
48 |
49 | public bool this[int index]
50 | {
51 | get
52 | {
53 | return (_value & (1 << index)) != 0;
54 | }
55 | set
56 | {
57 | if (value)
58 | _value |= (byte)(1 << index); //set bit index 1
59 | else
60 | _value &= (byte)(~(1 << index)); //set bit index 0
61 | }
62 | }
63 |
64 | byte ConvertToByte(BitArray bits)
65 | {
66 | if (bits.Count != 8)
67 | {
68 | throw new ArgumentException("bits");
69 | }
70 | byte[] bytes = new byte[1];
71 | bits.CopyTo(bytes, 0);
72 | return bytes[0];
73 | }
74 |
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Core/CoreUtil.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Windows.Forms;
7 |
8 | namespace Be.HexEditor.Core
9 | {
10 | public static class CoreUtil
11 | {
12 | public static void ScaleFont(Control control, float factor)
13 | {
14 | control.Font = new Font(control.Font.FontFamily,
15 | control.Font.Size * factor,
16 | control.Font.Style);
17 | }
18 |
19 | public static void AdjustImages(ToolStrip toolStrip, ref float dpiOld, float dpiNew)
20 | {
21 | if (Util.DesignMode) return;
22 |
23 | //var newDpi = _form.DpiNew;
24 | var factor = dpiNew / dpiOld;
25 |
26 | //MessageBox.Show(factor.ToString());
27 |
28 | if ((dpiNew == 0) || (dpiOld == dpiNew)) return; // Abort.
29 |
30 | //float factor = _form.DpiNew / _dpiOld;
31 |
32 | dpiOld = dpiNew;
33 |
34 | //MessageBox.Show(factor.ToString());
35 |
36 | toolStrip.ImageScalingSize = new System.Drawing.Size((int)(toolStrip.ImageScalingSize.Width * factor), (int)(toolStrip.ImageScalingSize.Height * factor));
37 | //MessageBox.Show(toolStrip.ImageScalingSize.Width.ToString());
38 |
39 | var width = toolStrip.ImageScalingSize.Width;
40 |
41 | foreach (ToolStripItem item in toolStrip.Items)
42 | {
43 | var scalingItem = item as IScalingItem;
44 | if (scalingItem == null)
45 | continue;
46 |
47 | if (width < 17 && scalingItem.Image16 != null)
48 | item.Image = scalingItem.Image16;
49 | else if (width < 25 && scalingItem.Image24 != null)
50 | item.Image = scalingItem.Image24;
51 | else if (width < 33 && scalingItem.Image32 != null)
52 | item.Image = scalingItem.Image32;
53 | }
54 | }
55 |
56 | public static T GetParent(Control c) where T : Control
57 | {
58 | if (c == null)
59 | return default(T);
60 |
61 | var parent = c.Parent;
62 |
63 | var found = parent as T;
64 | if (found != null)
65 | return found;
66 |
67 | return GetParent(parent);
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Core/IScalingItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Be.HexEditor.Core
7 | {
8 | public interface IScalingItem
9 | {
10 | System.Drawing.Image Image16 { get; set; }
11 | System.Drawing.Image Image24 { get; set; }
12 | System.Drawing.Image Image32 { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Core/MenuStripEx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Forms;
6 |
7 | namespace Be.HexEditor.Core
8 | {
9 | public class MenuStripEx : MenuStrip
10 | {
11 | FormEx _form;
12 | float _dpiOld = 96F;
13 |
14 | public MenuStripEx()
15 | {
16 | }
17 |
18 | protected override void ScaleControl(System.Drawing.SizeF factor, BoundsSpecified specified)
19 | {
20 | base.ScaleControl(factor, specified);
21 | CoreUtil.AdjustImages(this, ref _dpiOld, _form.DpiNew);
22 | }
23 |
24 | protected override void OnParentChanged(EventArgs e)
25 | {
26 | base.OnParentChanged(e);
27 |
28 | EnableFormEvents();
29 | }
30 |
31 | protected override void OnHandleCreated(EventArgs e)
32 | {
33 | base.OnHandleCreated(e);
34 | EnableFormEvents();
35 | }
36 |
37 | protected override void OnHandleDestroyed(EventArgs e)
38 | {
39 | base.OnHandleDestroyed(e);
40 | EnableFormEvents();
41 | }
42 |
43 | void EnableFormEvents()
44 | {
45 | _form = CoreUtil.GetParent(this);
46 |
47 | if(_form != null)
48 | {
49 | CoreUtil.AdjustImages(this, ref _dpiOld, _form.DpiNew);
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Core/ToolStripButtonEx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Windows.Forms;
7 |
8 | namespace Be.HexEditor.Core
9 | {
10 | public class ToolStripButtonEx : ToolStripButton, Be.HexEditor.Core.IScalingItem
11 | {
12 | public ToolStripButtonEx()
13 | {
14 |
15 | }
16 |
17 | System.Drawing.Image _image16;
18 | [DefaultValue(null)]
19 | public System.Drawing.Image Image16
20 | {
21 | get { return _image16; }
22 | set { _image16 = value; }
23 | }
24 |
25 | System.Drawing.Image _image24;
26 | [DefaultValue(null)]
27 | public System.Drawing.Image Image24
28 | {
29 | get { return _image24; }
30 | set { _image24 = value; }
31 | }
32 |
33 | System.Drawing.Image _image32;
34 | [DefaultValue(null)]
35 | public System.Drawing.Image Image32
36 | {
37 | get { return _image32; }
38 | set { _image32 = value; }
39 | }
40 |
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Core/ToolStripEx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Forms;
6 |
7 | namespace Be.HexEditor.Core
8 | {
9 | public class ToolStripEx : ToolStrip
10 | {
11 | FormEx _form;
12 | float _dpiOld = 96F;
13 |
14 | public ToolStripEx()
15 | {
16 | }
17 |
18 | protected override void OnParentChanged(EventArgs e)
19 | {
20 | base.OnParentChanged(e);
21 |
22 | EnableFormEvents();
23 | }
24 |
25 | protected override void OnHandleCreated(EventArgs e)
26 | {
27 | base.OnHandleCreated(e);
28 | EnableFormEvents();
29 | }
30 |
31 | protected override void OnHandleDestroyed(EventArgs e)
32 | {
33 | base.OnHandleDestroyed(e);
34 | EnableFormEvents();
35 | }
36 |
37 | void EnableFormEvents()
38 | {
39 | _form = CoreUtil.GetParent(this);
40 |
41 | if(_form != null)
42 | {
43 | CoreUtil.AdjustImages(this, ref _dpiOld, _form.DpiNew);
44 | }
45 | }
46 |
47 | protected override void ScaleControl(System.Drawing.SizeF factor, BoundsSpecified specified)
48 | {
49 | base.ScaleControl(factor, specified);
50 | CoreUtil.AdjustImages(this, ref _dpiOld, _form.DpiNew);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Core/ToolStripMenuItemEx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Windows.Forms;
7 |
8 | namespace Be.HexEditor.Core
9 | {
10 | public class ToolStripMenuItemEx : ToolStripMenuItem, IScalingItem
11 | {
12 | System.Drawing.Image _image16;
13 | [DefaultValue(null)]
14 | public System.Drawing.Image Image16
15 | {
16 | get { return _image16; }
17 | set { _image16 = value; }
18 | }
19 |
20 | System.Drawing.Image _image24;
21 | [DefaultValue(null)]
22 | public System.Drawing.Image Image24
23 | {
24 | get { return _image24; }
25 | set { _image24 = value; }
26 | }
27 |
28 | System.Drawing.Image _image32;
29 | [DefaultValue(null)]
30 | public System.Drawing.Image Image32
31 | {
32 | get { return _image32; }
33 | set { _image32 = value; }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Core/ToolStripSplitButtonEx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Windows.Forms;
7 |
8 | namespace Be.HexEditor.Core
9 | {
10 | public class ToolStripSplitButtonEx : ToolStripSplitButton, IScalingItem
11 | {
12 | System.Drawing.Image _image16;
13 | [DefaultValue(null)]
14 | public System.Drawing.Image Image16
15 | {
16 | get { return _image16; }
17 | set { _image16 = value; }
18 | }
19 |
20 | System.Drawing.Image _image24;
21 | [DefaultValue(null)]
22 | public System.Drawing.Image Image24
23 | {
24 | get { return _image24; }
25 | set { _image24 = value; }
26 | }
27 |
28 | System.Drawing.Image _image32;
29 | [DefaultValue(null)]
30 | public System.Drawing.Image Image32
31 | {
32 | get { return _image32; }
33 | set { _image32 = value; }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/FormAbout.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Collections;
4 | using System.ComponentModel;
5 | using System.Windows.Forms;
6 |
7 | namespace Be.HexEditor
8 | {
9 | ///
10 | /// Summary description for FormAbout.
11 | ///
12 | public class FormAbout : Core.FormEx
13 | {
14 | private Be.HexEditor.UCAbout ucAbout1;
15 | private System.Windows.Forms.Button btnOK;
16 | ///
17 | /// Required designer variable.
18 | ///
19 | private System.ComponentModel.Container components = null;
20 |
21 | public FormAbout()
22 | {
23 | //
24 | // Required for Windows Form Designer support
25 | //
26 | InitializeComponent();
27 |
28 | //
29 | // TODO: Add any constructor code after InitializeComponent call
30 | //
31 |
32 | }
33 |
34 | ///
35 | /// Clean up any resources being used.
36 | ///
37 | protected override void Dispose(bool disposing)
38 | {
39 | if (disposing)
40 | {
41 | if (components != null)
42 | {
43 | components.Dispose();
44 | }
45 | }
46 | base.Dispose(disposing);
47 | }
48 |
49 | #region Windows Form Designer generated code
50 | ///
51 | /// Required method for Designer support - do not modify
52 | /// the contents of this method with the code editor.
53 | ///
54 | private void InitializeComponent()
55 | {
56 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormAbout));
57 | this.btnOK = new System.Windows.Forms.Button();
58 | this.ucAbout1 = new Be.HexEditor.UCAbout();
59 | this.SuspendLayout();
60 | //
61 | // btnOK
62 | //
63 | resources.ApplyResources(this.btnOK, "btnOK");
64 | this.btnOK.Name = "btnOK";
65 | this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
66 | //
67 | // ucAbout1
68 | //
69 | resources.ApplyResources(this.ucAbout1, "ucAbout1");
70 | this.ucAbout1.Name = "ucAbout1";
71 | //
72 | // FormAbout
73 | //
74 | this.AcceptButton = this.btnOK;
75 | resources.ApplyResources(this, "$this");
76 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
77 | this.BackColor = System.Drawing.SystemColors.Control;
78 | this.Controls.Add(this.btnOK);
79 | this.Controls.Add(this.ucAbout1);
80 | this.MaximizeBox = false;
81 | this.MinimizeBox = false;
82 | this.Name = "FormAbout";
83 | this.ShowIcon = false;
84 | this.ShowInTaskbar = false;
85 | this.Load += new System.EventHandler(this.FormAbout_CorrectWidth);
86 | this.Resize += new System.EventHandler(this.FormAbout_CorrectWidth);
87 | this.ResumeLayout(false);
88 |
89 | }
90 | #endregion
91 |
92 | private void btnOK_Click(object sender, System.EventArgs e)
93 | {
94 | Close();
95 | }
96 |
97 | private void FormAbout_CorrectWidth(object sender, EventArgs e)
98 | {
99 | //var factor = this.DpiNew / Core.FormEx.DpiAtDesign;
100 | //this.ucAbout1.Width = (int)((this.Width - 40) * factor);
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/FormHexEditor.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/FormHexEditor.cs
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/FormOptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Text;
7 | using System.Windows.Forms;
8 | using System.Globalization;
9 | using Be.HexEditor.Properties;
10 |
11 | namespace Be.HexEditor
12 | {
13 | public partial class FormOptions : Core.FormEx
14 | {
15 | int recentFilesMax;
16 |
17 | public int RecentFilesMax
18 | {
19 | get { return recentFilesMax; }
20 | set
21 | {
22 | if (recentFilesMax == value)
23 | return;
24 | if (value < 0 || value > RecentFileHandler.MaxRecentFiles)
25 | return;
26 |
27 | recentFilesMax = value;
28 | }
29 | }
30 |
31 |
32 | bool useSystemLanguage;
33 |
34 | public bool UseSystemLanguage
35 | {
36 | get { return useSystemLanguage; }
37 | set { useSystemLanguage = value; }
38 | }
39 |
40 | public FormOptions()
41 | {
42 | InitializeComponent();
43 |
44 | this.recentFilesMax = Settings.Default.RecentFilesMax;
45 | this.recentFilesMaxTextBox.DataBindings.Add("Text", this, "RecentFilesMax");
46 | this.useSystemLanguage = Settings.Default.UseSystemLanguage;
47 | this.useSystemLanguageCheckBox.DataBindings.Add("Checked", this, "UseSystemLanguage");
48 |
49 | if (string.IsNullOrEmpty(Settings.Default.SelectedLanguage))
50 | Settings.Default.SelectedLanguage = CultureInfo.CurrentCulture.TwoLetterISOLanguageName;
51 |
52 | DataTable dt = new DataTable();
53 | dt.Columns.Add("Name", typeof(string));
54 | dt.Columns.Add("Value", typeof(string));
55 | dt.Rows.Add(strings.English, "en");
56 | dt.Rows.Add(strings.German, "de");
57 | dt.Rows.Add(strings.Italian, "it");
58 | dt.Rows.Add(strings.Japanese, "ja");
59 | dt.Rows.Add(strings.Russian, "ru");
60 | dt.Rows.Add(strings.SimplifiedChinese, "zh-CN");
61 | dt.DefaultView.Sort = "Name";
62 |
63 | this.languageComboBox.DataSource = dt.DefaultView;
64 | this.languageComboBox.DisplayMember = "Name";
65 | this.languageComboBox.ValueMember = "Value";
66 | this.languageComboBox.SelectedValue = Settings.Default.SelectedLanguage;
67 | if (this.languageComboBox.SelectedIndex == -1)
68 | this.languageComboBox.SelectedIndex = 0;
69 | }
70 |
71 | void clearRecentFilesButton_Click(object sender, EventArgs e)
72 | {
73 | Program.ApplictionForm.RecentFileHandler.Clear();
74 | }
75 |
76 | void okButton_Click(object sender, EventArgs e)
77 | {
78 | bool changed = false;
79 | if (recentFilesMax != Settings.Default.RecentFilesMax)
80 | {
81 | Settings.Default.RecentFilesMax = recentFilesMax;
82 | changed = true;
83 | }
84 |
85 | if (Settings.Default.UseSystemLanguage != this.useSystemLanguage ||
86 | Settings.Default.SelectedLanguage != (string)this.languageComboBox.SelectedValue)
87 | {
88 | Settings.Default.UseSystemLanguage = this.UseSystemLanguage;
89 | Settings.Default.SelectedLanguage = (string)this.languageComboBox.SelectedValue;
90 |
91 | Program.ShowMessage(strings.ProgramRestartSettings);
92 |
93 | changed = true;
94 | }
95 |
96 | if(changed)
97 | Settings.Default.Save();
98 |
99 | this.DialogResult = DialogResult.OK;
100 | }
101 |
102 | void useSystemLanguageCheckBox_CheckedChanged(object sender, EventArgs e)
103 | {
104 | this.languageComboBox.Enabled = this.selectLanguageLabel.Enabled = !useSystemLanguageCheckBox.Checked;
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Images/256ico.pdn:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Images/256ico.pdn
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Images/CopyHS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Images/CopyHS.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Images/CutHS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Images/CutHS.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Images/FindHS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Images/FindHS.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Images/FindNextHS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Images/FindNextHS.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Images/Logo.pdn:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Images/Logo.pdn
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Images/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Images/Logo.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Images/PasteHS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Images/PasteHS.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Images/openHS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Images/openHS.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Images/saveHS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Images/saveHS.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using System.Threading;
4 | using System.Globalization;
5 | using Be.HexEditor.Properties;
6 | using Be.Windows.Forms;
7 |
8 | namespace Be.HexEditor
9 | {
10 | class Program
11 | {
12 | public const string SoftwareName = "Be.HexEditor";
13 |
14 | public static FormHexEditor ApplictionForm;
15 |
16 | [STAThread()]
17 | static void Main(string[] args)
18 | {
19 | if (!Settings.Default.UseSystemLanguage)
20 | {
21 | string l = Settings.Default.SelectedLanguage;
22 | Thread.CurrentThread.CurrentUICulture = new CultureInfo(l);
23 | Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(l);
24 | }
25 |
26 | Application.EnableVisualStyles();
27 | Application.SetCompatibleTextRenderingDefault(false);
28 |
29 | ApplictionForm = new FormHexEditor();
30 | if (args.Length > 0 && System.IO.File.Exists(args[0]))
31 | ApplictionForm.OpenFile(args[0]);
32 | Application.Run(ApplictionForm);
33 | }
34 |
35 | public static DialogResult ShowError(Exception ex)
36 | {
37 | return ShowError(ex.Message);
38 | }
39 |
40 |
41 | internal static DialogResult ShowError(string text)
42 | {
43 | DialogResult result = MessageBox.Show(text, SoftwareName,
44 | MessageBoxButtons.OK,
45 | MessageBoxIcon.Error);
46 | return result;
47 | }
48 |
49 | public static void ShowMessage(string text)
50 | {
51 | MessageBox.Show(text, SoftwareName,
52 | MessageBoxButtons.OK,
53 | MessageBoxIcon.Information);
54 | }
55 |
56 | public static DialogResult ShowQuestion(string text)
57 | {
58 | DialogResult result = MessageBox.Show(text, SoftwareName,
59 | MessageBoxButtons.YesNo,
60 | MessageBoxIcon.Question);
61 | return result;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using System.Resources;
5 |
6 | //
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | //
11 | [assembly: AssemblyTitle("Be.HexEditor")]
12 | [assembly: AssemblyDescription("View and edit files in hex format")]
13 | [assembly: AssemblyConfiguration("")]
14 | [assembly: AssemblyCompany("Be")]
15 | [assembly: AssemblyProduct("Be.HexEditor")]
16 | [assembly: AssemblyCopyright("")]
17 | [assembly: AssemblyTrademark("")]
18 | [assembly: AssemblyCulture("")]
19 |
20 | [assembly: AssemblyVersion("1.5.0.*")]
21 |
22 | [assembly: ComVisible(false)]
23 | [assembly: NeutralResourcesLanguage("en-US")]
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34003
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Be.HexEditor.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | public global::System.Collections.Specialized.StringCollection RecentFiles {
29 | get {
30 | return ((global::System.Collections.Specialized.StringCollection)(this["RecentFiles"]));
31 | }
32 | set {
33 | this["RecentFiles"] = value;
34 | }
35 | }
36 |
37 | [global::System.Configuration.UserScopedSettingAttribute()]
38 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
39 | [global::System.Configuration.DefaultSettingValueAttribute("6")]
40 | public int RecentFilesMax {
41 | get {
42 | return ((int)(this["RecentFilesMax"]));
43 | }
44 | set {
45 | this["RecentFilesMax"] = value;
46 | }
47 | }
48 |
49 | [global::System.Configuration.UserScopedSettingAttribute()]
50 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
51 | [global::System.Configuration.DefaultSettingValueAttribute("True")]
52 | public bool UseSystemLanguage {
53 | get {
54 | return ((bool)(this["UseSystemLanguage"]));
55 | }
56 | set {
57 | this["UseSystemLanguage"] = value;
58 | }
59 | }
60 |
61 | [global::System.Configuration.UserScopedSettingAttribute()]
62 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
63 | [global::System.Configuration.DefaultSettingValueAttribute("")]
64 | public string SelectedLanguage {
65 | get {
66 | return ((string)(this["SelectedLanguage"]));
67 | }
68 | set {
69 | this["SelectedLanguage"] = value;
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 6
10 |
11 |
12 | True
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/RecentFileHandler.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Be.HexEditor
2 | {
3 | partial class RecentFileHandler
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | components = new System.ComponentModel.Container();
32 | }
33 |
34 | #endregion
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/Copy16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/Copy16.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/Copy24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/Copy24.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/Copy32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/Copy32.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/Cut16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/Cut16.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/Cut24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/Cut24.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/Cut32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/Cut32.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/Find16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/Find16.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/Find24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/Find24.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/Find32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/Find32.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/FindNext16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/FindNext16.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/FindNext24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/FindNext24.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/FindNext32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/FindNext32.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/FolderOpen_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/FolderOpen_16.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/FolderOpen_24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/FolderOpen_24.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/FolderOpen_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/FolderOpen_32.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/Paste16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/Paste16.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/Paste24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/Paste24.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/Paste32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/Paste32.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/Save24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/Save24.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/Save32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/Save32.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/ThanksTo.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Segoe UI Mono;}{\f1\fmodern\fprq1\fcharset0 Courier New;}{\f2\fswiss\fcharset0 Arial;}}
2 | {\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\lang1031\b\f0\fs16 A lot of thanks to some people. \par
3 | \b0\par
4 | \b Developers\b0\par
5 | - Eric Lawrence (some great fixes)\par
6 | - Dave Cluderay (DynamicFileByteProvider)\par
7 | - Andrew Whewell (EBCDIC 500)\par
8 | - Bart Tormans\par
9 | - Itai Basel\par
10 | \par
11 | \b Translators\b0\par
12 | - wwwcfe (Japanese)\par
13 | - Vladimir (Russian)\par
14 | - Regnad (Simplified Chinese)\par
15 | - Michele (Italian)\par
16 | \par
17 | And all others who reports bug and hints\par
18 | \f1\par
19 | \lang1033\f2\fs20\par
20 | }
21 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/folder_Open_32xLG.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/folder_Open_32xLG.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Resources/save16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/Resources/save16.png
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/Util.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Globalization;
5 |
6 | namespace Be.HexEditor
7 | {
8 | static class Util
9 | {
10 | ///
11 | /// Contains true, if we are in design mode of Visual Studio
12 | ///
13 | private static bool _designMode;
14 |
15 | ///
16 | /// Initializes an instance of Util class
17 | ///
18 | static Util()
19 | {
20 | // design mode is true if host process is: Visual Studio, Visual Studio Express Versions (C#, VB, C++) or SharpDevelop
21 | var designerHosts = new List() { "devenv", "vcsexpress", "vbexpress", "vcexpress", "sharpdevelop" };
22 | using (var process = System.Diagnostics.Process.GetCurrentProcess())
23 | {
24 | var processName = process.ProcessName.ToLower();
25 | _designMode = designerHosts.Contains(processName);
26 | }
27 | }
28 |
29 | ///
30 | /// Gets true, if we are in design mode of Visual Studio
31 | ///
32 | ///
33 | /// In Visual Studio 2008 SP1 the designer is crashing sometimes on windows forms.
34 | /// The DesignMode property of Control class is buggy and cannot be used, so use our own implementation instead.
35 | ///
36 | public static bool DesignMode
37 | {
38 | get
39 | {
40 | return _designMode;
41 | }
42 | }
43 |
44 | public static string GetDisplayBytes(long size)
45 | {
46 | const long multi = 1024;
47 | long kb = multi;
48 | long mb = kb*multi;
49 | long gb = mb*multi;
50 | long tb = gb*multi;
51 |
52 | const string BYTES = "Bytes";
53 | const string KB = "KB";
54 | const string MB = "MB";
55 | const string GB = "GB";
56 | const string TB = "TB";
57 |
58 | string result;
59 | if (size < kb)
60 | result = string.Format("{0} {1}", size, BYTES);
61 | else if(size < mb)
62 | result = string.Format("{0} {1} ({2} Bytes)",
63 | ConvertToOneDigit(size, kb), KB, ConvertBytesDisplay(size));
64 | else if(size < gb)
65 | result = string.Format("{0} {1} ({2} Bytes)",
66 | ConvertToOneDigit(size, mb), MB, ConvertBytesDisplay(size));
67 | else if(size < tb)
68 | result = string.Format("{0} {1} ({2} Bytes)",
69 | ConvertToOneDigit(size, gb), GB, ConvertBytesDisplay(size));
70 | else
71 | result = string.Format("{0} {1} ({2} Bytes)",
72 | ConvertToOneDigit(size, tb), TB, ConvertBytesDisplay(size));
73 |
74 | return result;
75 | }
76 |
77 | static string ConvertBytesDisplay(long size)
78 | {
79 | return size.ToString("###,###,###,###,###", CultureInfo.CurrentCulture);
80 | }
81 |
82 | static string ConvertToOneDigit(long size, long quan)
83 | {
84 | double quotient = (double)size / (double)quan;
85 | string result = quotient.ToString("0.#", CultureInfo.CurrentCulture);
86 | return result;
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/W32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Be.HexEditor
5 | {
6 | // Win32 API for P/Invoke
7 | class W32
8 | {
9 | // Get handle to monitor that has the largest intersection with a specified window.
10 | [DllImport("User32.dll", SetLastError = true)]
11 | internal static extern IntPtr MonitorFromWindow(IntPtr hwnd,
12 | int dwFlags);
13 |
14 | // Get handle to monitor that has the largest intersection with a specified rectangle.
15 | [DllImport("User32.dll", SetLastError = true)]
16 | internal static extern IntPtr MonitorFromRect([In] ref RECT lprc,
17 | int dwFlags);
18 |
19 | // Get handle to monitor that contains a specified point.
20 | [DllImport("User32.dll", SetLastError = true)]
21 | internal static extern IntPtr MonitorFromPoint(POINT pt, int dwFlags);
22 |
23 | internal const int MONITORINFOF_PRIMARY = 0x00000001;
24 | internal const int MONITOR_DEFAULTTONEAREST = 0x00000002;
25 | internal const int MONITOR_DEFAULTTONULL = 0x00000000;
26 | internal const int MONITOR_DEFAULTTOPRIMARY = 0x00000001;
27 |
28 | [StructLayout(LayoutKind.Sequential)]
29 | internal struct POINT
30 | {
31 | internal int x;
32 | internal int y;
33 |
34 | internal POINT(int x, int y)
35 | {
36 | this.x = x;
37 | this.y = y;
38 | }
39 | }
40 |
41 | [StructLayout(LayoutKind.Sequential)]
42 | internal struct RECT
43 | {
44 | internal int left;
45 | internal int top;
46 | internal int right;
47 | internal int bottom;
48 | }
49 |
50 | // Get DPI from handle to a specified monitor (Windows 8.1 or newer is required).
51 | [DllImport("Shcore.dll", SetLastError = true)]
52 | internal static extern int GetDpiForMonitor(IntPtr hmonitor,
53 | Monitor_DPI_Type dpiType,
54 | out uint dpiX,
55 | out uint dpiY);
56 |
57 | internal enum Monitor_DPI_Type : int
58 | {
59 | MDT_Effective_DPI = 0,
60 | MDT_Angular_DPI = 1,
61 | MDT_Raw_DPI = 2,
62 | MDT_Default = MDT_Effective_DPI
63 | }
64 |
65 | // Equivalent to LOWORD macro
66 | internal static short GetLoWord(int dword)
67 | {
68 | return (short)(dword & 0xffff);
69 | }
70 |
71 | // Get device-specific information.
72 | [DllImport("Gdi32.dll", SetLastError = true)]
73 | internal static extern int GetDeviceCaps(IntPtr hdc,
74 | int nIndex);
75 |
76 | internal const int LOGPIXELSX = 88;
77 |
78 | [DllImport("User32.dll", SetLastError = true)]
79 | internal static extern IntPtr GetDC(IntPtr hWnd);
80 |
81 | [DllImport("User32.dll", SetLastError = true)]
82 | [return: MarshalAs(UnmanagedType.Bool)]
83 | internal static extern bool ReleaseDC(IntPtr hWnd,
84 | IntPtr hDC);
85 |
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | 6
12 |
13 |
14 | True
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | True/PM
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/img/HexBox.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/img/HexBox.bmp
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/img/banner.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/img/banner.JPG
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/img/banner.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/img/banner.bmp
--------------------------------------------------------------------------------
/SCReverser/Be.HexEditor/img/logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.HexEditor/img/logo.jpg
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Runtime.CompilerServices;
4 | using System.Security.Permissions;
5 | using System.Runtime.InteropServices;
6 |
7 | //
8 | // General Information about an assembly is controlled through the following
9 | // set of attributes. Change these attribute values to modify the information
10 | // associated with an assembly.
11 | //
12 | [assembly: AssemblyTitle("Be.Windows.Forms.HexBox")]
13 | [assembly: AssemblyDescription("hex edit control (C# DOTNET)")]
14 | [assembly: AssemblyConfiguration("")]
15 | [assembly: AssemblyCompany("Be")]
16 | [assembly: AssemblyProduct("Be.Windows.Forms.HexBox")]
17 | [assembly: AssemblyCopyright("")]
18 | [assembly: AssemblyTrademark("")]
19 | [assembly: AssemblyCulture("")]
20 |
21 | //
22 | // Version information for an assembly consists of the following four values:
23 | //
24 | // Major Version
25 | // Minor Version
26 | // Build Number
27 | // Revision
28 | //
29 | // You can specify all the values or you can default the Revision and Build Numbers
30 | // by using the '*' as shown below:
31 |
32 | [assembly: AssemblyVersion("1.6.0.*")]
33 |
34 | //
35 | // In order to sign your assembly you must specify a key to use. Refer to the
36 | // Microsoft .NET Framework documentation for more information on assembly signing.
37 | //
38 | // Use the attributes below to control which key is used for signing.
39 | //
40 | // Notes:
41 | // (*) If no key is specified, the assembly is not signed.
42 | // (*) KeyName refers to a key that has been installed in the Crypto Service
43 | // Provider (CSP) on your machine. KeyFile refers to a file which contains
44 | // a key.
45 | // (*) If the KeyFile and the KeyName values are both specified, the
46 | // following processing occurs:
47 | // (1) If the KeyName can be found in the CSP, that key is used.
48 | // (2) If the KeyName does not exist and the KeyFile does exist, the key
49 | // in the KeyFile is installed into the CSP and used.
50 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
51 | // When specifying the KeyFile, the location of the KeyFile should be
52 | // relative to the project output directory which is
53 | // %Project Directory%\obj\. For example, if your KeyFile is
54 | // located in the project directory, you would specify the AssemblyKeyFile
55 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
56 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
57 | // documentation for more information on this.
58 | //
59 | [assembly: AssemblyDelaySign(false)]
60 |
61 | //[assembly: AssemblyKeyFile("../../HexBox.snk")]
62 | //[assembly: AssemblyKeyName("")]
63 |
64 | //[assembly:IsolatedStorageFilePermission(SecurityAction.RequestRefuse, UserQuota=1048576)]
65 | //[assembly:SecurityPermission(SecurityAction.RequestRefuse, UnmanagedCode=true)]
66 | //[assembly:FileIOPermission(SecurityAction.RequestOptional, Unrestricted=true)]
67 |
68 | [assembly:CLSCompliant(true)]
69 |
70 | [assembly:ComVisible(false)]
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/ByteCharConverters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | ///
8 | /// The interface for objects that can translate between characters and bytes.
9 | ///
10 | public interface IByteCharConverter
11 | {
12 | ///
13 | /// Returns the character to display for the byte passed across.
14 | ///
15 | ///
16 | ///
17 | char ToChar(byte b);
18 |
19 | ///
20 | /// Returns the byte to use when the character passed across is entered during editing.
21 | ///
22 | ///
23 | ///
24 | byte ToByte(char c);
25 | }
26 |
27 | ///
28 | /// The default implementation.
29 | ///
30 | public class DefaultByteCharConverter : IByteCharConverter
31 | {
32 | ///
33 | /// Returns the character to display for the byte passed across.
34 | ///
35 | ///
36 | ///
37 | public virtual char ToChar(byte b)
38 | {
39 | return b > 0x1F && !(b > 0x7E && b < 0xA0) ? (char)b : '.';
40 | }
41 |
42 | ///
43 | /// Returns the byte to use for the character passed across.
44 | ///
45 | ///
46 | ///
47 | public virtual byte ToByte(char c)
48 | {
49 | return (byte)c;
50 | }
51 |
52 | ///
53 | /// Returns a description of the byte char provider.
54 | ///
55 | ///
56 | public override string ToString()
57 | {
58 | return "ANSI (Default)";
59 | }
60 | }
61 |
62 | ///
63 | /// A byte char provider that can translate bytes encoded in codepage 500 EBCDIC
64 | ///
65 | public class EbcdicByteCharProvider : IByteCharConverter
66 | {
67 | ///
68 | /// The IBM EBCDIC code page 500 encoding. Note that this is not always supported by .NET,
69 | /// the underlying platform has to provide support for it.
70 | ///
71 | private Encoding _ebcdicEncoding = Encoding.GetEncoding(500);
72 |
73 | ///
74 | /// Returns the EBCDIC character corresponding to the byte passed across.
75 | ///
76 | ///
77 | ///
78 | public virtual char ToChar(byte b)
79 | {
80 | string encoded = _ebcdicEncoding.GetString(new byte[] { b });
81 | return encoded.Length > 0 ? encoded[0] : '.';
82 | }
83 |
84 | ///
85 | /// Returns the byte corresponding to the EBCDIC character passed across.
86 | ///
87 | ///
88 | ///
89 | public virtual byte ToByte(char c)
90 | {
91 | byte[] decoded = _ebcdicEncoding.GetBytes(new char[] { c });
92 | return decoded.Length > 0 ? decoded[0] : (byte)0;
93 | }
94 |
95 | ///
96 | /// Returns a description of the byte char provider.
97 | ///
98 | ///
99 | public override string ToString()
100 | {
101 | return "EBCDIC (Code Page 500)";
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/ByteCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using System.Collections;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | ///
8 | /// Represents a collection of bytes.
9 | ///
10 | public class ByteCollection : CollectionBase
11 | {
12 | ///
13 | /// Initializes a new instance of ByteCollection class.
14 | ///
15 | public ByteCollection() { }
16 |
17 | ///
18 | /// Initializes a new instance of ByteCollection class.
19 | ///
20 | /// an array of bytes to add to collection
21 | public ByteCollection(byte[] bs)
22 | { AddRange(bs); }
23 |
24 | ///
25 | /// Gets or sets the value of a byte
26 | ///
27 | public byte this[int index]
28 | {
29 | get { return (byte)List[index]; }
30 | set { List[index] = value; }
31 | }
32 |
33 | ///
34 | /// Adds a byte into the collection.
35 | ///
36 | /// the byte to add
37 | public void Add(byte b)
38 | { List.Add(b); }
39 |
40 | ///
41 | /// Adds a range of bytes to the collection.
42 | ///
43 | /// the bytes to add
44 | public void AddRange(byte[] bs)
45 | { InnerList.AddRange(bs); }
46 |
47 | ///
48 | /// Removes a byte from the collection.
49 | ///
50 | /// the byte to remove
51 | public void Remove(byte b)
52 | { List.Remove(b); }
53 |
54 | ///
55 | /// Removes a range of bytes from the collection.
56 | ///
57 | /// the index of the start byte
58 | /// the count of the bytes to remove
59 | public void RemoveRange(int index, int count)
60 | { InnerList.RemoveRange(index, count); }
61 |
62 | ///
63 | /// Inserts a range of bytes to the collection.
64 | ///
65 | /// the index of start byte
66 | /// an array of bytes to insert
67 | public void InsertRange(int index, byte[] bs)
68 | { InnerList.InsertRange(index, bs); }
69 |
70 | ///
71 | /// Gets all bytes in the array
72 | ///
73 | /// an array of bytes.
74 | public byte[] GetBytes()
75 | {
76 | byte[] bytes = new byte[Count];
77 | InnerList.CopyTo(0, bytes, 0, bytes.Length);
78 | return bytes;
79 | }
80 |
81 | ///
82 | /// Inserts a byte to the collection.
83 | ///
84 | /// the index
85 | /// a byte to insert
86 | public void Insert(int index, byte b)
87 | {
88 | InnerList.Insert(index, b);
89 | }
90 |
91 | ///
92 | /// Returns the index of the given byte.
93 | ///
94 | public int IndexOf(byte b)
95 | {
96 | return InnerList.IndexOf(b);
97 | }
98 |
99 | ///
100 | /// Returns true, if the byte exists in the collection.
101 | ///
102 | public bool Contains(byte b)
103 | {
104 | return InnerList.Contains(b);
105 | }
106 |
107 | ///
108 | /// Copies the content of the collection into the given array.
109 | ///
110 | public void CopyTo(byte[] bs, int index)
111 | {
112 | InnerList.CopyTo(bs, index);
113 | }
114 |
115 | ///
116 | /// Copies the content of the collection into an array.
117 | ///
118 | /// the array containing all bytes.
119 | public byte[] ToArray()
120 | {
121 | byte[] data = new byte[this.Count];
122 | this.CopyTo(data, 0);
123 | return data;
124 | }
125 |
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/BytePositionInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | ///
8 | /// Represents a position in the HexBox control
9 | ///
10 | struct BytePositionInfo
11 | {
12 | public BytePositionInfo(long index, int characterPosition)
13 | {
14 | _index = index;
15 | _characterPosition = characterPosition;
16 | }
17 |
18 | public int CharacterPosition
19 | {
20 | get { return _characterPosition; }
21 | } int _characterPosition;
22 |
23 | public long Index
24 | {
25 | get { return _index; }
26 | } long _index;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/DataBlock.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Be.Windows.Forms
4 | {
5 | internal abstract class DataBlock
6 | {
7 | internal DataMap _map;
8 | internal DataBlock _nextBlock;
9 | internal DataBlock _previousBlock;
10 |
11 | public abstract long Length
12 | {
13 | get;
14 | }
15 |
16 | public DataMap Map
17 | {
18 | get
19 | {
20 | return _map;
21 | }
22 | }
23 |
24 | public DataBlock NextBlock
25 | {
26 | get
27 | {
28 | return _nextBlock;
29 | }
30 | }
31 |
32 | public DataBlock PreviousBlock
33 | {
34 | get
35 | {
36 | return _previousBlock;
37 | }
38 | }
39 |
40 | public abstract void RemoveBytes(long position, long count);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/DynamicByteProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Be.Windows.Forms
5 | {
6 | ///
7 | /// Byte provider for a small amount of data.
8 | ///
9 | public class DynamicByteProvider : IByteProvider
10 | {
11 | ///
12 | /// Contains information about changes.
13 | ///
14 | bool _hasChanges;
15 | ///
16 | /// Contains a byte collection.
17 | ///
18 | List _bytes;
19 |
20 | ///
21 | /// Initializes a new instance of the DynamicByteProvider class.
22 | ///
23 | ///
24 | public DynamicByteProvider(byte[] data) : this(new List(data))
25 | {
26 | }
27 |
28 | ///
29 | /// Initializes a new instance of the DynamicByteProvider class.
30 | ///
31 | ///
32 | public DynamicByteProvider(List bytes)
33 | {
34 | _bytes = bytes;
35 | }
36 |
37 | ///
38 | /// Raises the Changed event.
39 | ///
40 | void OnChanged(EventArgs e)
41 | {
42 | _hasChanges = true;
43 |
44 | if(Changed != null)
45 | Changed(this, e);
46 | }
47 |
48 | ///
49 | /// Raises the LengthChanged event.
50 | ///
51 | void OnLengthChanged(EventArgs e)
52 | {
53 | if(LengthChanged != null)
54 | LengthChanged(this, e);
55 | }
56 |
57 | ///
58 | /// Gets the byte collection.
59 | ///
60 | public List Bytes
61 | {
62 | get { return _bytes; }
63 | }
64 |
65 | #region IByteProvider Members
66 | ///
67 | /// True, when changes are done.
68 | ///
69 | public bool HasChanges()
70 | {
71 | return _hasChanges;
72 | }
73 |
74 | ///
75 | /// Applies changes.
76 | ///
77 | public void ApplyChanges()
78 | {
79 | _hasChanges = false;
80 | }
81 |
82 | ///
83 | /// Occurs, when the write buffer contains new changes.
84 | ///
85 | public event EventHandler Changed;
86 |
87 | ///
88 | /// Occurs, when InsertBytes or DeleteBytes method is called.
89 | ///
90 | public event EventHandler LengthChanged;
91 |
92 |
93 | ///
94 | /// Reads a byte from the byte collection.
95 | ///
96 | /// the index of the byte to read
97 | /// the byte
98 | public byte ReadByte(long index)
99 | { return _bytes[(int)index]; }
100 |
101 | ///
102 | /// Write a byte into the byte collection.
103 | ///
104 | /// the index of the byte to write.
105 | /// the byte
106 | public void WriteByte(long index, byte value)
107 | {
108 | _bytes[(int)index] = value;
109 | OnChanged(EventArgs.Empty);
110 | }
111 |
112 | ///
113 | /// Deletes bytes from the byte collection.
114 | ///
115 | /// the start index of the bytes to delete.
116 | /// the length of bytes to delete.
117 | public void DeleteBytes(long index, long length)
118 | {
119 | int internal_index = (int)Math.Max(0, index);
120 | int internal_length = (int)Math.Min((int)Length, length);
121 | _bytes.RemoveRange(internal_index, internal_length);
122 |
123 | OnLengthChanged(EventArgs.Empty);
124 | OnChanged(EventArgs.Empty);
125 | }
126 |
127 | ///
128 | /// Inserts byte into the byte collection.
129 | ///
130 | /// the start index of the bytes in the byte collection
131 | /// the byte array to insert
132 | public void InsertBytes(long index, byte[] bs)
133 | {
134 | _bytes.InsertRange((int)index, bs);
135 |
136 | OnLengthChanged(EventArgs.Empty);
137 | OnChanged(EventArgs.Empty);
138 | }
139 |
140 | ///
141 | /// Gets the length of the bytes in the byte collection.
142 | ///
143 | public long Length
144 | {
145 | get
146 | {
147 | return _bytes.Count;
148 | }
149 | }
150 |
151 | ///
152 | /// Returns true
153 | ///
154 | public bool SupportsWriteByte()
155 | {
156 | return true;
157 | }
158 |
159 | ///
160 | /// Returns true
161 | ///
162 | public bool SupportsInsertBytes()
163 | {
164 | return true;
165 | }
166 |
167 | ///
168 | /// Returns true
169 | ///
170 | public bool SupportsDeleteBytes()
171 | {
172 | return true;
173 | }
174 | #endregion
175 |
176 | }
177 | }
178 |
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/FileDataBlock.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Be.Windows.Forms
4 | {
5 | internal sealed class FileDataBlock : DataBlock
6 | {
7 | long _length;
8 | long _fileOffset;
9 |
10 | public FileDataBlock(long fileOffset, long length)
11 | {
12 | _fileOffset = fileOffset;
13 | _length = length;
14 | }
15 |
16 | public long FileOffset
17 | {
18 | get
19 | {
20 | return _fileOffset;
21 | }
22 | }
23 |
24 | public override long Length
25 | {
26 | get
27 | {
28 | return _length;
29 | }
30 | }
31 |
32 | public void SetFileOffset(long value)
33 | {
34 | _fileOffset = value;
35 | }
36 |
37 | public void RemoveBytesFromEnd(long count)
38 | {
39 | if (count > _length)
40 | {
41 | throw new ArgumentOutOfRangeException("count");
42 | }
43 |
44 | _length -= count;
45 | }
46 |
47 | public void RemoveBytesFromStart(long count)
48 | {
49 | if (count > _length)
50 | {
51 | throw new ArgumentOutOfRangeException("count");
52 | }
53 |
54 | _fileOffset += count;
55 | _length -= count;
56 | }
57 |
58 | public override void RemoveBytes(long position, long count)
59 | {
60 | if (position > _length)
61 | {
62 | throw new ArgumentOutOfRangeException("position");
63 | }
64 |
65 | if (position + count > _length)
66 | {
67 | throw new ArgumentOutOfRangeException("count");
68 | }
69 |
70 | long prefixLength = position;
71 | long prefixFileOffset = _fileOffset;
72 |
73 | long suffixLength = _length - count - prefixLength;
74 | long suffixFileOffset = _fileOffset + position + count;
75 |
76 | if (prefixLength > 0 && suffixLength > 0)
77 | {
78 | _fileOffset = prefixFileOffset;
79 | _length = prefixLength;
80 | _map.AddAfter(this, new FileDataBlock(suffixFileOffset, suffixLength));
81 | return;
82 | }
83 |
84 | if (prefixLength > 0)
85 | {
86 | _fileOffset = prefixFileOffset;
87 | _length = prefixLength;
88 | }
89 | else
90 | {
91 | _fileOffset = suffixFileOffset;
92 | _length = suffixLength;
93 | }
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/FindOptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | ///
8 | /// Defines the type of the Find operation.
9 | ///
10 | public enum FindType
11 | {
12 | ///
13 | /// Used for Text Find operations
14 | ///
15 | Text,
16 | ///
17 | /// Used for Hex Find operations
18 | ///
19 | Hex
20 | }
21 |
22 | ///
23 | /// Defines all state information nee
24 | ///
25 | public class FindOptions
26 | {
27 | ///
28 | /// Gets or sets whether the Find options are valid
29 | ///
30 | public bool IsValid { get; set; }
31 | ///
32 | /// Gets the Find buffer used for case insensitive Find operations. This is the binary representation of Text.
33 | ///
34 | internal byte[] FindBuffer { get; private set; }
35 | ///
36 | /// Gets the Find buffer used for case sensitive Find operations. This is the binary representation of Text in lower case format.
37 | ///
38 | internal byte[] FindBufferLowerCase { get; private set; }
39 | ///
40 | /// Gets the Find buffer used for case sensitive Find operations. This is the binary representation of Text in upper case format.
41 | ///
42 | internal byte[] FindBufferUpperCase { get; private set; }
43 | ///
44 | /// Contains the MatchCase value
45 | ///
46 | bool _matchCase;
47 | ///
48 | /// Gets or sets the value, whether the Find operation is case sensitive or not.
49 | ///
50 | public bool MatchCase
51 | {
52 | get { return _matchCase; }
53 | set
54 | {
55 | _matchCase = value;
56 | UpdateFindBuffer();
57 | }
58 | }
59 | ///
60 | /// Contains the text that should be found.
61 | ///
62 | string _text;
63 | ///
64 | /// Gets or sets the text that should be found. Only used, when Type is FindType.Hex.
65 | ///
66 | public string Text
67 | {
68 | get { return _text; }
69 | set
70 | {
71 | _text = value;
72 | UpdateFindBuffer();
73 | }
74 | }
75 | ///
76 | /// Gets or sets the hex buffer that should be found. Only used, when Type is FindType.Hex.
77 | ///
78 | public byte[] Hex { get; set; }
79 | ///
80 | /// Gets or sets the type what should be searched.
81 | ///
82 | public FindType Type { get; set; }
83 | ///
84 | /// Updates the find buffer.
85 | ///
86 | void UpdateFindBuffer()
87 | {
88 | string text = this.Text != null ? this.Text : string.Empty;
89 | FindBuffer = ASCIIEncoding.ASCII.GetBytes(text);
90 | FindBufferLowerCase = ASCIIEncoding.ASCII.GetBytes(text.ToLower());
91 | FindBufferUpperCase = ASCIIEncoding.ASCII.GetBytes(text.ToUpper());
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/HexBox.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.Windows.Forms.HexBox/HexBox.bmp
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/HexBox.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.Windows.Forms.HexBox/HexBox.cs
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/HexCasing.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | ///
8 | /// Specifies the case of hex characters in the HexBox control
9 | ///
10 | public enum HexCasing
11 | {
12 | ///
13 | /// Converts all characters to uppercase.
14 | ///
15 | Upper = 0,
16 | ///
17 | /// Converts all characters to lowercase.
18 | ///
19 | Lower = 1
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/IByteProvider.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Be.Windows.Forms.HexBox/IByteProvider.cs
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/MemoryDataBlock.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Be.Windows.Forms
4 | {
5 | internal sealed class MemoryDataBlock : DataBlock
6 | {
7 | byte[] _data;
8 |
9 | public MemoryDataBlock(byte data)
10 | {
11 | _data = new byte[] { data };
12 | }
13 |
14 | public MemoryDataBlock(byte[] data)
15 | {
16 | if (data == null)
17 | {
18 | throw new ArgumentNullException("data");
19 | }
20 |
21 | _data = (byte[])data.Clone();
22 | }
23 |
24 | public override long Length
25 | {
26 | get
27 | {
28 | return _data.LongLength;
29 | }
30 | }
31 |
32 | public byte[] Data
33 | {
34 | get
35 | {
36 | return _data;
37 | }
38 | }
39 |
40 | public void AddByteToEnd(byte value)
41 | {
42 | byte[] newData = new byte[_data.LongLength + 1];
43 | _data.CopyTo(newData, 0);
44 | newData[newData.LongLength - 1] = value;
45 | _data = newData;
46 | }
47 |
48 | public void AddByteToStart(byte value)
49 | {
50 | byte[] newData = new byte[_data.LongLength + 1];
51 | newData[0] = value;
52 | _data.CopyTo(newData, 1);
53 | _data = newData;
54 | }
55 |
56 | public void InsertBytes(long position, byte[] data)
57 | {
58 | byte[] newData = new byte[_data.LongLength + data.LongLength];
59 | if (position > 0)
60 | {
61 | Array.Copy(_data, 0, newData, 0, position);
62 | }
63 | Array.Copy(data, 0, newData, position, data.LongLength);
64 | if (position < _data.LongLength)
65 | {
66 | Array.Copy(_data, position, newData, position + data.LongLength, _data.LongLength - position);
67 | }
68 | _data = newData;
69 | }
70 |
71 | public override void RemoveBytes(long position, long count)
72 | {
73 | byte[] newData = new byte[_data.LongLength - count];
74 |
75 | if (position > 0)
76 | {
77 | Array.Copy(_data, 0, newData, 0, position);
78 | }
79 | if (position + count < _data.LongLength)
80 | {
81 | Array.Copy(_data, position + count, newData, position, newData.LongLength - position);
82 | }
83 |
84 | _data = newData;
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/NativeMethods.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Runtime.InteropServices;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | internal static class NativeMethods
8 | {
9 | // Caret definitions
10 | [DllImport("user32.dll", SetLastError=true)]
11 | public static extern bool CreateCaret(IntPtr hWnd, IntPtr hBitmap, int nWidth, int nHeight);
12 |
13 | [DllImport("user32.dll", SetLastError=true)]
14 | public static extern bool ShowCaret(IntPtr hWnd);
15 |
16 | [DllImport("user32.dll", SetLastError=true)]
17 | public static extern bool DestroyCaret();
18 |
19 | [DllImport("user32.dll", SetLastError=true)]
20 | public static extern bool SetCaretPos(int X, int Y);
21 |
22 | // Key definitions
23 | public const int WM_KEYDOWN = 0x100;
24 | public const int WM_KEYUP = 0x101;
25 | public const int WM_CHAR = 0x102;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34003
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Be.Windows.Forms.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Be.Windows.Forms.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/SCReverser/Be.Windows.Forms.HexBox/Util.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Be.Windows.Forms
6 | {
7 | static class Util
8 | {
9 | ///
10 | /// Contains true, if we are in design mode of Visual Studio
11 | ///
12 | private static bool _designMode;
13 |
14 | ///
15 | /// Initializes an instance of Util class
16 | ///
17 | static Util()
18 | {
19 | // design mode is true if host process is: Visual Studio, Visual Studio Express Versions (C#, VB, C++) or SharpDevelop
20 | var designerHosts = new List() { "devenv", "vcsexpress", "vbexpress", "vcexpress", "sharpdevelop" };
21 | using (var process = System.Diagnostics.Process.GetCurrentProcess())
22 | {
23 | var processName = process.ProcessName.ToLower();
24 | _designMode = designerHosts.Contains(processName);
25 | }
26 | }
27 |
28 | ///
29 | /// Gets true, if we are in design mode of Visual Studio
30 | ///
31 | ///
32 | /// In Visual Studio 2008 SP1 the designer is crashing sometimes on windows forms.
33 | /// The DesignMode property of Control class is buggy and cannot be used, so use our own implementation instead.
34 | ///
35 | public static bool DesignMode
36 | {
37 | get
38 | {
39 | return _designMode;
40 | }
41 | }
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/SCReverser/Resources/ImagesForReadme/2017-10-31 19_44_12-Open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Resources/ImagesForReadme/2017-10-31 19_44_12-Open.png
--------------------------------------------------------------------------------
/SCReverser/Resources/ImagesForReadme/2017-10-31 19_44_53-SCReverser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Resources/ImagesForReadme/2017-10-31 19_44_53-SCReverser.png
--------------------------------------------------------------------------------
/SCReverser/Resources/ImagesForReadme/2017-10-31 19_45_13-SCReverser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Resources/ImagesForReadme/2017-10-31 19_45_13-SCReverser.png
--------------------------------------------------------------------------------
/SCReverser/Resources/ImagesForReadme/2017-10-31 19_45_21-SCReverser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Resources/ImagesForReadme/2017-10-31 19_45_21-SCReverser.png
--------------------------------------------------------------------------------
/SCReverser/Resources/ImagesForReadme/2017-10-31 19_45_26-SCReverser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Resources/ImagesForReadme/2017-10-31 19_45_26-SCReverser.png
--------------------------------------------------------------------------------
/SCReverser/Resources/ImagesForReadme/2017-10-31 19_46_34-SCReverser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Resources/ImagesForReadme/2017-10-31 19_46_34-SCReverser.png
--------------------------------------------------------------------------------
/SCReverser/Resources/NEOContracts.txt:
--------------------------------------------------------------------------------
1 | https://neotracker.io/browse/contract/1
2 |
3 | ecc6b20d3ccac1ee9ef109af5a7cdb85706b1df9 RPX Sale Red Pulse
4 | d3cce84d0800172d09c88ccad61130611bd047a4 Lock Erik Zhang
5 | ce3a97d7cfaa770a5e51c5b12cd1d015fbb5f87d AgencyContract Erik Zhang
6 | 8a4d2865d01ec8e6add72e3dfdd20c12f44834e3 AgencyContract Erik Zhang
7 |
--------------------------------------------------------------------------------
/SCReverser/Resources/SmartContractJumps.avm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Resources/SmartContractJumps.avm
--------------------------------------------------------------------------------
/SCReverser/Resources/SmartContractSample.avm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/Resources/SmartContractSample.avm
--------------------------------------------------------------------------------
/SCReverser/Resources/protocol.testnet.json:
--------------------------------------------------------------------------------
1 | {
2 | "ProtocolConfiguration": {
3 | "Magic": 1953787457,
4 | "AddressVersion": 23,
5 | "StandbyValidators": [
6 | "0327da12b5c40200e9f65569476bbff2218da4f32548ff43b6387ec1416a231ee8",
7 | "026ce35b29147ad09e4afe4ec4a7319095f08198fa8babbe3c56e970b143528d22",
8 | "0209e7fd41dfb5c2f8dc72eb30358ac100ea8c72da18847befe06eade68cebfcb9",
9 | "039dafd8571a641058ccc832c5e2111ea39b09c0bde36050914384f7a48bce9bf9",
10 | "038dddc06ce687677a53d54f096d2591ba2302068cf123c1f2d75c2dddc5425579",
11 | "02d02b1873a0863cd042cc717da31cea0d7cf9db32b74d4c72c01b0011503e2e22",
12 | "034ff5ceeac41acf22cd5ed2da17a6df4dd8358fcb2bfb1a43208ad0feaab2746b"
13 | ],
14 | "SeedList": [
15 | "seed1.neo.org:20333",
16 | "seed2.neo.org:20333",
17 | "seed3.neo.org:20333",
18 | "seed4.neo.org:20333",
19 | "seed5.neo.org:20333"
20 | ],
21 | "SystemFee": {
22 | "EnrollmentTransaction": 10,
23 | "IssueTransaction": 5,
24 | "PublishTransaction": 5,
25 | "RegisterTransaction": 100
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Attributes/OpCodeArgumentAttribute.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Enums;
2 | using SCReverser.Core.OpCodeArguments;
3 | using System;
4 |
5 | namespace SCReverser.Core.Attributes
6 | {
7 | [AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
8 | public class OpCodeArgumentAttribute : Attribute
9 | {
10 | ///
11 | /// OpCode
12 | ///
13 | public string OpCode { get; set; }
14 | ///
15 | /// Argument Type
16 | ///
17 | public Type ArgumentType { get; private set; }
18 | ///
19 | /// Constructor arguments
20 | ///
21 | public object[] ConstructorArguments { get; set; }
22 | ///
23 | /// Description
24 | ///
25 | public string Description { get; set; }
26 | ///
27 | /// Flags
28 | ///
29 | public OpCodeFlag Flags { get; set; }
30 |
31 | ///
32 | /// Constructor
33 | ///
34 | /// Argument Type
35 | public OpCodeArgumentAttribute(Type argumentType)
36 | {
37 | if (!typeof(OpCodeEmptyArgument).IsAssignableFrom(argumentType))
38 | throw (new ArgumentException("argumentType"));
39 |
40 | ArgumentType = argumentType;
41 | }
42 | ///
43 | /// Constructor
44 | ///
45 | public OpCodeArgumentAttribute()
46 | {
47 | // Empty argument
48 | ArgumentType = typeof(OpCodeEmptyArgument);
49 | }
50 | ///
51 | /// Create OpCodeArgument
52 | ///
53 | public OpCodeEmptyArgument Create()
54 | {
55 | return (OpCodeEmptyArgument)Activator.CreateInstance(ArgumentType, ConstructorArguments);
56 | }
57 | ///
58 | /// String representation
59 | ///
60 | public override string ToString()
61 | {
62 | if (string.IsNullOrEmpty(Description)) return OpCode;
63 | return OpCode + " - " + Description.ToString();
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Collections/InstructionCollection.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Enums;
2 | using SCReverser.Core.Types;
3 | using System.Collections.Generic;
4 | using System.Collections.ObjectModel;
5 |
6 | namespace SCReverser.Core.Collections
7 | {
8 | public class InstructionCollection : ObservableCollection
9 | {
10 | ///
11 | /// Cache offset - instruction index
12 | ///
13 | readonly OffsetRelationCache OffsetCache = new OffsetRelationCache();
14 |
15 | ///
16 | /// Get instruction by index
17 | ///
18 | /// Instruction index
19 | public Instruction this[uint instructionIndex]
20 | {
21 | get
22 | {
23 | if (Count <= instructionIndex) return null;
24 | return base[(int)instructionIndex];
25 | }
26 | }
27 | ///
28 | /// Get instruction by index
29 | ///
30 | /// Instruction index
31 | public new Instruction this[int instructionIndex]
32 | {
33 | get
34 | {
35 | if (Count <= instructionIndex) return null;
36 | return base[instructionIndex];
37 | }
38 | }
39 | ///
40 | /// Cache when add
41 | ///
42 | /// Index
43 | /// Item
44 | protected override void InsertItem(int index, Instruction item)
45 | {
46 | OffsetCache.Add(item.Location);
47 |
48 | base.InsertItem(index, item);
49 | }
50 | ///
51 | /// Add range
52 | ///
53 | /// Instructiond
54 | public void AddRange(Instruction[] ins)
55 | {
56 | if (ins == null) return;
57 |
58 | foreach (Instruction i in ins)
59 | Add(i);
60 | }
61 |
62 | ///
63 | /// Index to Offset
64 | ///
65 | /// Index
66 | /// Offset
67 | public bool IndexToOffset(uint index, out uint offset)
68 | {
69 | return OffsetCache.TryGetValue(index, out offset, OffsetIndexRelation.IndexToOffset);
70 | }
71 | ///
72 | /// Offset to Index
73 | ///
74 | /// Offset
75 | /// Index
76 | public bool OffsetToIndex(uint offset, out uint index)
77 | {
78 | return OffsetCache.TryGetValue(offset, out index, OffsetIndexRelation.OffsetToIndex);
79 | }
80 | ///
81 | /// Take between
82 | ///
83 | /// Start
84 | /// End
85 | public IEnumerable Take(IndexOffset start, IndexOffset end)
86 | {
87 | for (int x = (int)start.Index, m = (int)end.Index; x <= m; x++)
88 | yield return base[x];
89 | }
90 | ///
91 | /// Take enter
92 | ///
93 | /// Start
94 | public IEnumerable Take(IndexOffset start)
95 | {
96 | for (int x = (int)start.Index, m = Count; x < m; x++)
97 | yield return base[x];
98 | }
99 | ///
100 | /// Copy from
101 | ///
102 | /// Instructions
103 | public void CopyFrom(IEnumerable instructions)
104 | {
105 | foreach (Instruction i in instructions)
106 | Add(i);
107 | }
108 | }
109 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Collections/KeyValueCollection.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace SCReverser.Core.Collections
4 | {
5 | public class KeyValueCollection : Dictionary
6 | {
7 |
8 | }
9 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Collections/MethodCollection.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Types;
2 | using System.Collections.ObjectModel;
3 | using System.Linq;
4 |
5 | namespace SCReverser.Core.Collections
6 | {
7 | public class MethodCollection : ObservableCollection
8 | {
9 | ///
10 | /// Parent
11 | ///
12 | public Module Parent { get; private set; }
13 |
14 | ///
15 | /// Constructor
16 | ///
17 | /// Parent
18 | public MethodCollection(Module parent)
19 | {
20 | Parent = parent;
21 | }
22 |
23 | protected override void InsertItem(int index, Method item)
24 | {
25 | if (item != null) item.Parent = Parent;
26 | base.InsertItem(index, item);
27 | }
28 |
29 | ///
30 | /// Sort
31 | ///
32 | public void Sort()
33 | {
34 | Method[] mt = this.OrderBy(a => a.Start.Offset).ToArray();
35 | Clear();
36 | foreach (Method m in mt) Add(m);
37 | }
38 |
39 | ///
40 | /// Get method of
41 | ///
42 | /// Location
43 | public Method GetMethodOf(IndexOffset location)
44 | {
45 | foreach (Method m in this)
46 | if (location.IndexBetween(m.Start.Index, m.End.Index))
47 | return m;
48 |
49 | return null;
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Collections/ModuleCollection.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Types;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.Linq;
5 |
6 | namespace SCReverser.Core.Collections
7 | {
8 | public class ModuleCollection : ObservableCollection
9 | {
10 | ///
11 | /// Get module of
12 | ///
13 | /// Location
14 | public Module GetModuleOf(IndexOffset location)
15 | {
16 | foreach (Module m in this)
17 | if (location.IndexBetween(m.Start.Index, m.End.Index))
18 | return m;
19 |
20 | return null;
21 | }
22 |
23 | ///
24 | /// Sort
25 | ///
26 | public void Sort()
27 | {
28 | Module[] mt = this.OrderBy(a => a.Start.Offset).ToArray();
29 | Clear();
30 | foreach (Module m in mt)
31 | {
32 | m.Methods.Sort();
33 | Add(m);
34 | }
35 | }
36 |
37 | ///
38 | /// Copy from
39 | ///
40 | /// Modules
41 | public void CopyFrom(IEnumerable modules)
42 | {
43 | foreach (Module i in modules)
44 | Add(i);
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Collections/OcurrenceCollection.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using SCReverser.Core.Delegates;
3 | using SCReverser.Core.Types;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 |
7 | namespace SCReverser.Core.Collections
8 | {
9 | public class OcurrenceCollection : List
10 | {
11 | ///
12 | /// Check method
13 | ///
14 | [JsonIgnore]
15 | public OnCheckOcurrenceDelegate Checker { get; set; }
16 | ///
17 | /// Control Params
18 | ///
19 | public OcurrenceParams ControlParams { get; set; }
20 |
21 | ///
22 | /// Copy ordered to
23 | ///
24 | /// To
25 | public void CopyOrderedTo(IList to)
26 | {
27 | foreach (Ocurrence o in this.OrderByDescending(u => u.Count))
28 | to.Add(o);
29 | }
30 | ///
31 | /// Get ordered list
32 | ///
33 | public IEnumerable GetOrdered()
34 | {
35 | return this.OrderByDescending(u => u.Count);
36 | }
37 | ///
38 | /// Append ocurrence
39 | ///
40 | /// Arg
41 | /// Instructions
42 | public void Append(string name, params Instruction[] ins)
43 | {
44 | if (ins == null || ins.Length <= 0) return;
45 |
46 | int il = ins.Length;
47 | foreach (Ocurrence a in this.ToArray())
48 | if (a.Value == name)
49 | {
50 | a.Instructions.AddRange(ins);
51 | return;
52 | }
53 |
54 | Ocurrence oc = new Ocurrence() { Value = name };
55 | oc.Instructions.AddRange(ins);
56 |
57 | Add(oc);
58 | }
59 | }
60 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Collections/OffsetRelationCache.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Enums;
2 | using SCReverser.Core.Types;
3 | using System.Collections.Generic;
4 |
5 | namespace SCReverser.Core.Collections
6 | {
7 | public class OffsetRelationCache
8 | {
9 | readonly Dictionary _OffsetToIndex = new Dictionary();
10 | readonly Dictionary _IndexToOffset = new Dictionary();
11 |
12 | ///
13 | /// Constructor
14 | ///
15 | public OffsetRelationCache() { }
16 | ///
17 | /// Constructor
18 | ///
19 | /// Instruction
20 | public OffsetRelationCache(IEnumerable instructions)
21 | {
22 | FillWith(instructions);
23 | }
24 |
25 | ///
26 | /// Try get value
27 | ///
28 | /// Key
29 | /// Value
30 | /// Mode
31 | public bool TryGetValue(uint key, out uint value, OffsetIndexRelation mode)
32 | {
33 | if (mode == OffsetIndexRelation.OffsetToIndex)
34 | return _OffsetToIndex.TryGetValue(key, out value);
35 |
36 | return _IndexToOffset.TryGetValue(key, out value);
37 | }
38 | ///
39 | /// Fill cache
40 | ///
41 | /// Instruction
42 | public void FillWith(IEnumerable instructions)
43 | {
44 | foreach (Instruction i in instructions) Add(i.Location);
45 | }
46 | ///
47 | /// Add index/offset
48 | ///
49 | /// Index
50 | public void Add(IndexOffset i)
51 | {
52 | _OffsetToIndex.Add(i.Offset, i.Index);
53 | _IndexToOffset.Add(i.Index, i.Offset);
54 | }
55 | }
56 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Collections/StackCollection.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Types;
2 | using System;
3 | using System.Collections;
4 | using System.Collections.Generic;
5 |
6 | namespace SCReverser.Core.Collections
7 | {
8 | public class StackCollection : IEnumerable
9 | {
10 | List List = new List();
11 | public event EventHandler OnChange;
12 |
13 | ///
14 | /// Count
15 | ///
16 | public int Count { get { return List.Count; } }
17 |
18 | ///
19 | /// Copy elements from
20 | ///
21 | /// Type
22 | /// It
23 | public void CopyFrom(IEnumerable> it)
24 | where T : StackItem
25 | {
26 | bool change = false;
27 | int x = -1;
28 |
29 | foreach (T ob in it)
30 | {
31 | x++;
32 |
33 | if (List.Count > x)
34 | {
35 | if (ob.ToString() == List[x].ToString())
36 | continue;
37 | }
38 |
39 | List.Insert(x, ob);
40 | change = true;
41 | }
42 |
43 | // Remove extra
44 | while (List.Count > x + 1)
45 | {
46 | List.RemoveAt(x + 1);
47 | change = true;
48 | }
49 |
50 | if (change)
51 | OnChange?.Invoke(this, EventArgs.Empty);
52 | }
53 |
54 | public IEnumerator GetEnumerator() { return List.GetEnumerator(); }
55 | IEnumerator IEnumerable.GetEnumerator() { return List.GetEnumerator(); }
56 |
57 | ///
58 | /// Notify changes
59 | ///
60 | public void NotifyChanges()
61 | {
62 | OnChange?.Invoke(this, EventArgs.Empty);
63 | }
64 |
65 | ///
66 | /// Clear
67 | ///
68 | public void Clear()
69 | {
70 | if (List.Count <= 0) return;
71 |
72 | List.Clear();
73 | OnChange?.Invoke(this, EventArgs.Empty);
74 | }
75 | }
76 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Converters/UInt32HexTypeConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 |
4 | namespace SCReverser.Core.Converters
5 | {
6 | public class UInt32HexTypeConverter : TypeConverter
7 | {
8 | public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
9 | {
10 | if (sourceType == typeof(string))
11 | {
12 | return true;
13 | }
14 | else
15 | {
16 | return base.CanConvertFrom(context, sourceType);
17 | }
18 | }
19 |
20 | public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
21 | {
22 | if (destinationType == typeof(string))
23 | {
24 | return true;
25 | }
26 | else
27 | {
28 | return base.CanConvertTo(context, destinationType);
29 | }
30 | }
31 |
32 | public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
33 | {
34 | if (destinationType == typeof(string) && value.GetType() == typeof(UInt32))
35 | {
36 | return string.Format("0x{0:X4}", value);
37 | }
38 | else
39 | {
40 | return base.ConvertTo(context, culture, value, destinationType);
41 | }
42 | }
43 |
44 | public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
45 | {
46 | if (value.GetType() == typeof(string))
47 | {
48 | string input = (string)value;
49 |
50 | if (input.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
51 | {
52 | input = input.Substring(2);
53 | }
54 |
55 | return UInt32.Parse(input, System.Globalization.NumberStyles.HexNumber, culture);
56 | }
57 | else
58 | {
59 | return base.ConvertFrom(context, culture, value);
60 | }
61 | }
62 | }
63 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Delegates/OnCheckOcurrenceDelegate.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Types;
2 |
3 | namespace SCReverser.Core.Delegates
4 | {
5 | ///
6 | /// Delegate for check ocurrences
7 | ///
8 | /// Instructions
9 | /// Name
10 | public delegate bool OnCheckOcurrenceDelegate(Instruction instruction, out string name);
11 | }
12 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Delegates/OnInstructionDelegate.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Types;
2 |
3 | namespace SCReverser.Core.Delegates
4 | {
5 | ///
6 | /// Delegate for on instruction event
7 | ///
8 | /// Debugger
9 | /// Instruction index
10 | public delegate void OnInstructionDelegate(object sender, Instruction instruction);
11 | }
12 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Delegates/OnJumpDelegate.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Interfaces;
2 | using SCReverser.Core.Types;
3 |
4 | namespace SCReverser.Core.Delegates
5 | {
6 | ///
7 | /// Delegate for check if jump happend
8 | ///
9 | /// Debugger
10 | /// Instruction
11 | public delegate uint? OnJumpDelegate(IDebugger sender, Instruction instruction);
12 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Delegates/OnMethodDelegate.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Types;
2 |
3 | namespace SCReverser.Core.Delegates
4 | {
5 | ///
6 | /// Delegate for on method event
7 | ///
8 | /// Debugger
9 | /// Method
10 | public delegate void OnMethodDelegate(object sender, Method method);
11 | }
12 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Delegates/OnModuleDelegate.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Types;
2 |
3 | namespace SCReverser.Core.Delegates
4 | {
5 | ///
6 | /// Delegate for on module event
7 | ///
8 | /// Debugger
9 | /// Module
10 | public delegate void OnModuleDelegate(object sender, Module module);
11 | }
12 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Delegates/OnProgressDelegate.cs:
--------------------------------------------------------------------------------
1 | namespace SCReverser.Core.Delegates
2 | {
3 | ///
4 | /// Progress delegate
5 | ///
6 | /// Sender
7 | /// Percent
8 | public delegate void OnProgressDelegate(object sender, int percent);
9 | }
10 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Delegates/OnStateChangedDelegate.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Enums;
2 |
3 | namespace SCReverser.Core.Delegates
4 | {
5 | ///
6 | /// Delegate for on instruction event
7 | ///
8 | /// Debugger
9 | /// Old state
10 | /// New state
11 | public delegate void OnStateChangedDelegate(object sender, DebuggerState oldState, DebuggerState newState);
12 | }
13 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Enums/DebuggerState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SCReverser.Core.Enums
4 | {
5 | [Flags]
6 | public enum DebuggerState : byte
7 | {
8 | #region Object state
9 | ///
10 | /// None
11 | ///
12 | None = 0,
13 | ///
14 | /// Disposed
15 | ///
16 | Disposed = 1,
17 | #endregion
18 |
19 | #region Debug session State
20 | ///
21 | /// In breakpoint
22 | ///
23 | BreakPoint = 2,
24 | ///
25 | /// Have any error
26 | ///
27 | Error = 4,
28 | ///
29 | /// Halt
30 | ///
31 | Halt = 8,
32 | #endregion
33 | }
34 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Enums/InstructionFlag.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SCReverser.Core.Enums
4 | {
5 | [Flags]
6 | public enum InstructionFlag : byte
7 | {
8 | #region Object state
9 | ///
10 | /// None
11 | ///
12 | None = 0,
13 | ///
14 | /// UnusableCode
15 | ///
16 | UnusableCode = 1,
17 | #endregion
18 | }
19 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Enums/OffsetIndexRelation.cs:
--------------------------------------------------------------------------------
1 | namespace SCReverser.Core.Enums
2 | {
3 | public enum OffsetIndexRelation : byte
4 | {
5 | ///
6 | /// Offset to index
7 | ///
8 | OffsetToIndex = 0,
9 | ///
10 | /// Index to offset
11 | ///
12 | IndexToOffset = 1,
13 | }
14 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Enums/OpCodeFlag.cs:
--------------------------------------------------------------------------------
1 | namespace SCReverser.Core.Enums
2 | {
3 | public enum OpCodeFlag : byte
4 | {
5 | ///
6 | /// None
7 | ///
8 | None = 0,
9 | ///
10 | /// Is call
11 | ///
12 | IsCall = 1,
13 | ///
14 | /// Is ret
15 | ///
16 | IsRet = 2,
17 | ///
18 | /// Is jump
19 | ///
20 | IsJump = 4,
21 | }
22 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Enums/RowBorderStyle.cs:
--------------------------------------------------------------------------------
1 | namespace SCReverser.Core.Enums
2 | {
3 | public enum RowBorderStyle : byte
4 | {
5 | ///
6 | /// None
7 | ///
8 | None = 0,
9 | ///
10 | /// All
11 | ///
12 | All = 1,
13 | ///
14 | /// EmptyBottom
15 | ///
16 | EmptyBottom = 2,
17 | ///
18 | /// EmptyTop
19 | ///
20 | EmptyTop = 3,
21 | ///
22 | /// OnlyLeftAndRight
23 | ///
24 | OnlyLeftAndRight = 4,
25 | }
26 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Enums/TemplateFlags.cs:
--------------------------------------------------------------------------------
1 | namespace SCReverser.Core.Enums
2 | {
3 | public enum TemplateFlags : int
4 | {
5 | ///
6 | /// None
7 | ///
8 | None = 0,
9 | ///
10 | /// Have alt stack
11 | ///
12 | HaveAltStack = 1,
13 | }
14 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Exceptions/OpCodeNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SCReverser.Core.Exceptions
4 | {
5 | public class OpCodeNotFoundException : Exception
6 | {
7 | ///
8 | /// Offset
9 | ///
10 | public uint Offset { get; set; }
11 | ///
12 | /// OpCode
13 | ///
14 | public byte[] OpCode { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/FEditConfig.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace SCReverser.Core
2 | {
3 | partial class FEditConfig
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FEditConfig));
32 | this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
33 | this.panel1 = new System.Windows.Forms.Panel();
34 | this.bCancel = new System.Windows.Forms.Button();
35 | this.bOk = new System.Windows.Forms.Button();
36 | this.panel1.SuspendLayout();
37 | this.SuspendLayout();
38 | //
39 | // propertyGrid1
40 | //
41 | resources.ApplyResources(this.propertyGrid1, "propertyGrid1");
42 | this.propertyGrid1.LineColor = System.Drawing.SystemColors.ControlDark;
43 | this.propertyGrid1.Name = "propertyGrid1";
44 | //
45 | // panel1
46 | //
47 | this.panel1.BackColor = System.Drawing.Color.White;
48 | this.panel1.Controls.Add(this.bCancel);
49 | this.panel1.Controls.Add(this.bOk);
50 | resources.ApplyResources(this.panel1, "panel1");
51 | this.panel1.Name = "panel1";
52 | //
53 | // bCancel
54 | //
55 | resources.ApplyResources(this.bCancel, "bCancel");
56 | this.bCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
57 | this.bCancel.Name = "bCancel";
58 | this.bCancel.UseVisualStyleBackColor = true;
59 | //
60 | // bOk
61 | //
62 | resources.ApplyResources(this.bOk, "bOk");
63 | this.bOk.DialogResult = System.Windows.Forms.DialogResult.OK;
64 | this.bOk.Name = "bOk";
65 | this.bOk.UseVisualStyleBackColor = true;
66 | //
67 | // FEditConfig
68 | //
69 | this.AcceptButton = this.bOk;
70 | resources.ApplyResources(this, "$this");
71 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
72 | this.CancelButton = this.bCancel;
73 | this.Controls.Add(this.propertyGrid1);
74 | this.Controls.Add(this.panel1);
75 | this.MinimizeBox = false;
76 | this.Name = "FEditConfig";
77 | this.ShowIcon = false;
78 | this.panel1.ResumeLayout(false);
79 | this.ResumeLayout(false);
80 |
81 | }
82 |
83 | #endregion
84 |
85 | private System.Windows.Forms.PropertyGrid propertyGrid1;
86 | private System.Windows.Forms.Panel panel1;
87 | private System.Windows.Forms.Button bCancel;
88 | private System.Windows.Forms.Button bOk;
89 | }
90 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/FEditConfig.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Interfaces;
2 | using System.Windows.Forms;
3 |
4 | namespace SCReverser.Core
5 | {
6 | public partial class FEditConfig : FRememberForm
7 | {
8 | ///
9 | /// Configure
10 | ///
11 | /// Config object
12 | public static bool Configure(object par)
13 | {
14 | using (FEditConfig f = new FEditConfig())
15 | {
16 | f.propertyGrid1.SelectedObject = par;
17 |
18 | if (f.ShowDialog() != DialogResult.OK)
19 | return false;
20 | }
21 |
22 | return true;
23 | }
24 | ///
25 | /// Constructor
26 | ///
27 | FEditConfig()
28 | {
29 | InitializeComponent();
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Helpers/JsonHelper.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 |
4 | namespace SCReverser.Core.Helpers
5 | {
6 | public class JsonHelper
7 | {
8 | static JsonSerializerSettings SettingsTypesNull = new JsonSerializerSettings()
9 | {
10 | ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
11 | NullValueHandling = NullValueHandling.Include,
12 | StringEscapeHandling = StringEscapeHandling.EscapeNonAscii,
13 | TypeNameHandling = TypeNameHandling.Auto,
14 | };
15 |
16 | static JsonSerializerSettings SettingsTypesNotNull = new JsonSerializerSettings()
17 | {
18 | ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
19 | NullValueHandling = NullValueHandling.Ignore,
20 | StringEscapeHandling = StringEscapeHandling.EscapeNonAscii,
21 | TypeNameHandling = TypeNameHandling.Auto,
22 | };
23 |
24 | static JsonSerializerSettings SettingsNoTypesNotNull = new JsonSerializerSettings()
25 | {
26 | ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
27 | NullValueHandling = NullValueHandling.Ignore,
28 | StringEscapeHandling = StringEscapeHandling.EscapeNonAscii,
29 | TypeNameHandling = TypeNameHandling.Auto,
30 | };
31 |
32 | ///
33 | /// Serialize
34 | ///
35 | /// Objet
36 | public static string Serialize(object obj) { return Serialize(obj, false, false); }
37 | ///
38 | /// Serialize
39 | ///
40 | /// Objet
41 | /// True for indent
42 | /// True for serialize null properties
43 | public static string Serialize(object obj, bool indent, bool serializeNull)
44 | {
45 | return JsonConvert.SerializeObject(obj, indent ? Formatting.Indented : Formatting.None, serializeNull ? SettingsTypesNull : SettingsTypesNotNull);
46 | }
47 | ///
48 | /// Deserialize
49 | ///
50 | /// Json
51 | /// Type
52 | /// With types
53 | public static object Deserialize(string json, Type tp, bool withTypes = false)
54 | {
55 | if (!string.IsNullOrEmpty(json))
56 | try
57 | {
58 | if (!withTypes)
59 | return JsonConvert.DeserializeObject(json, tp, SettingsNoTypesNotNull);
60 | else
61 | return JsonConvert.DeserializeObject(json, tp, SettingsTypesNull);
62 | }
63 | catch { }
64 |
65 | return null;
66 | }
67 | ///
68 | /// Deserialize
69 | ///
70 | /// Object
71 | /// Json
72 | /// With types
73 | public static T Deserialize(string json, bool withTypes = false)
74 | {
75 | return (T)Deserialize(json, typeof(T), withTypes);
76 | }
77 | ///
78 | /// Clone object
79 | ///
80 | /// Object for clon
81 | public static object Clone(object obj)
82 | {
83 | if (obj == null) return null;
84 |
85 | string json = Serialize(obj);
86 | return Deserialize(json, obj.GetType());
87 | }
88 | }
89 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Interfaces/FRememberForm.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Helpers;
2 | using SCReverser.Core.Remembers;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Text;
6 | using System.Windows.Forms;
7 |
8 | namespace SCReverser.Core.Interfaces
9 | {
10 | public class FRememberForm : FRememberForm
11 | {
12 | internal static Dictionary Remembers;
13 |
14 | static FRememberForm()
15 | {
16 | if (Remembers != null) return;
17 |
18 | try
19 | {
20 | string file = Path.ChangeExtension(Application.ExecutablePath, ".rem");
21 |
22 | if (File.Exists(file))
23 | try
24 | {
25 | string json = File.ReadAllText(file, Encoding.UTF8);
26 | if (!string.IsNullOrEmpty(json))
27 | {
28 | Remembers = JsonHelper.Deserialize>(json);
29 | }
30 | }
31 | catch { }
32 |
33 | }
34 | catch { }
35 |
36 | if (Remembers == null) Remembers = new Dictionary();
37 | }
38 | public FRememberForm() : base() { }
39 | }
40 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Interfaces/FRememberFormT.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Helpers;
2 | using System;
3 | using System.IO;
4 | using System.Text;
5 | using System.Windows.Forms;
6 |
7 | namespace SCReverser.Core.Interfaces
8 | {
9 | public class FRememberForm : Form where T : IRemember
10 | {
11 | bool _CloseOnEscape = true;
12 | ///
13 | /// Close on Escape
14 | ///
15 | public bool CloseOnEscape { get { return _CloseOnEscape; } set { _CloseOnEscape = value; } }
16 |
17 | public FRememberForm() { KeyPreview = true; }
18 |
19 | protected override void OnHandleCreated(EventArgs e)
20 | {
21 | base.OnHandleCreated(e);
22 |
23 | try
24 | {
25 | string json;
26 | if (FRememberForm.Remembers != null && FRememberForm.Remembers.TryGetValue(GetType().Name, out json) && json != null)
27 | {
28 | T r = JsonHelper.Deserialize(json);
29 | if (r != null) OnGetValues(r);
30 | }
31 | }
32 | catch { }
33 | }
34 | protected virtual void OnGetValues(T sender) { sender.GetValues(this); }
35 | protected virtual void OnSaveValues(T sender) { sender.SaveValues(this); }
36 | protected override void OnClosed(EventArgs e)
37 | {
38 | try
39 | {
40 | T r = Activator.CreateInstance();
41 | OnSaveValues(r);
42 |
43 | FRememberForm.Remembers[GetType().Name] = JsonHelper.Serialize(r, false, false);
44 |
45 | string file = Path.ChangeExtension(Application.ExecutablePath, ".rem");
46 | File.WriteAllText(file, JsonHelper.Serialize(FRememberForm.Remembers), Encoding.UTF8);
47 | }
48 | catch { }
49 |
50 | base.OnClosed(e);
51 | }
52 | protected override void OnKeyDown(KeyEventArgs e)
53 | {
54 | if (CloseOnEscape && e.KeyCode == Keys.Escape)
55 | {
56 | e.Handled = true;
57 | e.SuppressKeyPress = true;
58 | Close();
59 | return;
60 | }
61 |
62 | base.OnKeyDown(e);
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Interfaces/IDebugger.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Collections;
2 | using SCReverser.Core.Delegates;
3 | using SCReverser.Core.Enums;
4 | using SCReverser.Core.Types;
5 | using System;
6 |
7 | namespace SCReverser.Core.Interfaces
8 | {
9 | public interface IDebugger : IDisposable
10 | {
11 | ///
12 | /// On module changed event
13 | ///
14 | event OnModuleDelegate OnModuleChanged;
15 | ///
16 | /// On method changed event
17 | ///
18 | event OnMethodDelegate OnMethodChanged;
19 | ///
20 | /// On instruction changed event
21 | ///
22 | event OnInstructionDelegate OnInstructionChanged;
23 | ///
24 | /// On state changed
25 | ///
26 | event OnStateChangedDelegate OnStateChanged;
27 | ///
28 | /// On breakpoint raised
29 | ///
30 | event OnInstructionDelegate OnBreakPoint;
31 |
32 | #region State variables
33 | ///
34 | /// Return true if have Disposed State
35 | ///
36 | bool IsDisposed { get; }
37 | ///
38 | /// Return true if have Halt State
39 | ///
40 | bool IsHalt { get; }
41 | ///
42 | /// Return true if have Error State
43 | ///
44 | bool IsError { get; }
45 | ///
46 | /// Return true if have BreakPoint State
47 | ///
48 | bool IsBreakPoint { get; }
49 | #endregion
50 | ///
51 | /// Stack
52 | ///
53 | StackCollection Stack { get; }
54 | ///
55 | /// AltStack
56 | ///
57 | StackCollection AltStack { get; }
58 | ///
59 | /// Debugger state
60 | ///
61 | DebuggerState State { get; }
62 | ///
63 | /// Invocation stack count
64 | ///
65 | uint InvocationStackCount { get; }
66 | ///
67 | /// Current Instruction Index
68 | ///
69 | uint CurrentInstructionIndex { get; set; }
70 | ///
71 | /// Current Instruction offset
72 | ///
73 | uint CurrentInstructionOffset { get; set; }
74 | ///
75 | /// Current Instruction
76 | ///
77 | Instruction CurrentInstruction { get; set; }
78 | ///
79 | /// Modules
80 | ///
81 | ModuleCollection Modules { get; }
82 | ///
83 | /// Instructions
84 | ///
85 | InstructionCollection Instructions { get; }
86 | ///
87 | /// Current Method
88 | ///
89 | Method CurrentMethod { get; }
90 | ///
91 | /// Current Module
92 | ///
93 | Module CurrentModule { get; }
94 | ///
95 | /// Resume
96 | ///
97 | void Execute();
98 | ///
99 | /// Step into
100 | ///
101 | void StepInto();
102 | ///
103 | /// Step over
104 | ///
105 | void StepOver();
106 | ///
107 | /// Step out
108 | ///
109 | void StepOut();
110 | }
111 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Interfaces/IInitClassStream.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Types;
2 | using System.Collections.Generic;
3 |
4 | namespace SCReverser.Core.Interfaces
5 | {
6 | public interface IInitClassStream
7 | {
8 | IEnumerable GetStream();
9 | }
10 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Interfaces/IRemember.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace SCReverser.Core.Interfaces
4 | {
5 | public interface IRemember
6 | {
7 | void SaveValues(Form f);
8 | void GetValues(Form f);
9 | }
10 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Interfaces/IReverseTemplate.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Enums;
2 | using SCReverser.Core.Types;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Drawing;
6 |
7 | namespace SCReverser.Core.Interfaces
8 | {
9 | public interface IReverseTemplate
10 | {
11 | ///
12 | /// Have debugger
13 | ///
14 | bool HaveDebugger { get; }
15 | ///
16 | /// Template
17 | ///
18 | string Template { get; }
19 | ///
20 | /// Reverse type
21 | ///
22 | Type ReverserType { get; }
23 | ///
24 | /// Debugger type
25 | ///
26 | Type DebuggerType { get; }
27 | ///
28 | /// Config Type
29 | ///
30 | Type ConfigType { get; }
31 | ///
32 | /// Flags
33 | ///
34 | TemplateFlags Flags { get; }
35 |
36 | ///
37 | /// Create reverser
38 | ///
39 | IReverser CreateReverser();
40 | ///
41 | /// Create debugger
42 | ///
43 | /// Reverse result
44 | /// Config
45 | IDebugger CreateDebugger(ReverseResult result, object debugConfig);
46 | ///
47 | /// Get Logo
48 | ///
49 | Image GetLogo();
50 |
51 | ///
52 | /// Get new config type
53 | ///
54 | object CreateNewConfig();
55 | }
56 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Interfaces/IReverser.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Collections;
2 | using SCReverser.Core.Delegates;
3 | using SCReverser.Core.Types;
4 |
5 | namespace SCReverser.Core.Interfaces
6 | {
7 | public interface IReverser
8 | {
9 | ///
10 | /// OnProgress
11 | ///
12 | event OnProgressDelegate OnParseProgress;
13 |
14 | ///
15 | /// Get instructions from stream
16 | ///
17 | /// Init class
18 | /// Result
19 | bool TryParse(object initClass, ref ReverseResult result);
20 | ///
21 | /// Process instruction
22 | ///
23 | /// Bag
24 | /// Instruction
25 | /// Cache
26 | void ProcessInstruction(InstructionCollection bag, Instruction ins, OffsetRelationCache offsetToIndexCache);
27 | }
28 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Interfaces/IStartEnd.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Types;
2 |
3 | namespace SCReverser.Core.Interfaces
4 | {
5 | public interface IStartEnd
6 | {
7 | ///
8 | /// Start
9 | ///
10 | IndexOffset Start { get; }
11 | ///
12 | /// End
13 | ///
14 | IndexOffset End { get; }
15 | }
16 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Interfaces/IWritable.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace SCReverser.Core.Interfaces
4 | {
5 | public interface IWritable
6 | {
7 | ///
8 | /// Size
9 | ///
10 | uint Size { get; }
11 | ///
12 | /// Write
13 | ///
14 | /// Stream
15 | uint Write(Stream stream);
16 | }
17 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Interfaces/ReverseTemplateT2.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Enums;
2 | using SCReverser.Core.Types;
3 | using System;
4 | using System.Drawing;
5 |
6 | namespace SCReverser.Core.Interfaces
7 | {
8 | public class ReverseTemplate : IReverseTemplate
9 | where ReverserT : IReverser
10 | where CfgType : class, new()
11 | {
12 | ///
13 | /// Template
14 | ///
15 | public virtual string Template => throw new NotImplementedException();
16 |
17 | ///
18 | /// Reverser
19 | ///
20 | public Type ReverserType => typeof(ReverserT);
21 | ///
22 | /// Debugger
23 | ///
24 | public Type DebuggerType => null;
25 | ///
26 | /// Have debugger
27 | ///
28 | public bool HaveDebugger { get { return false; } }
29 | ///
30 | /// Config Type
31 | ///
32 | public Type ConfigType { get { return typeof(CfgType); } }
33 | ///
34 | /// Flags
35 | ///
36 | public virtual TemplateFlags Flags { get { return TemplateFlags.None; } }
37 |
38 | ///
39 | /// Constructor
40 | ///
41 | protected ReverseTemplate() { }
42 |
43 | ///
44 | /// Create reverser
45 | ///
46 | public virtual ReverserT CreateReverser()
47 | {
48 | return Activator.CreateInstance();
49 | }
50 | IReverser IReverseTemplate.CreateReverser()
51 | {
52 | ReverserT r = CreateReverser();
53 | return r;
54 | }
55 | public virtual IDebugger CreateDebugger(ReverseResult result, object debugConfig)
56 | {
57 | throw new NotImplementedException();
58 | }
59 | ///
60 | /// Get new config Type
61 | ///
62 | public virtual object CreateNewConfig()
63 | {
64 | return Activator.CreateInstance();
65 | }
66 | ///
67 | /// Get logo
68 | ///
69 | public virtual Image GetLogo() { return null; }
70 | }
71 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Interfaces/ReverseTemplateT3.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Enums;
2 | using SCReverser.Core.Types;
3 | using System;
4 | using System.Drawing;
5 |
6 | namespace SCReverser.Core.Interfaces
7 | {
8 | public class ReverseTemplate : IReverseTemplate
9 | where ReverserT : IReverser
10 | where DebuggerT : IDebugger
11 | where CfgType : class, new()
12 | {
13 | ///
14 | /// Template
15 | ///
16 | public virtual string Template => throw new NotImplementedException();
17 |
18 | ///
19 | /// Reverser
20 | ///
21 | public Type ReverserType => typeof(ReverserT);
22 | ///
23 | /// Debugger
24 | ///
25 | public Type DebuggerType => typeof(DebuggerT);
26 | ///
27 | /// Have debugger
28 | ///
29 | public bool HaveDebugger { get { return true; } }
30 | ///
31 | /// Config Type
32 | ///
33 | public Type ConfigType { get { return typeof(CfgType); } }
34 | ///
35 | /// Flags
36 | ///
37 | public virtual TemplateFlags Flags { get { return TemplateFlags.None; } }
38 | ///
39 | /// Constructor
40 | ///
41 | protected ReverseTemplate() { }
42 |
43 | ///
44 | /// Create reverser
45 | ///
46 | public virtual ReverserT CreateReverser()
47 | {
48 | return Activator.CreateInstance();
49 | }
50 | ///
51 | /// Create debugger
52 | ///
53 | /// Reverse result
54 | /// Debugger config
55 | public virtual DebuggerT CreateDebugger(ReverseResult result, object debugConfig)
56 | {
57 | return (DebuggerT)Activator.CreateInstance(typeof(DebuggerT), new object[] { result, debugConfig });
58 | }
59 | IReverser IReverseTemplate.CreateReverser()
60 | {
61 | ReverserT t = CreateReverser();
62 | return t;
63 | }
64 | IDebugger IReverseTemplate.CreateDebugger(ReverseResult result, object debugConfig)
65 | {
66 | DebuggerT t = CreateDebugger(result, debugConfig);
67 | return t;
68 | }
69 | ///
70 | /// Get new config type
71 | ///
72 | public virtual object CreateNewConfig()
73 | {
74 | return Activator.CreateInstance();
75 | }
76 | ///
77 | /// Get logo
78 | ///
79 | public virtual Image GetLogo() { return null; }
80 | }
81 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/OpCodeArguments/OpCodeByteArgument.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SCReverser.Core.OpCodeArguments
4 | {
5 | public class OpCodeByteArgument : OpCodeByteArrayArgument
6 | {
7 | ///
8 | /// Value
9 | ///
10 | [JsonIgnore]
11 | public byte Value
12 | {
13 | get { return RawValue[0]; }
14 | set { RawValue[0] = value; }
15 | }
16 | ///
17 | /// Constructor
18 | ///
19 | public OpCodeByteArgument() : base(1) { }
20 | }
21 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/OpCodeArguments/OpCodeByteArrayArgument.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System.IO;
3 | using System.Text;
4 |
5 | namespace SCReverser.Core.OpCodeArguments
6 | {
7 | public class OpCodeByteArrayArgument : OpCodeEmptyArgument
8 | {
9 | ///
10 | /// Length
11 | ///
12 | [JsonIgnore]
13 | public int Length { get { return RawValue == null ? 0 : RawValue.Length; } }
14 |
15 | ///
16 | /// Constructor
17 | ///
18 | /// Length
19 | public OpCodeByteArrayArgument(int length)
20 | {
21 | RawValue = new byte[length];
22 | }
23 | ///
24 | /// Read from stream
25 | ///
26 | /// Stream
27 | public override uint Read(Stream stream)
28 | {
29 | int lee = stream.Read(RawValue, 0, Length);
30 | if (lee != Length) throw (new EndOfStreamException());
31 |
32 | return (uint)lee;
33 | }
34 | ///
35 | /// String representation
36 | ///
37 | public override string ToString()
38 | {
39 | StringBuilder sb = new StringBuilder();
40 |
41 | if (RawValue != null && RawValue.Length > 0)
42 | {
43 | sb.Append("0x");
44 |
45 | foreach (byte b in RawValue)
46 | sb.Append(b.ToString("X2"));
47 | }
48 |
49 | return sb.ToString();
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/OpCodeArguments/OpCodeByteArrayFromByteArgument.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace SCReverser.Core.OpCodeArguments
4 | {
5 | public class OpCodeByteArrayFromByteArgument : OpCodeByteArrayArgument
6 | {
7 | public override uint Size => base.Size + 1;
8 |
9 | ///
10 | /// Constructor
11 | ///
12 | public OpCodeByteArrayFromByteArgument() : base(0) { }
13 |
14 | public override uint Read(Stream stream)
15 | {
16 | int r = stream.ReadByte();
17 | RawValue = new byte[r];
18 | return base.Read(stream) + 1;
19 | }
20 |
21 | public override uint Write(Stream stream)
22 | {
23 | stream.WriteByte((byte)RawValue.Length);
24 | return base.Write(stream);
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/OpCodeArguments/OpCodeByteArrayFromIntArgument.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Extensions;
2 | using System.IO;
3 |
4 | namespace SCReverser.Core.OpCodeArguments
5 | {
6 | public class OpCodeByteArrayFromIntArgument : OpCodeByteArrayArgument
7 | {
8 | public override uint Size => base.Size + 4;
9 |
10 | ///
11 | /// Constructor
12 | ///
13 | public OpCodeByteArrayFromIntArgument() : base(4) { }
14 |
15 | public override uint Read(Stream stream)
16 | {
17 | RawValue = new byte[4];
18 | stream.Read(RawValue, 0, 4);
19 |
20 | RawValue = new byte[RawValue.ToInt32()];
21 | return base.Read(stream) + 4;
22 | }
23 |
24 | public override uint Write(Stream stream)
25 | {
26 | stream.Write(RawValue.Length.ToByteArray(), 0, 4);
27 | return base.Write(stream) + 4;
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/OpCodeArguments/OpCodeByteArrayFromUShortArgument.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Extensions;
2 | using System.IO;
3 |
4 | namespace SCReverser.Core.OpCodeArguments
5 | {
6 | public class OpCodeByteArrayFromUShortArgument : OpCodeByteArrayArgument
7 | {
8 | public override uint Size => base.Size + 2;
9 |
10 | ///
11 | /// Constructor
12 | ///
13 | public OpCodeByteArrayFromUShortArgument() : base(2) { }
14 |
15 | public override uint Read(Stream stream)
16 | {
17 | RawValue = new byte[2];
18 | stream.Read(RawValue, 0, 2);
19 |
20 | RawValue = new byte[RawValue.ToUInt16()];
21 | return base.Read(stream) + 2;
22 | }
23 |
24 | public override uint Write(Stream stream)
25 | {
26 | stream.Write(((ushort)RawValue.Length).ToByteArray(), 0, 2);
27 | return base.Write(stream) + 2;
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/OpCodeArguments/OpCodeCall_IArgument.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using SCReverser.Core.Extensions;
3 |
4 | namespace SCReverser.Core.OpCodeArguments
5 | {
6 | public class OpCodeCall_IArgument : OpCodeByteArrayArgument
7 | {
8 | ///
9 | /// Value
10 | ///
11 | [JsonIgnore]
12 | public virtual byte RVcount
13 | {
14 | get { return RawValue[0]; }
15 | set { RawValue[0] = value; }
16 | }
17 |
18 | ///
19 | /// Value
20 | ///
21 | [JsonIgnore]
22 | public virtual byte Pcount
23 | {
24 | get { return RawValue[1]; }
25 | set { RawValue[1] = value; }
26 | }
27 |
28 | ///
29 | /// Value
30 | ///
31 | [JsonIgnore]
32 | public virtual short Value
33 | {
34 | get { return RawValue.ToInt16(2); }
35 | set
36 | {
37 | var ret = value.ToByteArray();
38 | RawValue[2] = ret[0];
39 | RawValue[3] = ret[1];
40 | }
41 | }
42 | ///
43 | /// Constructor
44 | ///
45 | public OpCodeCall_IArgument() : base(4) { }
46 | }
47 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/OpCodeArguments/OpCodeEmptyArgument.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using SCReverser.Core.Interfaces;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace SCReverser.Core.OpCodeArguments
7 | {
8 | ///
9 | /// Empty OpCode argument
10 | ///
11 | public class OpCodeEmptyArgument : IWritable
12 | {
13 | ///
14 | /// Size
15 | ///
16 | [JsonIgnore]
17 | public virtual uint Size
18 | {
19 | get
20 | {
21 | return RawValue == null ? 0 : (uint)RawValue.Length;
22 | }
23 | }
24 | ///
25 | /// Raw value
26 | ///
27 | public byte[] RawValue { get; set; }
28 | ///
29 | /// Ascii value
30 | ///
31 | [JsonIgnore]
32 | public string ASCIIValue
33 | {
34 | get
35 | {
36 | if (RawValue != null)
37 | {
38 | foreach (byte b in RawValue)
39 | if (char.IsControl((char)b) && !char.IsWhiteSpace((char)b))
40 | return "";
41 |
42 | string ret = Encoding.ASCII.GetString(RawValue).Trim();
43 | return string.IsNullOrEmpty(ret.Trim('?')) ? "" : ret;
44 | }
45 |
46 | return "";
47 | }
48 | }
49 | ///
50 | /// Read data from stream
51 | ///
52 | /// Stream
53 | public virtual uint Read(Stream stream)
54 | {
55 | return 0;
56 | }
57 | ///
58 | /// Write
59 | ///
60 | /// Stream
61 | public virtual uint Write(Stream stream)
62 | {
63 | int l = RawValue == null ? 0 : RawValue.Length;
64 | if (l > 0) stream.Write(RawValue, 0, l);
65 |
66 | return (uint)l;
67 | }
68 | ///
69 | /// String representation
70 | ///
71 | public override string ToString()
72 | {
73 | return "";
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/OpCodeArguments/OpCodeIntArgument.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using SCReverser.Core.Extensions;
3 |
4 | namespace SCReverser.Core.OpCodeArguments
5 | {
6 | public class OpCodeIntArgument : OpCodeByteArrayArgument
7 | {
8 | ///
9 | /// Value
10 | ///
11 | [JsonIgnore]
12 | public int Value
13 | {
14 | get { return RawValue.ToInt32(0); }
15 | set { RawValue = value.ToByteArray(); }
16 | }
17 | ///
18 | /// Constructor
19 | ///
20 | public OpCodeIntArgument() : base(4) { }
21 | }
22 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/OpCodeArguments/OpCodeShortArgument.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using SCReverser.Core.Extensions;
3 |
4 | namespace SCReverser.Core.OpCodeArguments
5 | {
6 | public class OpCodeShortArgument : OpCodeByteArrayArgument
7 | {
8 | ///
9 | /// Value
10 | ///
11 | [JsonIgnore]
12 | public virtual short Value
13 | {
14 | get { return RawValue.ToInt16(); }
15 | set { RawValue = value.ToByteArray(); }
16 | }
17 | ///
18 | /// Constructor
19 | ///
20 | public OpCodeShortArgument() : base(2) { }
21 | }
22 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/OpCodeArguments/OpCodeShortArgumentBigEndian.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using SCReverser.Core.Extensions;
3 | using System;
4 |
5 | namespace SCReverser.Core.OpCodeArguments
6 | {
7 | public class OpCodeShortArgumentBigEndian : OpCodeShortArgument
8 | {
9 | ///
10 | /// Value
11 | ///
12 | [JsonIgnore]
13 | public override short Value
14 | {
15 | get { return RawValue.ToInt16BigEndian(); }
16 | set
17 | {
18 | RawValue = value.ToByteArray();
19 | Array.Reverse(RawValue);
20 | }
21 | }
22 | ///
23 | /// Constructor
24 | ///
25 | public OpCodeShortArgumentBigEndian() { }
26 | }
27 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/OpCodeArguments/OpCodeUShortArgument.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using SCReverser.Core.Extensions;
3 |
4 | namespace SCReverser.Core.OpCodeArguments
5 | {
6 | public class OpCodeUShortArgument : OpCodeByteArrayArgument
7 | {
8 | ///
9 | /// Value
10 | ///
11 | [JsonIgnore]
12 | public virtual ushort Value
13 | {
14 | get { return RawValue.ToUInt16(); }
15 | set { RawValue = value.ToByteArray(); }
16 | }
17 | ///
18 | /// Constructor
19 | ///
20 | public OpCodeUShortArgument() : base(2) { }
21 | }
22 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/OpCodeArguments/OpCodeUShortArgumentBigEndian.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using SCReverser.Core.Extensions;
3 | using System;
4 |
5 | namespace SCReverser.Core.OpCodeArguments
6 | {
7 | public class OpCodeUShortArgumentBigEndian : OpCodeUShortArgument
8 | {
9 | ///
10 | /// Value
11 | ///
12 | [JsonIgnore]
13 | public override ushort Value
14 | {
15 | get { return RawValue.ToUInt16BigEndian(); }
16 | set
17 | {
18 | RawValue = value.ToByteArray();
19 | Array.Reverse(RawValue);
20 | }
21 | }
22 | ///
23 | /// Constructor
24 | ///
25 | public OpCodeUShortArgumentBigEndian() { }
26 | }
27 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // La información general de un ensamblado se controla mediante el siguiente
6 | // conjunto de atributos. Cambie estos valores de atributo para modificar la información
7 | // asociada con un ensamblado.
8 | [assembly: AssemblyTitle("SCReverser.Core")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SCReverser.Core")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles
18 | // para los componentes COM. Si es necesario obtener acceso a un tipo en este ensamblado desde
19 | // COM, establezca el atributo ComVisible en true en este tipo.
20 | [assembly: ComVisible(false)]
21 |
22 | // El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM.
23 | [assembly: Guid("7a10fe6e-4245-4ac2-a7c2-1c59eb67b8fd")]
24 |
25 | // La información de versión de un ensamblado consta de los cuatro valores siguientes:
26 | //
27 | // Versión principal
28 | // Versión secundaria
29 | // Número de compilación
30 | // Revisión
31 | //
32 | // Puede especificar todos los valores o usar los números de compilación y de revisión predeterminados
33 | // mediante el carácter "*", como se muestra a continuación:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Remembers/RememberForm.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Interfaces;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 |
5 | namespace SCReverser.Core.Remembers
6 | {
7 | public class RememberForm : IRemember
8 | {
9 | public Point Location { get; set; }
10 | public Size Size { get; set; }
11 | public FormWindowState State { get; set; }
12 |
13 | public RememberForm() { }
14 |
15 | public virtual void SaveValues(Form f)
16 | {
17 | State = f.WindowState;
18 | Location = f.Location;
19 | Size = f.Size;
20 | }
21 | public virtual void GetValues(Form f)
22 | {
23 | if (Size != Size.Empty && Size.Width > 0 && Size.Height > 0) f.Size = Size;
24 |
25 | f.Location = Location;
26 | f.WindowState = State;
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Types/IndexOffset.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using SCReverser.Core.Helpers;
3 |
4 | namespace SCReverser.Core.Types
5 | {
6 | public class IndexOffset
7 | {
8 | ///
9 | /// Index
10 | ///
11 | public uint Index { get; set; }
12 | ///
13 | /// Offset
14 | ///
15 | public uint Offset { get; set; }
16 | ///
17 | /// OffsetHex
18 | ///
19 | [JsonIgnore]
20 | public string OffsetHex { get { return "0x" + Offset.ToString("X4"); } }
21 |
22 | ///
23 | /// Index between
24 | ///
25 | /// From
26 | /// To
27 | public bool IndexBetween(uint from, uint to)
28 | {
29 | return Index >= from && Index <= to;
30 | }
31 | ///
32 | /// Offset between
33 | ///
34 | /// From
35 | /// To
36 | public bool OffsetBetween(uint from, uint to)
37 | {
38 | return Offset >= from && Offset <= to;
39 | }
40 | ///
41 | /// String representation
42 | ///
43 | public override string ToString()
44 | {
45 | return JsonHelper.Serialize(this);
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Types/Instruction.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using SCReverser.Core.Enums;
3 | using SCReverser.Core.Interfaces;
4 | using SCReverser.Core.OpCodeArguments;
5 | using System.Drawing;
6 | using System.IO;
7 |
8 | namespace SCReverser.Core.Types
9 | {
10 | public class Instruction : IWritable
11 | {
12 | ///
13 | /// Size
14 | ///
15 | [JsonIgnore]
16 | public uint Size
17 | {
18 | get
19 | {
20 | uint l = 0;
21 |
22 | // Write OpCode
23 | if (OpCode != null) l += OpCode.Size;
24 |
25 | // Write arguments
26 | if (Argument != null) l += Argument.Size;
27 |
28 | return l;
29 | }
30 | }
31 | ///
32 | /// Instruction index
33 | ///
34 | public IndexOffset Location { get; private set; } = new IndexOffset();
35 | ///
36 | /// Offset Hex
37 | ///
38 | [JsonIgnore]
39 | public string OffsetHex { get { return Location.OffsetHex; } }
40 | ///
41 | /// OpCode
42 | ///
43 | public OpCode OpCode { get; set; }
44 | ///
45 | /// Argument (could be null)
46 | ///
47 | public OpCodeEmptyArgument Argument { get; set; }
48 | ///
49 | /// Comment
50 | ///
51 | public string Comment { get; set; }
52 | ///
53 | /// Have BreakPoint
54 | ///
55 | public bool BreakPoint { get; set; }
56 | ///
57 | /// Jump
58 | ///
59 | [JsonIgnore]
60 | public Jump Jump { get; set; }
61 | ///
62 | /// Color
63 | ///
64 | public Color Color { get; set; } = Color.Empty;
65 | ///
66 | /// Border style
67 | ///
68 | [JsonIgnore]
69 | public RowBorderStyle BorderStyle { get; set; } = RowBorderStyle.None;
70 | ///
71 | /// Instruction flag
72 | ///
73 | [JsonIgnore]
74 | public InstructionFlag Flags { get; set; } = InstructionFlag.None;
75 |
76 | ///
77 | /// Set color from his flags
78 | ///
79 | public void ApplyColorForFlags()
80 | {
81 | if (Flags.HasFlag(InstructionFlag.UnusableCode))
82 | Color = Color.FromArgb(10, Color.Black);
83 | }
84 | ///
85 | /// Write instruction
86 | ///
87 | /// Stream
88 | public virtual uint Write(Stream stream)
89 | {
90 | uint l = 0;
91 |
92 | // Write OpCode
93 | if (OpCode != null) l += OpCode.Write(stream);
94 |
95 | // Write arguments
96 | if (Argument != null) l += Argument.Write(stream);
97 |
98 | return l;
99 | }
100 | ///
101 | /// String representation
102 | ///
103 | public override string ToString()
104 | {
105 | string arg = Argument == null ? "" : Argument.ToString();
106 |
107 | if (string.IsNullOrEmpty(arg)) arg = OpCode.ToString();
108 | else arg = OpCode.ToString() + " [" + arg + "]";
109 |
110 | if (!string.IsNullOrEmpty(Comment))
111 | arg += " # " + Comment;
112 |
113 | return "[" + OffsetHex + "] " + arg;
114 | }
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Types/Jump.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using SCReverser.Core.Delegates;
3 | using SCReverser.Core.Helpers;
4 | using SCReverser.Core.Interfaces;
5 | using System.Drawing.Drawing2D;
6 |
7 | namespace SCReverser.Core.Types
8 | {
9 | public class Jump
10 | {
11 | OnJumpDelegate _Checker;
12 |
13 | ///
14 | /// Offset
15 | ///
16 | public IndexOffset To { get; private set; }
17 |
18 | ///
19 | /// Checker
20 | ///
21 | [JsonIgnore]
22 | public OnJumpDelegate Checker
23 | {
24 | get { return _Checker; }
25 | }
26 | ///
27 | /// Is Dynamic
28 | ///
29 | [JsonIgnore]
30 | public bool IsDynamic
31 | {
32 | get { return _Checker != null; }
33 | }
34 | ///
35 | /// Style
36 | ///
37 | public DashStyle Style { get; set; } = DashStyle.Solid;
38 |
39 | ///
40 | /// Check
41 | ///
42 | /// Debugger
43 | public bool Check(IDebugger debug, Instruction ins)
44 | {
45 | if (_Checker == null)
46 | {
47 | To = null;
48 | return false;
49 | }
50 |
51 | uint? offset = _Checker.Invoke(debug, ins);
52 | if (offset.HasValue)
53 | {
54 | if (debug.Instructions.OffsetToIndex(offset.Value, out uint ix))
55 | {
56 | To = new IndexOffset() { Index = ix, Offset = offset.Value };
57 | return true;
58 | }
59 | }
60 |
61 | To = null;
62 | return false;
63 | }
64 |
65 | ///
66 | /// Jump
67 | ///
68 | public Jump(uint offset, uint index)
69 | {
70 | To = new IndexOffset() { Offset = offset, Index = index };
71 | }
72 | ///
73 | /// Constructor
74 | ///
75 | public Jump(OnJumpDelegate checker)
76 | {
77 | _Checker = checker;
78 | }
79 | ///
80 | /// String representation
81 | ///
82 | public override string ToString()
83 | {
84 | return JsonHelper.Serialize(this);
85 | }
86 | }
87 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Types/Method.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using SCReverser.Core.Interfaces;
3 | using System.Drawing;
4 |
5 | namespace SCReverser.Core.Types
6 | {
7 | public class Method: IStartEnd
8 | {
9 | ///
10 | /// Name
11 | ///
12 | public string Name { get; set; }
13 | ///
14 | /// Start
15 | ///
16 | public IndexOffset Start { get; set; }
17 | ///
18 | /// End
19 | ///
20 | public IndexOffset End { get; set; }
21 | ///
22 | /// Color
23 | ///
24 | public Color Color { get; set; } = Color.Empty;
25 | ///
26 | /// Size
27 | ///
28 | public uint Size { get; set; }
29 | ///
30 | /// Parent
31 | ///
32 | [JsonIgnore]
33 | public Module Parent { get; internal set; } = null;
34 | ///
35 | /// String representation
36 | ///
37 | public override string ToString()
38 | {
39 | return Name;
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Types/Module.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Collections;
2 | using SCReverser.Core.Interfaces;
3 | using System.Drawing;
4 |
5 | namespace SCReverser.Core.Types
6 | {
7 | public class Module: IStartEnd
8 | {
9 | ///
10 | /// Name
11 | ///
12 | public string Name { get; set; }
13 | ///
14 | /// Hash
15 | ///
16 | public string Hash { get; set; }
17 | ///
18 | /// Start
19 | ///
20 | public IndexOffset Start { get; set; }
21 | ///
22 | /// End
23 | ///
24 | public IndexOffset End { get; set; }
25 | ///
26 | /// Size
27 | ///
28 | public uint Size { get; set; }
29 | ///
30 | /// Method Collection
31 | ///
32 | public MethodCollection Methods { get; private set; }
33 | ///
34 | /// Color
35 | ///
36 | public Color Color { get; set; } = Color.Empty;
37 |
38 | ///
39 | /// Constructor
40 | ///
41 | public Module()
42 | {
43 | Methods = new MethodCollection(this);
44 | }
45 |
46 | ///
47 | /// String representation
48 | ///
49 | public override string ToString()
50 | {
51 | return Name;
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Types/Ocurrence.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Collections;
2 | using SCReverser.Core.Helpers;
3 |
4 | namespace SCReverser.Core.Types
5 | {
6 | public class Ocurrence
7 | {
8 | ///
9 | /// Count
10 | ///
11 | public int Count { get { return Instructions.Count; } }
12 | ///
13 | /// Value
14 | ///
15 | public string Value { get; set; }
16 | ///
17 | /// Instructions
18 | ///
19 | public InstructionCollection Instructions { get; private set; } = new InstructionCollection();
20 |
21 | ///
22 | /// String representation
23 | ///
24 | public override string ToString()
25 | {
26 | return JsonHelper.Serialize(this);
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Types/OcurrenceParams.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Windows.Forms.DataVisualization.Charting;
3 |
4 | namespace SCReverser.Core.Types
5 | {
6 | public class OcurrenceParams
7 | {
8 | ///
9 | /// On chart event
10 | ///
11 | /// Ocurrences
12 | /// Chart
13 | public virtual void OnChart(IEnumerable oc, Chart chart)
14 | {
15 |
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Types/OpCode.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using SCReverser.Core.Enums;
3 | using SCReverser.Core.Interfaces;
4 | using System.IO;
5 |
6 | namespace SCReverser.Core.Types
7 | {
8 | public class OpCode : IWritable
9 | {
10 | ///
11 | /// Size
12 | ///
13 | [JsonIgnore]
14 | public uint Size
15 | {
16 | get
17 | {
18 | return RawValue == null ? 0 : (uint)RawValue.Length;
19 | }
20 | }
21 | ///
22 | /// Value
23 | ///
24 | public byte[] RawValue { get; set; }
25 | ///
26 | /// OpCode name
27 | ///
28 | public string Name { get; set; }
29 | ///
30 | /// OpCode Description
31 | ///
32 | public string Description { get; set; }
33 | ///
34 | /// Flag
35 | ///
36 | public OpCodeFlag Flags { get; set; }
37 |
38 | ///
39 | /// Write OpCode
40 | ///
41 | /// Stream
42 | public uint Write(Stream stream)
43 | {
44 | int l = RawValue == null ? 0 : RawValue.Length;
45 | if (l > 0) stream.Write(RawValue, 0, l);
46 |
47 | return (uint)l;
48 | }
49 | ///
50 | /// String representation
51 | ///
52 | public override string ToString()
53 | {
54 | return Name;
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Types/ReverseResult.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using SCReverser.Core.Collections;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System;
6 | using SCReverser.Core.Enums;
7 |
8 | namespace SCReverser.Core.Types
9 | {
10 | public class ReverseResult
11 | {
12 | ///
13 | /// Bytes
14 | ///
15 | [JsonIgnore]
16 | public byte[] Bytes { get; set; }
17 | ///
18 | /// Modules
19 | ///
20 | public ModuleCollection Modules { get; private set; } = new ModuleCollection();
21 | ///
22 | /// Instructions
23 | ///
24 | public InstructionCollection Instructions { get; private set; } = new InstructionCollection();
25 | ///
26 | /// Ocurrences
27 | ///
28 | [JsonIgnore]
29 | public KeyValueCollection Ocurrences { get; private set; } = new KeyValueCollection();
30 |
31 | ///
32 | /// Calculate ocurrences
33 | ///
34 | public void GenerateOcurrences()
35 | {
36 | foreach (string key in Ocurrences.Keys.ToArray())
37 | {
38 | OcurrenceCollection ocur = Ocurrences[key];
39 |
40 | // Fill
41 | Parallel.ForEach(Instructions, (ins) =>
42 | {
43 | if (ocur.Checker != null && ocur.Checker(ins, out string val))
44 | lock (ocur) ocur.Append(val, ins);
45 | });
46 |
47 | // Clean
48 | if (Ocurrences[key].Count <= 0)
49 | Ocurrences.Remove(key);
50 | }
51 | }
52 | ///
53 | /// Style borders instructions
54 | ///
55 | public void StyleMethodBorders()
56 | {
57 | foreach (Module mod in Modules) foreach (Method met in mod.Methods)
58 | {
59 | met.Size = 0;
60 | Instruction first = null;
61 | foreach (Instruction i in Instructions.Take(met.Start, met.End))
62 | {
63 | if (first == null)
64 | {
65 | first = i;
66 |
67 | if (!string.IsNullOrEmpty(i.Comment))
68 | i.Comment = met.Name + " [" + i.Comment + "]";
69 | else
70 | i.Comment = met.Name;
71 |
72 | first.BorderStyle = RowBorderStyle.EmptyBottom;
73 | }
74 | else
75 | {
76 | first = i;
77 | first.BorderStyle = RowBorderStyle.OnlyLeftAndRight;
78 | }
79 | met.Size += i.Size;
80 | }
81 | if (first != null)
82 | {
83 | first.BorderStyle = first.BorderStyle == RowBorderStyle.EmptyBottom ? RowBorderStyle.All : RowBorderStyle.EmptyTop;
84 | }
85 | }
86 | }
87 | }
88 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Types/StackItem.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Helpers;
2 |
3 | namespace SCReverser.Core.Types
4 | {
5 | public class StackItem
6 | {
7 | ///
8 | /// Value
9 | ///
10 | public object Value { get; set; }
11 | ///
12 | /// Json Value
13 | ///
14 | public virtual string PrintableValue
15 | {
16 | get
17 | {
18 | if (Value == null) return "";
19 | return JsonHelper.Serialize(Value);
20 | }
21 | }
22 | ///
23 | /// Compare
24 | ///
25 | /// Object
26 | public override bool Equals(object obj)
27 | {
28 | if (obj == null || !(obj is StackItem i)) return false;
29 | return i.Value == Value;
30 | }
31 | ///
32 | /// Dummy hashcode
33 | ///
34 | public override int GetHashCode()
35 | {
36 | if (Value == null) return 0;
37 | return 1;
38 | }
39 | ///
40 | /// String representation
41 | ///
42 | public override string ToString()
43 | {
44 | return PrintableValue;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Types/StreamModule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.IO;
4 |
5 | namespace SCReverser.Core.Types
6 | {
7 | public class StreamModule : IDisposable
8 | {
9 | ///
10 | /// Name
11 | ///
12 | public string Name { get; private set; }
13 | ///
14 | /// Stream
15 | ///
16 | public Stream Stream { get; private set; }
17 | ///
18 | /// Leave stream open
19 | ///
20 | public bool LeaveStreamOpen { get; private set; }
21 | ///
22 | /// Color
23 | ///
24 | public Color Color { get; set; } = Color.Empty;
25 |
26 | ///
27 | /// Constructor
28 | ///
29 | /// Name
30 | /// Stream
31 | /// LeaveOpen
32 | public StreamModule(string name,Stream stream,bool leaveOpen)
33 | {
34 | LeaveStreamOpen = leaveOpen;
35 | Stream = stream;
36 | Name = name;
37 | }
38 | ///
39 | /// Free resources
40 | ///
41 | public void Dispose()
42 | {
43 | if (LeaveStreamOpen) return;
44 | if (Stream!=null)
45 | {
46 | Stream.Close();
47 | Stream.Dispose();
48 | }
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/Types/UnusableCodeChartParams.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Windows.Forms.DataVisualization.Charting;
3 |
4 | namespace SCReverser.Core.Types
5 | {
6 | public class UnusableCodeChartParams : OcurrenceParams
7 | {
8 | ///
9 | /// Result
10 | ///
11 | public ReverseResult Result { get; set; }
12 |
13 | ///
14 | /// Constructor
15 | ///
16 | /// Result
17 | public UnusableCodeChartParams(ReverseResult result)
18 | {
19 | Result = result;
20 | }
21 | ///
22 | /// On chart event
23 | ///
24 | /// Ocurrences
25 | /// Chart
26 | public override void OnChart(IEnumerable oc, Chart chart)
27 | {
28 | Series sPie = chart.Series[1];
29 | sPie.Points.Clear();
30 |
31 | // Calculate size
32 |
33 | long total = Result != null && Result.Bytes != null ? Result.Bytes.Length : 0;
34 | if (total <= 0) return;
35 |
36 | long size = 0;
37 |
38 | foreach (Ocurrence o in oc)
39 | foreach (Instruction i in o.Instructions)
40 | size += i.Size;
41 |
42 | sPie.XValueMember = "Type";
43 | sPie.YValueMembers = "%";
44 |
45 | sPie.Points.AddXY((((total - size) * 100.0) / total).ToString("0.00 '%'"), total);
46 | sPie.Points.AddXY("Unusable " + (((size) * 100.0) / total).ToString("0.00 '%'"), size);
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Core/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.NEO/FOpen.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Interfaces;
2 | using SCReverser.NEO.Internals;
3 | using System;
4 | using System.Windows.Forms;
5 |
6 | namespace SCReverser.NEO
7 | {
8 | public partial class FOpen : FOpenBase
9 | {
10 | ///
11 | /// Show form
12 | ///
13 | public static bool ShowForm(out NeoConfig config)
14 | {
15 | using (FOpen f = new FOpen())
16 | {
17 | if (f.ShowDialog() != DialogResult.OK)
18 | {
19 | config = null;
20 | return false;
21 | }
22 |
23 | config = new NeoConfig();
24 | config.SaveValues(f);
25 | config.EnableBlockChain = true;
26 |
27 | config.BlockChainPath = f.txtBlockChain.Text;
28 | }
29 |
30 | return true;
31 | }
32 | ///
33 | /// Constructor
34 | ///
35 | FOpen()
36 | {
37 | InitializeComponent();
38 |
39 | foreach (object o in Enum.GetValues(typeof(ETriggerType))) scriptType.Items.Add(o);
40 | scriptType.SelectedIndex = 0;
41 | }
42 | ///
43 | /// Search dialog
44 | ///
45 | void button1_Click(object sender, EventArgs e)
46 | {
47 | if (openFileDialog1.ShowDialog() != DialogResult.OK) return;
48 |
49 | if (sender == button1) txtScript.Text = openFileDialog1.FileName;
50 | else if (sender == button2) txtArguments.Text = openFileDialog1.FileName;
51 | }
52 | void button3_Click(object sender, EventArgs e)
53 | {
54 | try
55 | {
56 | folderBrowserDialog1.SelectedPath = txtBlockChain.Text;
57 | }
58 | catch { }
59 |
60 | if (folderBrowserDialog1.ShowDialog() != DialogResult.OK) return;
61 |
62 | txtBlockChain.Text = folderBrowserDialog1.SelectedPath;
63 | }
64 | }
65 | public class FOpenBase : FRememberForm { }
66 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.NEO/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
1 | // This file is used by Code Analysis to maintain SuppressMessage
2 | // attributes that are applied to this project.
3 | // Project-level suppressions either have no target or are given
4 | // a specific target and scoped to a namespace, type, member, etc.
5 |
6 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles")]
--------------------------------------------------------------------------------
/SCReverser/SCReverser.NEO/Internals/CachedScriptTable.cs:
--------------------------------------------------------------------------------
1 | using Neo;
2 | using Neo.Core;
3 | using Neo.IO.Caching;
4 | using Neo.VM;
5 |
6 | namespace SCReverser.NEO.Internals
7 | {
8 | public class CachedScriptTable : IScriptTable
9 | {
10 | DataCache contracts;
11 |
12 | public CachedScriptTable(DataCache contracts)
13 | {
14 | this.contracts = contracts;
15 | }
16 |
17 | byte[] IScriptTable.GetScript(byte[] script_hash)
18 | {
19 | return contracts[new UInt160(script_hash)].Script;
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.NEO/Internals/EFake.cs:
--------------------------------------------------------------------------------
1 | namespace SCReverser.NEO.Internals
2 | {
3 | public enum EFake : byte
4 | {
5 | None = 0,
6 |
7 | Witness = 1,
8 | Signature = 2,
9 | Storage = 4,
10 | }
11 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.NEO/Internals/ETriggerType.cs:
--------------------------------------------------------------------------------
1 | namespace SCReverser.NEO.Internals
2 | {
3 | public enum ETriggerType
4 | {
5 | ///
6 | /// Neo Verification
7 | ///
8 | Verification,
9 | ///
10 | /// Neo Application
11 | ///
12 | Application
13 | }
14 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.NEO/Internals/NeoFakeDbCache.cs:
--------------------------------------------------------------------------------
1 | using Neo.IO;
2 | using Neo.IO.Caching;
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | namespace SCReverser.NEO.Internals
7 | {
8 | ///
9 | /// Fake DataCache for work without BlockChain
10 | ///
11 | /// Key
12 | /// Value
13 | public class NeoFakeDbCache : DataCache
14 | where TKey : IEquatable, ISerializable
15 | where TValue : class, ICloneable, ISerializable, new()
16 | {
17 | Dictionary Dic = new Dictionary();
18 |
19 | protected override IEnumerable> FindInternal(byte[] key_prefix)
20 | {
21 | yield break;
22 | }
23 |
24 | protected override TValue GetInternal(TKey key)
25 | {
26 | if (!Dic.TryGetValue(key, out TValue ret))
27 | return default(TValue);
28 |
29 | return ret;
30 | }
31 |
32 | protected override TValue TryGetInternal(TKey key)
33 | {
34 | if (!Dic.TryGetValue(key, out TValue ret))
35 | return default(TValue);
36 |
37 | return ret;
38 | }
39 |
40 | public override void DeleteInternal(TKey key)
41 | {
42 | Dic.Remove(key);
43 | }
44 |
45 | protected override void AddInternal(TKey key, TValue value)
46 | {
47 | Dic[key] = value;
48 | }
49 |
50 | protected override void UpdateInternal(TKey key, TValue value)
51 | {
52 | Dic[key] = value;
53 | }
54 | }
55 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.NEO/Internals/NullBlockChain.cs:
--------------------------------------------------------------------------------
1 | using Neo;
2 | using Neo.Core;
3 | using Neo.IO.Caching;
4 | using System.Collections.Generic;
5 |
6 | namespace SCReverser.NEO.Internals
7 | {
8 | public class NullBlockChain : Blockchain
9 | {
10 | public override UInt256 CurrentBlockHash => UInt256.Zero;
11 |
12 | public override UInt256 CurrentHeaderHash => UInt256.Zero;
13 |
14 | public override uint HeaderHeight => 0;
15 |
16 | public override uint Height => 0;
17 |
18 | public override bool IsDisposed => false;
19 |
20 | public override bool AddBlock(Block block)
21 | {
22 | return false;
23 | }
24 |
25 | public override bool ContainsBlock(UInt256 hash)
26 | {
27 | return false;
28 | }
29 |
30 | public override bool ContainsTransaction(UInt256 hash)
31 | {
32 | return false;
33 | }
34 |
35 | public override bool ContainsUnspent(UInt256 hash, ushort index)
36 | {
37 | return false;
38 | }
39 |
40 | public override void Dispose()
41 | {
42 | }
43 |
44 | public override AccountState GetAccountState(UInt160 script_hash)
45 | {
46 | return null;
47 | }
48 |
49 | public override AssetState GetAssetState(UInt256 asset_id)
50 | {
51 | return null;
52 | }
53 |
54 | public override Block GetBlock(UInt256 hash)
55 | {
56 | return null;
57 | }
58 |
59 | public override UInt256 GetBlockHash(uint height)
60 | {
61 | return UInt256.Zero;
62 | }
63 |
64 | public override ContractState GetContract(UInt160 hash)
65 | {
66 | return null;
67 | }
68 |
69 | public override IEnumerable GetEnrollments()
70 | {
71 | yield break;
72 | }
73 |
74 | public override Header GetHeader(uint height)
75 | {
76 | return null;
77 | }
78 |
79 | public override Header GetHeader(UInt256 hash)
80 | {
81 | return null;
82 | }
83 |
84 | public override MetaDataCache GetMetaData()
85 | {
86 | throw new System.NotImplementedException();
87 | }
88 |
89 | public override Block GetNextBlock(UInt256 hash)
90 | {
91 | return null;
92 | }
93 |
94 | public override UInt256 GetNextBlockHash(UInt256 hash)
95 | {
96 | return UInt256.Zero;
97 | }
98 |
99 | public override DataCache GetStates()
100 | {
101 | return new NeoFakeDbCache();
102 | }
103 |
104 | public override StorageItem GetStorageItem(StorageKey key)
105 | {
106 | return null;
107 | }
108 |
109 | public override long GetSysFeeAmount(UInt256 hash)
110 | {
111 | return 0;
112 | }
113 |
114 | public override Transaction GetTransaction(UInt256 hash, out int height)
115 | {
116 | height = 0;
117 | return null;
118 | }
119 |
120 | public override Dictionary GetUnclaimed(UInt256 hash)
121 | {
122 | return new Dictionary();
123 | }
124 |
125 | public override TransactionOutput GetUnspent(UInt256 hash, ushort index)
126 | {
127 | return null;
128 | }
129 |
130 | public override IEnumerable GetUnspent(UInt256 hash)
131 | {
132 | yield break;
133 | }
134 |
135 | public override bool IsDoubleSpend(Transaction tx)
136 | {
137 | return false;
138 | }
139 |
140 | protected override void AddHeaders(IEnumerable headers)
141 | {
142 | }
143 | }
144 | }
145 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.NEO/NeoTemplate.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Enums;
2 | using SCReverser.Core.Interfaces;
3 | using System.Drawing;
4 |
5 | namespace SCReverser.NEO
6 | {
7 | public class NeoTemplate : ReverseTemplate
8 | {
9 | ///
10 | /// Template name
11 | ///
12 | public override string Template => "NEO";
13 | ///
14 | /// Flags
15 | ///
16 | public override TemplateFlags Flags => TemplateFlags.HaveAltStack;
17 |
18 | ///
19 | /// Open file
20 | ///
21 | public override object CreateNewConfig()
22 | {
23 | if (!FOpen.ShowForm(out NeoConfig cfg)) return null;
24 | return cfg;
25 | }
26 | ///
27 | /// Get logo
28 | ///
29 | public override Image GetLogo()
30 | {
31 | return Res.Logo;
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser.NEO/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // La información general de un ensamblado se controla mediante el siguiente
6 | // conjunto de atributos. Cambie estos valores de atributo para modificar la información
7 | // asociada con un ensamblado.
8 | [assembly: AssemblyTitle("SCReverser.NEO")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SCReverser.NEO")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles
18 | // para los componentes COM. Si es necesario obtener acceso a un tipo en este ensamblado desde
19 | // COM, establezca el atributo ComVisible en true en este tipo.
20 | [assembly: ComVisible(false)]
21 |
22 | // El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM.
23 | [assembly: Guid("75a9588d-cf1a-4744-9188-65a4a61aaf6a")]
24 |
25 | // La información de versión de un ensamblado consta de los cuatro valores siguientes:
26 | //
27 | // Versión principal
28 | // Versión secundaria
29 | // Número de compilación
30 | // Revisión
31 | //
32 | // Puede especificar todos los valores o usar los números de compilación y de revisión predeterminados
33 | // mediante el carácter "*", como se muestra a continuación:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.NEO/Res.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Este código fue generado por una herramienta.
4 | // Versión de runtime:4.0.30319.42000
5 | //
6 | // Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
7 | // se vuelve a generar el código.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace SCReverser.NEO {
12 | using System;
13 |
14 |
15 | ///
16 | /// Clase de recurso fuertemente tipado, para buscar cadenas traducidas, etc.
17 | ///
18 | // StronglyTypedResourceBuilder generó automáticamente esta clase
19 | // a través de una herramienta como ResGen o Visual Studio.
20 | // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen
21 | // con la opción /str o recompile su proyecto de VS.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Res {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Res() {
33 | }
34 |
35 | ///
36 | /// Devuelve la instancia de ResourceManager almacenada en caché utilizada por esta clase.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SCReverser.NEO.Res", typeof(Res).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Reemplaza la propiedad CurrentUICulture del subproceso actual para todas las
51 | /// búsquedas de recursos mediante esta clase de recurso fuertemente tipado.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Busca un recurso adaptado de tipo System.Drawing.Bitmap.
65 | ///
66 | internal static System.Drawing.Bitmap Logo {
67 | get {
68 | object obj = ResourceManager.GetObject("Logo", resourceCulture);
69 | return ((System.Drawing.Bitmap)(obj));
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.NEO/Resources/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/SCReverser.NEO/Resources/Logo.png
--------------------------------------------------------------------------------
/SCReverser/SCReverser.NEO/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | [assembly: AssemblyTitle("SCReverser.Tests")]
6 | [assembly: AssemblyDescription("")]
7 | [assembly: AssemblyConfiguration("")]
8 | [assembly: AssemblyCompany("")]
9 | [assembly: AssemblyProduct("SCReverser.Tests")]
10 | [assembly: AssemblyCopyright("Copyright © 2017")]
11 | [assembly: AssemblyTrademark("")]
12 | [assembly: AssemblyCulture("")]
13 |
14 | [assembly: ComVisible(false)]
15 |
16 | [assembly: Guid("c3408c2e-84a4-40af-b670-b4015da6fcbb")]
17 |
18 | // [assembly: AssemblyVersion("1.0.*")]
19 | [assembly: AssemblyVersion("1.0.0.0")]
20 | [assembly: AssemblyFileVersion("1.0.0.0")]
21 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Controls/UStacks.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using SCReverser.Core.Types;
4 |
5 | namespace SCReverser.Controls
6 | {
7 | public partial class UStacks : UserControl
8 | {
9 | ///
10 | /// Constructor
11 | ///
12 | public UStacks()
13 | {
14 | InitializeComponent();
15 |
16 | GridStack.AutoGenerateColumns = false;
17 | GridAltStack.AutoGenerateColumns = false;
18 | }
19 | ///
20 | /// Refresh grids
21 | ///
22 | public void RefreshGrids()
23 | {
24 | GridAltStack.Refresh();
25 | GridStack.Refresh();
26 | }
27 | ///
28 | /// Set stack items
29 | ///
30 | /// Items
31 | public void SetStackSource(StackItem[] items)
32 | {
33 | GridStack.DataSource = items;
34 | GridStack.ClearSelection();
35 | }
36 | ///
37 | /// Set alt items
38 | ///
39 | /// Items
40 | public void SetAltStackSource(StackItem[] items)
41 | {
42 | GridAltStack.DataSource = items;
43 | GridAltStack.ClearSelection();
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser/FMainBase.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Interfaces;
2 |
3 | namespace SCReverser
4 | {
5 | public class FMainBase : FRememberForm
6 | {
7 |
8 | }
9 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
1 | // This file is used by Code Analysis to maintain SuppressMessage
2 | // attributes that are applied to this project.
3 | // Project-level suppressions either have no target or are given
4 | // a specific target and scoped to a namespace, type, member, etc.
5 |
6 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "")]
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace SCReverser
5 | {
6 | static class Program
7 | {
8 | ///
9 | /// Punto de entrada principal para la aplicación.
10 | ///
11 | [STAThread]
12 | static void Main()
13 | {
14 | Application.EnableVisualStyles();
15 | Application.SetCompatibleTextRenderingDefault(false);
16 | Application.Run(new FMain());
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // La información general de un ensamblado se controla mediante el siguiente
6 | // conjunto de atributos. Cambie estos valores de atributo para modificar la información
7 | // asociada con un ensamblado.
8 | [assembly: AssemblyTitle("SCReverser")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SCReverser")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles
18 | // para los componentes COM. Si es necesario obtener acceso a un tipo en este ensamblado desde
19 | // COM, establezca el atributo ComVisible en true en este tipo.
20 | [assembly: ComVisible(false)]
21 |
22 | // El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM.
23 | [assembly: Guid("53355d5f-441d-4d68-af1f-202c79bebc29")]
24 |
25 | // La información de versión de un ensamblado consta de los cuatro valores siguientes:
26 | //
27 | // Versión principal
28 | // Versión secundaria
29 | // Número de compilación
30 | // Revisión
31 | //
32 | // Puede especificar todos los valores o utilizar los números de compilación y de revisión predeterminados
33 | // mediante el carácter '*', como se muestra a continuación:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Este código fue generado por una herramienta.
4 | // Versión de runtime: 4.0.30319.42000
5 | //
6 | // Los cambios de este archivo pueden provocar un comportamiento inesperado y se perderán si
7 | // el código se vuelve a generar.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace SCReverser.Properties
12 | {
13 |
14 |
15 | ///
16 | /// Clase de recurso fuertemente tipado para buscar cadenas traducidas, etc.
17 | ///
18 | // StronglyTypedResourceBuilder generó automáticamente esta clase
19 | // a través de una herramienta como ResGen o Visual Studio.
20 | // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen
21 | // con la opción /str o recompile su proyecto de VS.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Devuelve la instancia ResourceManager almacenada en caché utilizada por esta clase.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SCReverser.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Invalida la propiedad CurrentUICulture del subproceso actual para todas las
56 | /// búsquedas de recursos usando esta clase de recursos fuertemente tipados.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace SCReverser.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Red4SecLoco.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/SCReverser/Red4SecLoco.ico
--------------------------------------------------------------------------------
/SCReverser/SCReverser/RemMain.cs:
--------------------------------------------------------------------------------
1 | using SCReverser.Core.Remembers;
2 | using System;
3 | using System.Windows.Forms;
4 |
5 | namespace SCReverser
6 | {
7 | public class RemMain : RememberForm
8 | {
9 | ///
10 | /// Splitter distance
11 | ///
12 | public int SplitterHexDistance { get; set; }
13 | ///
14 | /// Splitter distance
15 | ///
16 | public int SplitterInstructionsDistance { get; set; }
17 |
18 | public override void GetValues(Form f)
19 | {
20 | base.GetValues(f);
21 |
22 | if (f is FMain fm)
23 | {
24 | fm.TreeModules.Width = Math.Min(fm.Width - 300, SplitterHexDistance);
25 | fm.PanelRegisters.Width = Math.Max(250, SplitterInstructionsDistance);
26 | }
27 | }
28 |
29 | public override void SaveValues(Form f)
30 | {
31 | base.SaveValues(f);
32 |
33 | if (f is FMain fm)
34 | {
35 | SplitterHexDistance = fm.TreeModules.Width;
36 | SplitterInstructionsDistance = fm.PanelRegisters.Width;
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Resources/AddFileIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/SCReverser/Resources/AddFileIcon.png
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Resources/ConfigIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/SCReverser/Resources/ConfigIcon.png
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Resources/Format.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/SCReverser/Resources/Format.png
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Resources/Into.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/SCReverser/Resources/Into.png
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Resources/OpenIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/SCReverser/Resources/OpenIcon.png
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Resources/Out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/SCReverser/Resources/Out.png
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Resources/Over.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/SCReverser/Resources/Over.png
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Resources/PlayIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/SCReverser/Resources/PlayIcon.png
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Resources/SaveIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/SCReverser/Resources/SaveIcon.png
--------------------------------------------------------------------------------
/SCReverser/SCReverser/Resources/Stop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Red4Sec/SCReverser/64d6f43da66365069a8726dd30d8cb1ed0343e47/SCReverser/SCReverser/Resources/Stop.png
--------------------------------------------------------------------------------