Skip to content

Commit

Permalink
Show registers value in real time
Browse files Browse the repository at this point in the history
  • Loading branch information
XaFF-XaFF committed Dec 20, 2021
1 parent 6415574 commit 9eeee82
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 17 deletions.
12 changes: 6 additions & 6 deletions Shellcodevv/Core/AssemblyHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private void AppendRegisters(API.Registers registers)
}

string str = string.Join(" ", list);
main.registersBox.AppendText(str);
main.registersBox.Text = str;
}

private void AppendIndexes(API.Registers registers)
Expand All @@ -164,7 +164,7 @@ private void AppendIndexes(API.Registers registers)
}

string str = string.Join(" ", list);
main.indexesBox.AppendText(str);
main.indexesBox.Text = str;
}

private void AppendPointers(API.Registers registers)
Expand All @@ -183,7 +183,7 @@ private void AppendPointers(API.Registers registers)
}

string str = string.Join(" ", list);
main.pointersBox.AppendText(str);
main.pointersBox.Text = str;
}

private string Clear(string instruction)
Expand Down Expand Up @@ -251,9 +251,9 @@ public unsafe void SetRegisters(string instruction, API.PROCESS_INFORMATION pi)

MainWindow.registers = Configure(registers, MainWindow.registers, instruction);

//AppendRegisters(Main.registers);
//AppendIndexes(Main.registers);
//AppendPointers(Main.registers);
AppendRegisters(MainWindow.registers);
AppendIndexes(MainWindow.registers);
AppendPointers(MainWindow.registers);
}
#endregion
}
Expand Down
15 changes: 8 additions & 7 deletions Shellcodevv/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@
HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="5,39,0,0" Height="29" Width="59"/>

<RichTextBox
<TextBox
Name="registersBox"
Margin="10,65,10,131"
Style="{StaticResource RichTxtboxTheme}" />
/>

<Label
Content="Indexes"
Expand All @@ -96,10 +96,10 @@
HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="5,89,0,0" Height="29" Width="57"/>

<RichTextBox
<TextBox
Name="indexesBox"
Margin="10,115,10,81"
Style="{StaticResource RichTxtboxTheme}" />
/>

<Label
Content="Pointers"
Expand All @@ -108,10 +108,10 @@
HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="5,139,0,0" Height="29" Width="60"/>

<RichTextBox
<TextBox
Name="pointersBox"
Margin="10,165,10,31"
Style="{StaticResource RichTxtboxTheme}" />
/>

<!--Row 0 Column 1-->
<Button
Expand Down Expand Up @@ -254,7 +254,8 @@
Background="Transparent"
Foreground="White"
Grid.Row="1"
Margin="10,449,204,7"/>
Margin="10,449,204,7"
KeyDown="instructionTxt_KeyDown"/>

<!--Row 1 Column 1-->
<Label
Expand Down
43 changes: 39 additions & 4 deletions Shellcodevv/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,36 @@ public MainWindow()
{
InitializeComponent();
instance = this;

AssemblyHandler handler = new AssemblyHandler();
InitProcess();

handler.SetRegisters("xor eax,eax", pi);
handler.SetRegisters("xor ebx,ebx", pi);
handler.SetRegisters("xor ecx,ecx", pi);
}

private void InitProcess()
{
API.STARTUPINFO si = new API.STARTUPINFO();
pi = new API.PROCESS_INFORMATION();

bool createproc = API.CreateProcess(
AppDomain.CurrentDomain.FriendlyName,
null,
IntPtr.Zero,
IntPtr.Zero,
false,
0x00000002,
IntPtr.Zero,
null,
ref si, out pi);

if(!createproc)
{
MessageBox.Show("ERROR! CreateProcess Failed");
this.Close();
}
}

#region Buttons
Expand Down Expand Up @@ -50,16 +80,21 @@ private void addBtn_Click(object sender, RoutedEventArgs e)
if (string.IsNullOrEmpty(instruction))
return;

Console.WriteLine(instruction);

Instructions instructions = new Instructions();
AssemblyHandler handler = new AssemblyHandler();

instructions.instruction = instruction;

instructionGrid.Items.Add(instructions);

Console.WriteLine(handler.Assembler(instruction));
handler.SetRegisters(instruction, pi);

instructionTxt.SelectAll();
}

private void instructionTxt_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
addBtn_Click(sender, e);
}
}

Expand Down

0 comments on commit 9eeee82

Please sign in to comment.