PDA

View Full Version : VB6 Name Spoofing Tutorial [Part 2]



ViperSRT3g
11-23-2008, 02:56 AM
Starcraft v1.15.3 Name Spoofing Tutorial Part 2
Written: 11/23/08
Author: ViperSRT3g

This Tutorial is part of a two part tutorial. The first half of this tutorial can be found here: [Part 1] (http://www.gamethreat.net/forums/hacking-tutorials/36445-vb6-name-spoofing-tutorial-part-1-a.html)

This tutorial will go over all the odds and ends of creating a working 1.15.3 Name Spoofer Using Visual Basic 6.

Using Hotkeys
Remember that API we included at the beginning of this tutorial? Well, we'll finally use it in creating hotkeys! GetAsyncKeyState is one of the more common ways of obtaining a hotkey. To use this API however, we'll need to set up a timer in our program.

Click the "Timer" tool, and add in a timer to your program.
http://pages.vipersrt3g.com/NSTut18.png

Now the timer is different when compared to the other GUI Objects at your disposal. It does not appear when your program is actually running, so it has fewer sub-object properties to edit. The only properties it contains are whether it's running or not, and it's intervals. There's really not much else you can edit about the timer. But it's usefulness is potentially far greater than the other GUI Objects. Once you've created your Timer on your GUI, modify your properties to match the picture:
http://pages.vipersrt3g.com/NSTut19.png

Basically the only thing you have to modify is the Interval, the amount of time the timer will wait until it repeats itself. We are setting it to repeat itself every 100 milliseconds. If your observant, you'll notice that many programs use milliseconds as a means to time themselves. Starcraft also uses it, whenever it's waiting for anything. This is because all processes (Programs) on your computer run through your CPU (Processor). Your processor works hard to keep all your programs running smoothly, and when people mention CPU Cycles, they are talking about your processor looping through all your programs and executing whatever your programs may be doing at the time. Well, setting our timer to 100 milliseconds will let your processor know that every 100 milliseconds it will go to your spoofer, and execute anything that your timer may be set to execute. Wasting CPU Cycles will drastically slow your computer down. So try not to create too many of these timers unless they are not running at the same time. (Turning some off if you have multiple timers, or changing their intervals)

Now that we have our timer set up, lets add in the coding to let it know that we are pressing a hotkey!

Double click the timer's square in the GUI. Then copy the following into your form's code.


If GetAsyncKeyState(vbKeyF12) Then
Call Spoof
End If

Your timer's execution code should already have been generated for you, making the entire extra code block look like this:


Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyF12) Then
Call Spoof
End If
End Sub

This means that every 100 milliseconds, your timer will check to see if the hotkey F12 has been pressed. Now you notice, that the code that executes when the hotkey is pressed looks exactly like when you click the button on your GUI. This is because it's still calling the same exact code that spoofs your name! This is good VB6 practice, to make your code as separated as possible. If we were to use bad practice, we would have put the Spoof coding into the button's click execution. Which means we'd have to also put the same exact code into our timer's code. But since we separated them, things remain clean and simple. Wouldn't you rather have one line of code that does the same thing as 7? Now if you run your program, your able to press F12 instead of click the button to spoof your name!

Temp Ban Protection
If you REALLY want to make a name spoofer that can spoof with more than 15 characters, or spoof with color, you'll have to continue reading this huge tutorial. :) Otherwise, you've just made yourself a perfectly working spoofer. If your more ambitious, or want to learn VB6 as much as possible, continue reading.

Temp Ban Protection is a term that means you simply won't get kicked off of Bnet when you come back to a channel after spoofing to a name that contains 16 or more characters, or contains colors. When a name spoofer fails to provide this protection for you, Bnet will temporarily IP Ban you from the server you spoofed on for about 10-15 minutes. It's an inconvenience that everyone hates, and can be prevented by restoring your spoof AFTER you join a game. This means you'll write your original name back to that first offset we found in Artmoney. This is where that second offset comes in handy. That second offset is the name you logged onto Bnet with. It changes everytime you log on, however it always changes to exactly what you logged on with. It's the same variable Starcraft uses when your at the log in screen and your name is already entered into the Username field. By using the module's peekString function, we are able to read from Starcraft's memory, and either store this information in your program, or write the read memory to Starcraft again. Because this is a tutorial, we will go over both just to cover more ground.

