Skip to content

Commit

Permalink
Spawn fully working, A few button enablings working
Browse files Browse the repository at this point in the history
  • Loading branch information
ke0z committed Sep 20, 2023
1 parent 8f48b6a commit ea53343
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<Button Content="Resume" Height="23" HorizontalAlignment="Left" Margin="369,115,0,0" x:Name="resumeButton" VerticalAlignment="Top" Width="93" Click="resumeButton_Click" Grid.Column="1" />
<Button Content="Attach" Height="23" HorizontalAlignment="Left" Margin="369,143,0,0" x:Name="attachButton" VerticalAlignment="Top" Width="93" Click="attachButton_Click" Grid.Column="1" />
<Button Content="Load Script" Height="23" Margin="369,256,0,0" x:Name="loadScriptButton" VerticalAlignment="Top" Click="loadScriptButton_Click" HorizontalAlignment="Left" Width="93" Grid.Column="1" />
<TextBox Margin="9,229,0,128" x:Name="scriptSource" AcceptsReturn="True" AcceptsTab="True" Text="var a = Memory.allocUtf8String(&quot;Hei&quot;);&#xA;send({woot: 1227});&#xA;send({hello: 1337}, Memory.readByteArray(a, 4));&#xA;var onMessage = function onMessage(m) {&#xA; send({reply: m});&#xA; recv(onMessage);&#xA;};&#xA;recv(onMessage);&#xA;" HorizontalAlignment="Left" Width="355" Grid.Column="1" />
<TextBox Margin="9,229,0,128" x:Name="scriptSource" AcceptsReturn="True" AcceptsTab="True" HorizontalAlignment="Left" Width="355" Grid.Column="1" />
<Button Content="Unload Script" Height="23" HorizontalAlignment="Left" Margin="369,284,0,0" x:Name="unloadScriptButton" VerticalAlignment="Top" Width="93" Click="unloadScriptButton_Click" Grid.Column="1" />
<Button Content="Create Script" Height="23" HorizontalAlignment="Left" Margin="369,228,0,0" x:Name="createScriptButton" VerticalAlignment="Top" Width="93" Click="createScriptButton_Click" Grid.Column="1" />
<Button Content="Clear Results" Height="23" HorizontalAlignment="Left" Margin="369,312,0,0" x:Name="clearResultstButton" VerticalAlignment="Top" Width="93" Click="postToScriptButton_Click" Grid.Column="1" />
Expand Down
6 changes: 2 additions & 4 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private void RefreshAllowedActions()

processList.IsEnabled = session == null;
spawnButton.IsEnabled = deviceList.SelectedItem != null;
//resumeButton.IsEnabled = processList.SelectedItem != null;
resumeButton.IsEnabled = processList.SelectedItem != null || pid > 1;
attachButton.IsEnabled = processList.SelectedItem != null && session == null;
detachButton.IsEnabled = session != null;

Expand Down Expand Up @@ -286,8 +286,6 @@ private void script_Message(object sender, Frida.ScriptMessageEventArgs e)
if (sender == script)
{
resultBox.Items.Add(String.Format("{0}", e.Message));
//resultBox.Items.Add(String.Format(" Data: {0}", e.Data == null ? "null" : String.Join(", ", e.Data)));

}
}

Expand Down Expand Up @@ -352,7 +350,7 @@ private void saveResultstButton_Click(object sender, RoutedEventArgs e)
{
name = p.ProcessName;
}
var dir_name = System.IO.Path.Combine(results_path, name.Replace(@"\", ""));
var dir_name = System.IO.Path.Combine(results_path, name);
Directory.CreateDirectory(dir_name);
var result_filename = System.IO.Path.Combine(dir_name, now.ToLongTimeString().Replace(':', '-'));
StreamWriter SaveFile = new StreamWriter(result_filename);
Expand Down
4 changes: 2 additions & 2 deletions SpawnWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
xmlns:local="clr-namespace:HookAMal"
mc:Ignorable="d"
ResizeMode="CanMinimize"
Title="SpawnWindow" Height="250" Width="400">
Title="SpawnWindow" Height="170" Width="400">
<Grid>
<Label Content="Program" HorizontalAlignment="Left" Margin="28,33,0,0" VerticalAlignment="Top"/>
<Label Content="Args" HorizontalAlignment="Left" Margin="28,64,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txtBoxProgram" HorizontalAlignment="Left" Margin="89,33,0,0" TextWrapping="Wrap" Text="C:\Windows\notepad.exe" VerticalAlignment="Top" Width="270" Height="26"/>
<TextBox x:Name="txtBoxArgs" HorizontalAlignment="Left" Margin="89,64,0,0" TextWrapping="Wrap" Text="C:\document.txt" VerticalAlignment="Top" Width="270" Height="26"/>
<Button x:Name="btnSpawnProg" Content="Spawn" HorizontalAlignment="Left" Margin="171,135,0,0" VerticalAlignment="Top" Click="btnSpawnProg_Click"/>
<Button x:Name="btnSpawnProg" Content="Spawn" HorizontalAlignment="Center" Margin="0,99,0,0" VerticalAlignment="Top" Click="btnSpawnProg_Click"/>

</Grid>
</Window>
6 changes: 1 addition & 5 deletions SpawnWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ namespace HookAMal
public partial class SpawnWindow : System.Windows.Window
{

public class spawnedItems
{
public string ProcName { get; set; }
}

public SpawnWindow()
{
Expand All @@ -53,8 +49,8 @@ private void btnSpawnProg_Click(object sender, RoutedEventArgs e)
winWin.createScriptButton.IsEnabled = winWin.session != null && winWin.script == null;
winWin.loadScriptButton.IsEnabled = winWin.script != null && !winWin.scriptLoaded;
winWin.unloadScriptButton.IsEnabled = winWin.script != null;
winWin.resumeButton.IsEnabled = winWin.pid >= 1;
winWin.Processes.Clear();
winWin.processList.ClearValue(ItemsControl.ItemsSourceProperty);
}
catch (Exception ex)
{
Expand Down

0 comments on commit ea53343

Please sign in to comment.