Skip to content

Commit

Permalink
Add source code.
Browse files Browse the repository at this point in the history
Remove old binary. Latest binary can be found on: https://github.com/Havoc/HavocClicks/releases.
  • Loading branch information
Havoc committed Aug 6, 2018
1 parent c34eb51 commit e6668d9
Show file tree
Hide file tree
Showing 31 changed files with 2,096 additions and 1 deletion.
Binary file removed HavocClicks 20.08.2017.zip
Binary file not shown.
22 changes: 22 additions & 0 deletions HavocClicks.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26403.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HavocClicks", "HavocClicks\HavocClicks.csproj", "{F6C2D903-AAE2-4FE2-8E8D-A4E4F6D0E306}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F6C2D903-AAE2-4FE2-8E8D-A4E4F6D0E306}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F6C2D903-AAE2-4FE2-8E8D-A4E4F6D0E306}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F6C2D903-AAE2-4FE2-8E8D-A4E4F6D0E306}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F6C2D903-AAE2-4FE2-8E8D-A4E4F6D0E306}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions HavocClicks/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
9 changes: 9 additions & 0 deletions HavocClicks/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="HavocClicks.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:HavocClicks"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary Source="UniverseResourceDictionary.xaml" />
</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions HavocClicks/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace HavocClicks
{
/// <summary>
/// Interaktionslogik für "App.xaml"
/// </summary>
public partial class App : Application
{
}
}
148 changes: 148 additions & 0 deletions HavocClicks/AutoClicker.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using HavocsToolkit;