As you can imagine, we are going to set up another code block for Temp Ban Protection, called TempBanProtect. It's preferable that we put it next to the Spoof block since the two blocks perform similar and related actions.


Private Sub TempBanProtect()
Dim ret As Long
Dim hwnd As Long
hwnd = modMemoryDP.FindWindow("SWarClass", "Brood War")
If hwnd = 0 Then hwnd = FindWindow("SWarClass", "Starcraft")
Dim namebuffer As String 'Initializes the variable that will hold your original name
namebuffer = modMemoryDP.PeekString(hwnd, &H19045178, 25, False) 'Peek = Read, this reads your original name
ret = modMemoryDP.PokeString(hwnd, &H19044EE8, namebuffer & vbNullChar) 'Poke = Write, this writes your original name as your spoof to reset your name
End Sub

If you take a look at the code, you'll see lots of similarities to the code found in the Spoof block. There are minor difference though, which I will go over.

"Dim namebuffer As String" This initializes the variable that will store your original name.
"namebuffer = modMemoryDP.PeekString(hwnd, &H19044EE8, 25, False)" This will read your name from your second offset in artmoney, and store it in the namebuffer variable. The 25 means it will read 25 bytes starting from the offset 19045178.

Now, the only thing left to do is to execute the code. It's not being called by anything, so we must set up another hotkey to call this block. This allows me to show you another bit of VB6 that you will find useful in other things you may design, Else statements. In any programming language, there are If-Then statements. If a condition is met, then a specific set of actions are executed. This can also be applied to many other things such as the the following sentence and what it's talking about. If you've noticed that If-Then statements sound like Starcraft triggers, Then your correct! Starcraft Triggers are simple If-Then Statements. Now when you add in Else into the mix, things become slightly more complicated. If-Then-Else statements provide an alternate set of instructions if the conditions are NOT met. Incorrect usage of Else statements can make your program do funny things.

In your Timer's hotkey section, modify it to look like the following.


Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyF12) Then
Call Spoof
ElseIf GetAsyncKeyState(vbKeyF11) Then
Call TempBanProtect
End If
End Sub

The Else Statement used in our coding is a slight modification of an Else statement, basically it's just a second condition that must be met, if the first is not. Another great example of how misuse of an Else statement can screw your program up can be shown here. If you used the following code here:


Else: GetAsyncKeyState(vbKeyF11)
Call TempBanProtect

Your program would have used the following logic:
If F12 is pressed, then Spoof
Otherwise F12 is not being pressed, then F11 must be so execute TempBanProtect

This is obviously not true because we may not be pressing anything at all, and F12 would not be pressed, yet it would assume that F11 is being pressed just because F12 isn't. So be careful when using Else statements.

Now that we have Temp Ban Protection inserted into our spoofer, we can increase the MaxLength property of our Text1 object to 24! To use Temp Ban Protection properly you have to press F11 BEFORE leaving a game. If your name is more than 15 characters long and your in a channel, you will get temporarily banned from the server. Or, if your name contains colors you'll be temporarily banned. So by pressing F11 before leaving a game, your spoofer writes over your spoof with your original name, allowing you to rejoin the channel safely. This was an issue with many early spoofers that began to introduce colors.


Color Spoofing!

You have now made a successful spoofer that can handle spoofing to 24 characters, and include colors! How do I include colors you ask? Well, the next step in this tutorial will cover inserting colors into your name. It won't go over how to actually spoof your name to look pretty, it will just show you how to include colors.

