APB Gun Macro

I’ve been playing this game, All Points Bulletin for some time now and lately I’ve been seeing a lot of people using mouse macros to take advantage of poor netcode that allows users to fire their weapons ad fast as they can click. So what i did was write my own little macro application that can click 100 times faster than I ever could. I suppose U could have used someone elses code, but I don’t trust a lot of what I see. For all I know its just some shitty malware in disguise. Besides, I take pride in what I write.
I’ve previously written applications that intercept window messages before for other work arounds / hacks around the office such as a way to disable the mouse scroller wheel in Access applications. For those who don’t know, the mouse wheel scroll in MS Access applications creates a new record (very annoying) and everyone uses the scroll wheel for viewing large documents. This application uses the same concept – the interception of window messages from the system dispatcher while the game is running that checks for the WM_LMOUSEDOWN message which is fired off each time the user presses down on the left mouse button. After interception, it send the same window message 100 fold to the calling application using a for loop and SendMessage(). Originally I was going to make this a global macro that sent the window messages to every application, however I could not determine what else I could use this for so the macro code is specific to APB.

 

The code comes in 2 parts. The first of which is the DLL and the second is the presentation application. We use a DLL because a stand alone application can’t normally intercept other window messages from other programs unless we get into DLL injection territory, but that’s too much hassle (CreateRemoteThread / WriteProcessMemory / crashing fun). Instead we use a DLL with its code section set to read / write / execute so it can be shared amongst other processes. There are 2 functions that are exported from the DLL – Install and Uninstall. They start / stop the hooking of window messages on the target application. Keep it simple stupid.

The second part is the presentation application. Its only job is to look pretty and to initialize the 2 exported function calls. I was going to write this in C, but opted for C# instead since I wanted it to look pretty. You don;t code an application in C if you want it to look nice, you code something in C if you want something small and powerful. The DLL is only 7 KB in size so C did its job well.

Now for the meat and potatoes. The C code can be obtained by emailing me, but the C# app code I’ll gladly give away:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Apb_Mouse_Macro
{
public partial class Form1 : Form
{
static string dllname = “2dollarhooker.dll”;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
if(!System.IO.File.Exists(dllname))
{
MessageBox.Show(“Required DLL is missing. The app don’t work without it!”, “Error!”, MessageBoxButtons.OK, MessageBoxIcon.Warning);
Application.Exit();
}
if (IsProcessOpen(“APB”))
//if (IsProcessOpen(“APB.exe”))
{
this.lblRunning.ForeColor = System.Drawing.Color.Green;
lblRunning.Text = “APB is running”;
this.btnStartMacro.Enabled = true;
}
else
{
this.lblRunning.ForeColor = System.Drawing.Color.Red;
lblRunning.Text = “APB is NOT running”;
this.btnStartMacro.Enabled = false;
}
}
public bool IsProcessOpen(string name)
{
foreach (Process clsProcess in Process.GetProcesses())
{
if (clsProcess.ProcessName.Contains(name))
{
return true;
}
}
return false;
}
private void btnAbout_Click(object sender, EventArgs e)
{
MessageBox.Show(“Made by AverageJoe for all my friends.”, “About This Tool”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void btnHow_Click(object sender, EventArgs e)
{
MessageBox.Show(“The macro works by simulating mouse clicks. Each click when enabled is done 10 fold.”, “How To”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void btnStartMacro_Click(object sender, EventArgs e)
{
lblStatus.Text = “Macro started.”;
this.btnStopMacro.Enabled = true;
DllStuff.install();
}
private void btnStopMacro_Click(object sender, EventArgs e)
{
// Uninstall hook and release / free dll?
lblStatus.Text = “Macro stopped.”;
DllStuff.uninstall();
}
}
class DllStuff
{
[DllImport(“2dollarhooker.dll”, EntryPoint = “_Z7installv”)]
public static extern void install();
[DllImport(“2dollarhooker.dll”, EntryPoint = “_Z9uninstallv”)]
public static extern void uninstall();
}
}

You can download the application compiled here:

http://gironsec.com/code/APB%20Mouse%20Macro.zip
Here’s a screen shot:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.