namespace HavocClicks
{
public class AutoClicker : MouseHookModule
{
public int RepeatDelay { get; set; }
public int PressDuration { get; set; }
public MouseButtons ClickedMouseButton { get; set; }

// Statistics
public StatisticsRecorder StatisticsRecorder = new StatisticsRecorder();

// Trigger
public MouseButtons TriggerMouseButton { get; set; }
public bool UseKeyboardTrigger { get; set; }
public string KeyboardTriggerKey { get; set; }

private KeyboardHook _keyboardHook = new KeyboardHook();

private bool _interruptFlag = false;

public AutoClicker()
{
_mouseHook.MiddleButtonDown += new MouseHook.MouseHookCallback(mouseHook_MiddleButtonDown);
_mouseHook.MiddleButtonUp += new MouseHook.MouseHookCallback(mouseHook_MiddleButtonUp);

_keyboardHook.KeyDown += new KeyboardHook.KeyboardHookCallback(keyboardHook_KeyDown);
_keyboardHook.KeyUp += new KeyboardHook.KeyboardHookCallback(keyboardHook_KeyUp);
}

public override void Enable()
{
base.Enable();

if (UseKeyboardTrigger)
_keyboardHook.Install();
}

public override void Disable()
{
base.Disable();

if (_keyboardHook.IsActive)
_keyboardHook.Uninstall();
}

private void mouseHook_MiddleButtonDown(MouseHook.MSLLHOOKSTRUCT mouseStruct)
{
if (UseKeyboardTrigger)
return;

Handler();
}

private void mouseHook_MiddleButtonUp(MouseHook.MSLLHOOKSTRUCT mouseStruct)
{
if (UseKeyboardTrigger)
return;

_interruptFlag = true;
}

private void keyboardHook_KeyDown(KeyboardHook.VKeys key)
{
if (!UseKeyboardTrigger)
return;

if (key.ToString() == KeyboardTriggerKey)
Handler();
}

private void keyboardHook_KeyUp(KeyboardHook.VKeys key)
{
if (!UseKeyboardTrigger)
return;

if (key.ToString() == KeyboardTriggerKey)
_interruptFlag = true;
}

private Stopwatch _stopWatch = new Stopwatch();

private void Handler()
{
_interruptFlag = false;

Task t = Task.Run(() =>
{
long clickCounter = 0;

if (ClickedMouseButton.HasFlag(MouseButtons.Left))
{
_stopWatch.Start();
while (!_interruptFlag)
{
MouseOperations.MouseEvent(MouseOperations.MouseEventFlags.LeftDown);
Thread.Sleep(PressDuration);
MouseOperations.MouseEvent(MouseOperations.MouseEventFlags.LeftUp);
Thread.Sleep(RepeatDelay);
clickCounter++;
}
_stopWatch.Stop();
}
else if (ClickedMouseButton.HasFlag(MouseButtons.Right))
{
_stopWatch.Start();
while (!_interruptFlag)
{
MouseOperations.MouseEvent(MouseOperations.MouseEventFlags.RightDown);
Thread.Sleep(PressDuration);
MouseOperations.MouseEvent(MouseOperations.MouseEventFlags.RightUp);
Thread.Sleep(RepeatDelay);
clickCounter++;
}
_stopWatch.Stop();
}

/*StatisticsRecorder._stopWatch.Start();
while (!_interruptFlag)
{
if (ClickedMouseButton.HasFlag(MouseButtons.Left))
MouseOperations.MouseEvent(MouseOperations.MouseEventFlags.LeftDown);
else if (ClickedMouseButton.HasFlag(MouseButtons.Right))
MouseOperations.MouseEvent(MouseOperations.MouseEventFlags.RightDown);
Thread.Sleep(PressDuration);
if (ClickedMouseButton.HasFlag(MouseButtons.Left))
MouseOperations.MouseEvent(MouseOperations.MouseEventFlags.LeftUp);
else if (ClickedMouseButton.HasFlag(MouseButtons.Right))
MouseOperations.MouseEvent(MouseOperations.MouseEventFlags.RightUp);
Thread.Sleep(RepeatDelay);
clickCounter++;
}*/

//StatisticsRecorder._stopWatch.Stop();
StatisticsRecorder.FinishTest(clickCounter, _stopWatch.ElapsedMilliseconds);
_stopWatch.Reset();
});
}
}
}
121 changes: 121 additions & 0 deletions HavocClicks/HavocClicks.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F6C2D903-AAE2-4FE2-8E8D-A4E4F6D0E306}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>HavocClicks</RootNamespace>
<AssemblyName>HavocClicks</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Resources\Havoc Toolkit.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="MouseButtons.cs" />
<Compile Include="MouseHookModule.cs" />
<Compile Include="Repeater.cs" />
<Compile Include="StatisticsRecorder.cs" />
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="AutoClicker.cs" />
<Compile Include="HavocsToolkit\Forms\Appearance\Appearance.cs" />
<Compile Include="HavocsToolkit\Input\Hooks\KeyboardHook.cs" />
<Compile Include="HavocsToolkit\Input\Hooks\MouseHook.cs" />
<Compile Include="HotKeys.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="UniverseResourceDictionary.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="MouseOperations.cs" />
<Compile Include="MouseSimulator.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\havoc.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Havoc Toolkit.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
38 changes: 38 additions & 0 deletions HavocClicks/HavocsToolkit/Forms/Appearance/Appearance.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System.Windows.Controls;
using System.Windows.Media;

namespace HavocsToolkit.Forms
{
public static class Appearance
{
public enum ButtonAppearance
{
kDisabled,
kEnabled,
}

public static void ChangeButtonAppearance(Button button, ButtonAppearance buttonAppearance)
{
switch (buttonAppearance)
{
case ButtonAppearance.kDisabled:
//button.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFA1A1"));
button.Content = button.Content.ToString().Replace("Disable", "Enable");
button.Content = button.Content.ToString().Replace("Stop", "Start");
break;
case ButtonAppearance.kEnabled:
//button.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFAAFFA1"));
button.Content = button.Content.ToString().Replace("Enable", "Disable");
button.Content = button.Content.ToString().Replace("Start", "Stop");
break;
default:
break;
}
}

public static void ChangeButtonBackgroundColor(Button button, string colorHexValue)
{
button.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(colorHexValue));
}
}
}
Loading

0 comments on commit e6668d9

Please sign in to comment.