You can download a big list of colors here: StarcraftSpoofColorsEnhanced.txt (http://pages.vipersrt3g.com/StarcraftSpoofColorsEnhanced.txt)

It contains a list of all the colors you may use when spoofing your name! It also contains a list of all the colors you can use in the game as well. The in-game colors won't do anything but help you with map making because they are the same exact characters map editors use to add color to text. The lobby colors will work however because that's simply what your name spoofing is for, the game lobby. In past patches, the colors you spoofed to would carry over into the game, that is not the case anymore.

Credits:
Many Thanks to LCSBSSRHXXX for his initial Name Spoofing help back in 2007.
Thanks to Logos for bettering the Visual Basic Module for writing to Memory.
And to Zonemikel for making me wanna make a tut ^^

NamelessOne666
01-22-2009, 12:06 AM
Viper, would you be nice enough to expand on the Color Spoofing?? You only mentioned that list of colors, but never really said how to add colors, and how you spoof with colors. I followed this tutorial up to the color spoofing and it helped me greatly understand spoofing :awesome: So yea just need to expand on the color spoofing!

Antihaxer
01-22-2009, 01:15 AM
0x04NamelessOne666

NamelessOne666
01-22-2009, 01:22 AM
0x04NamelessOne666

Where exactly in the code do I add this?

ViperSRT3g
01-22-2009, 03:03 AM
You can make a button with the following code:

text1.text = text1.text & Chr(1-31)


The numbers 1-31 denotes the ASCII value of the character you wish to include. Characters 1-31 are all characters that affect text in Starcraft because character 32 is a space, and 0 is simply a null byte.

NamelessOne666
01-22-2009, 07:39 AM
You can make a button with the following code:

text1.text = text1.text & Chr(1-31)


The numbers 1-31 denotes the ASCII value of the character you wish to include. Characters 1-31 are all characters that affect text in Starcraft because character 32 is a space, and 0 is simply a null byte.

Hmm so for each kind of color//different spoof I need a seperate button??

And is that code only for the buttons?? Hmm this seems confusing, I'll send you an IM over AIM sometime today.

EDIT:


Private Sub Command1_Click()
Call Spoof text1.text = text1.text & Chr(1-31)
End Sub

This is probably wrong...Can you show me an example or something >_>

ViperSRT3g
01-22-2009, 09:17 AM
lol I gave you copy paste code to use it >.<


Private Sub Command1_Click()
text1.Text = text1.text & Chr(1)
End Sub


In Cobra I have it where the little color squares are an object array, and clicking a different one will make it select a case to insert the corresponding color where your cursor is in the text box. It's a little fancier than this "addon" method, but for now, play around with buttons. Eventually you won't even need them for many of the things you may do. Hell, since I'm releasing Cobra's source coding soon, I'll just give you a copy paste of it.


Private Sub imgColor_Click(Index As Integer)
Select Case imgColor(ByVal Index)
Case imgColor(0)
Spoofer_Name.SelText = Spoofer_Name.SelText + Chr(&HA)
Case imgColor(1)
Spoofer_Name.SelText = Spoofer_Name.SelText & Chr(&H1)
Case imgColor(2)
Spoofer_Name.SelText = Spoofer_Name.SelText & Chr(&H2)
Case imgColor(3)
Spoofer_Name.SelText = Spoofer_Name.SelText & Chr(&H3)
Case imgColor(4)
Spoofer_Name.SelText = Spoofer_Name.SelText & Chr(&H4)
Case imgColor(5)
Spoofer_Name.SelText = Spoofer_Name.SelText & Chr(&H5)
Case imgColor(6)
Spoofer_Name.SelText = Spoofer_Name.SelText & Chr(&H6)
Case imgColor(7)
Spoofer_Name.SelText = Spoofer_Name.SelText & Chr(&H7)
Case imgColor(8)
Spoofer_Name.SelText = Spoofer_Name.SelText & Chr(&H8)
Case imgColor(9)
Spoofer_Name.SelText = Spoofer_Name.SelText & Chr(&H9)
Case imgColor(10)
Spoofer_Name.SelText = Spoofer_Name.SelText & Chr(&H12)
Case imgColor(11)
Spoofer_Name.SelText = Spoofer_Name.SelText & Chr(&H13)
End Select
Spoofer_Name.SetFocus
End Sub