Global $kernel32 = DllOpen('kernel32.dll') Global $pid = ProcessExists('elementclient.exe') global $realBaseAddress = 0x0098657C global $sendPacketFunction = 0x005BD7B0
;//Deselect target (example usage of sendPacket) sendDeselectPacket($pid)
DllClose($kernel32)
Func logOut($toAccount, $pid) ;//Sends a packet to log the character from the server ;//If toAccount=1, it logs to character select ;//If toAccount=0, it exits completely local $packet, $packetSize
Func regularAttack($afterSkill, $pid) ;//Start with regular attacks. $afterskill is 1 if you ;//start attacking after using a skill. local $packet, $packetSize
Func rezToTown($pid) ;//Respawn in town after death local $packet, $packetSize
$packet = '0400' $packetSize = 2
sendPacket($packet, $packetSize, $pid) EndFunc
Func rezWithScroll($pid) ;//Respawn in the place you died, costs a rez scroll local $packet, $packetSize
$packet = '0500' $packetSize = 2
sendPacket($packet, $packetSize, $pid) EndFunc
Func pickUpItem($uniqueItemId, $itemTypeId, $pid) ;//Picks up an item. uniqueItemId is the unique id belonging ;//to the individual item on the ground. itemTypeId is the id for ;//the type of item it is. This would be the same as the last ;//part in the url on pwdatabase. example: ;//http://www.pwdatabase.com/pwi/items/3044 ;//the itemTypeId for gold is 3044.
Func deselectTarget($pid) ;//Deselects the currently selected target local $packet, $packetSize
$packet = '0800' $packetSize = 2
sendPacket($packet, $packetSize, $pid) EndFunc
Func updateInvPosition($invPosition, $pid) ;//This packet is sent whenever you pick up HH/TT items ;//Unsure as to why. Also happens when you find a ;//quest item or equipment. local $packet, $packetSize
Func swapItemInInv($invIndex1, $invIndex2, $pid) ;//Swaps the items in the two given inventory locations ;//The index for a standard unexpanded inventory runs from ;//0, top left, to 31, bottom right local $packet, $packetSize
Func splitStackItemInInv($invIndexSource, $invIndexDestination, $amount, $pid) ;//Splits a stack in your inventory located at invIndexSource ;//Take off $amouunt from the stack and place them at invIndexDestination ;//The index for a standard unexpanded inventory runs from ;//0, top left, to 31, bottom right local $packet, $packetSize
Func dropItemOnFloor($invIndexSource, $amount, $pid) ;//Drops the stack located at invIndexSource in your inventory ;//onto the floor. ;//The index for a standard unexpanded inventory runs from ;//0, top left, to 31, bottom right local $packet, $packetSize
Func swapEquip($equipIndex1, $equipIndex2, $pid) ;//Swaps the items in the two given equipment locations ;//The index for equipment runs from ;//0, weapon, to 24, speaker?. This also includes fashion ;//Obviously there aren't a lot of equipment types you can swap ;//besides rings. local $packet, $packetSize
Func swapEquipWithInv($invIndex, $equipIndex, $pid) ;//Swaps the items in the invIndex location with the ;//item in the equipment location ;//The index for equipment runs from ;//0, weapon, to 24, speaker?. This also includes fashion ;//The index for a standard unexpanded inventory runs from ;//0, top left, to 31, bottom right local $packet, $packetSize
Func acceptPartyInvite($playerId, $partyInviteCounter, $pid) ;//Accept an invite from playerId. partyInviteCounter is a counter that ;//is kept based on the amount of party invites you've had. See post ;//on how to find that value. local $packet, $packetSize
Func startNpcDialogue($npcId, $pid) ;//Opens up an NPC's main menu. Is necessary before ;//accepting/handing in quests, buy/sell/repair local $packet, $packetSize
Func useItem($index, $itemTypeId, $pid, $equip=0) ;//uses the item located at index. By default inventory index ;//is used. If equip=1, then equipment index is used. This ;//is necessary when toggling fly mode, as your fly gear ;//is then used. ;//itemTypeId is the id for ;//the type of item it is. This would be the same as the last ;//part in the url on pwdatabase. example: ;//http://www.pwdatabase.com/pwi/items/3044 ;//the itemTypeId for gold is 3044. local $packet, $packetSize
Func useSkill($skillId, $targetId, $pid) ;//uses the specified skill on the target. Pass your own ;//Id if you wish to use buffs. When teleporting targetId ;//is the targeted city. local $packet, $packetSize
Func cancelAction($pid) ;//Cancels for example your current skillCast local $packet, $packetSize
$packet = '2A00'
$packetSize = 2
sendPacket($packet, $packetSize, $pid) EndFunc
Func startMeditating($pid) ;//Starts meditating for faster HP/MP regen local $packet, $packetSize
$packet = '2E00'
$packetSize = 2
sendPacket($packet, $packetSize, $pid) EndFunc
Func stopMeditating($pid) ;//Stop meditating for faster HP/MP regen local $packet, $packetSize
$packet = '2F00'
$packetSize = 2
sendPacket($packet, $packetSize, $pid) EndFunc
Func useEmotion($emoteIndex, $pid) ;//uses the emotion located at index emoteIndex 0 to 26 local $packet, $packetSize
$packet = '3000' $packet &= _hex($emoteIndex, 4)
$packetSize = 4
sendPacket($packet, $packetSize, $pid) EndFunc
Func beIntimate($pid) ;//Uses the kissing / intimate emote when cuddling. local $packet, $packetSize
$packet = '3000' $packet &= '1D00'
$packetSize = 4
sendPacket($packet, $packetSize, $pid) EndFunc
Func swapItemInBank($bankIndex1, $bankIndex2, $pid) ;//swaps the location of two stacks in bank. bankIndex runs ;//from 0, topleft, to 15, bottomright, in a standard non ;//upgraded bank. local $packet, $packetSize
Func splitStackItemInBank($bankIndexSource, $bankIndexDestination, $amount, $pid) ;//Splits a stack in your bank located at bankIndexSource ;//Take off $amouunt from the stack and place them at bankIndexDestination ;//The index for a standard unexpanded bank runs from ;//0, top left, to 15, bottom right local $packet, $packetSize
Func swapItemBankAndInv($bankIndex, $invIndex, $pid) ;//Swaps a stack in your bank located at bankIndex ;//with one in your inventory located at invIndex local $packet, $packetSize
Func splitStackItemInBankToInv($bankIndexSource, $invIndexDestination, $amount, $pid) ;//Splits a stack in your bank located at bankIndexSource ;//Take off $amouunt from the stack and place them at invIndexDestination local $packet, $packetSize
Func splitStackItemInInvToBank($invIndexSource, $bankIndexDestination, $amount, $pid) ;//Splits a stack in your inventory located at invIndexSource ;//Take off $amouunt from the stack and place them at bankIndexDestination local $packet, $packetSize
Func useSkillWithoutCastTime($skillId, $targetId, $pid) ;//uses the specified skill on the target. This function is used ;// instead of the regular skill use one for skills such as ;// change to fox/tiger form or the speed buff skills. Pass your own ;//Id if you wish to use buffs. local $packet, $packetSize
Func initiateSettingUpCatShop($pid) ;//Starts setting up cat shop. This function is needed ;//before setting up the catshop. local $packet, $packetSize
$packet = '5400'
$packetSize = 2
sendPacket($packet, $packetSize, $pid) EndFunc
Func toggleFashionDisplay($pid) ;//Switches between fashion and regular appearance. local $packet, $packetSize
$packet = '5500'
$packetSize = 2
sendPacket($packet, $packetSize, $pid) EndFunc
Func acceptRez($pid) ;//Accept rez by a priest. local $packet, $packetSize
Func releaseCarryMode($pid) ;//Stop carrying / being carried local $packet, $packetSize
$packet = '6200'
$packetSize = 2
sendPacket($packet, $packetSize, $pid) EndFunc
Func summonPet($petIndex, $pid) ;//summons pet at index petIndex. petIndex runs from ;//0 to 9, depending on how many slots you have unlocked local $packet, $packetSize
$packet = '6400' $packet &= _hex($petIndex)
$packetSize = 6
sendPacket($packet, $packetSize, $pid) EndFunc
Func recallPet($pid) ;//recalls your currently summoned pet local $packet, $packetSize
$packet = '6500'
$packetSize = 2
sendPacket($packet, $packetSize, $pid) EndFunc
Func setPetMode($petMode, $pid) ;//Sets the pet to the specified mode: ;//petMode=0 -> defensive ;//petMode=1 -> attack ;//petMode=2 -> manual local $packet, $packetSize
Func handInQuest($questId,$optionIndex, $pid) ;//Hand in quest, select reward optionIndex, ;//which runs from 0 for first option, to more. local $packet, $packetSize
Func sellItem($itemTypeId,$invIndex,$amount, $pid) ;//Sell $amount of items of type itemTypeId, located at invIndex ;//This function could be expanded to include selling multiple items ;//simultaneously. This would require setting nBytes equal to ;//4 + 12 * nDifferent items. Add the extra items on the same way ;//as the first item. local $packet, $packetSize
$packet = '2500' $packet &= '02000000' $packet &= '10000000' ;//nBytes following $packet &= '01000000' ;//nDifferent items being sold $packet &= _hex($itemTypeId) $packet &= _hex($invIndex) $packet &= _hex($amount)
$packetSize = 26
sendPacket($packet, $packetSize, $pid) EndFunc
Func buyItem($itemTypeId,$shopIndex,$amount, $pid) ;//Buy $amount of items of type itemTypeId, located at shopIndex ;//shopIndex is calculated as follows: ;//Each tab in the shop has 32 available spaces, index of each space ;//starts at 0, index of each tab starts at 0. $shopIndex would then be ;//shopIndex = tabIndex * 32 + spaceIndex ;//This function could be expanded to include buying multiple items ;//simultaneously. This would require setting nBytes equal to ;//8 + 12 * nDifferent items. Add the extra items on the same way ;//as the first item. local $packet, $packetSize
Func repairItem($itemTypeId, $isEquipped, $locationIndex, $pid) ;//repairs the item of type itemTypeId at locationIndex, if ;//isEquipped=1, location refers to equipment. If isEquipped=0, ;//location refers to inventory. local $packet, $packetSize
Func sendPacket($packet, $packetSize, $pid) ;//Declare local variables Local $pRemoteThread, $vBuffer, $loop, $result, $OPcode, $processHandle, $packetAddress
;//Open process for given processId $processHandle = memopen($pid)
;//Allocate memory for the OpCode and retrieve address for this $functionAddress = DllCall($kernel32, 'int', 'VirtualAllocEx', 'int', $processHandle, 'ptr', 0, 'int', 0x46, 'int', 0x1000, 'int', 0x40)
;//Allocate memory for the packet to be sent and retrieve the address for this $packetAddress = DllCall($kernel32, 'int', 'VirtualAllocEx', 'int', $processHandle, 'ptr', 0, 'int', $packetSize, 'int', 0x1000, 'int', 0x40)
;//Put the OpCode into a struct for later memory writing $vBuffer = DllStructCreate('byte[' & StringLen($OPcode) / 2 & ']') For $loop = 1 To DllStructGetSize($vBuffer) DllStructSetData($vBuffer, 1, Dec(StringMid($OPcode, ($loop - 1) * 2 + 1, 2)), $loop) Next
;//Write the OpCode to previously allocated memory DllCall($kernel32, 'int', 'WriteProcessMemory', 'int', $processHandle, 'int', $functionAddress[0], 'int', DllStructGetPtr($vBuffer), 'int', DllStructGetSize($vBuffer), 'int', 0)
;//Put the packet into a struct for later memory writing $vBuffer = DllStructCreate('byte[' & StringLen($packet) / 2 & ']') For $loop = 1 To DllStructGetSize($vBuffer) DllStructSetData($vBuffer, 1, Dec(StringMid($packet, ($loop - 1) * 2 + 1, 2)), $loop) Next
;//Write the packet to previously allocated memory DllCall($kernel32, 'int', 'WriteProcessMemory', 'int', $processHandle, 'int', $packetAddress[0], 'int', DllStructGetPtr($vBuffer), 'int', DllStructGetSize($vBuffer), 'int', 0)
;//Create a remote thread in order to run the OpCode $hRemoteThread = DllCall($kernel32, 'int', 'CreateRemoteThread', 'int', $processHandle, 'int', 0, 'int', 0, 'int', $functionAddress[0], 'ptr', 0, 'int', 0, 'int', 0)
;//Wait for the remote thread to finish Do $result = DllCall('kernel32.dll', 'int', 'WaitForSingleObject', 'int', $hRemoteThread[0], 'int', 50) Until $result[0] <> 258
;//Close the handle to the previously created remote thread DllCall($kernel32, 'int', 'CloseHandle', 'int', $hRemoteThread[0])
just got IDA Pro installed, I'm totally blind with it lol, could you pls explain the first steps before searching this (void *Src, size_t Size)
cmiiw :
1. run IDA Pro
2. drag elementclient.exe
3. choose portable executable for 80386 [PE] , then click ok without messing other things.
4. fill (void *Src, size_t Size) in text search
but the result is far too different compared to your screenshot, dunno what I did wrong, please advise.
0062F320 53 PUSH EBX
0062F321 56 PUSH ESI
0062F322 8B7424 10 MOV ESI,DWORD PTR SS:[ESP+10]
0062F326 57 PUSH EDI
0062F327 8D1CB5 02000000 LEA EBX,DWORD PTR DS:[ESI*4+2]
0062F32E 53 PUSH EBX
0062F32F E8 BC9D1B00 CALL elementc.007E90F0
0062F334 8BF8 MOV EDI,EAX
0062F336 83C4 04 ADD ESP,4
0062F339 85FF TEST EDI,EDI
0062F33B 74 3B JE SHORT elementc.0062F378
0062F33D 66:8B4424 10 MOV AX,WORD PTR SS:[ESP+10]
0062F342 85F6 TEST ESI,ESI
0062F344 66:8907 MOV WORD PTR DS:[EDI],AX
0062F347 74 17 JE SHORT elementc.0062F360
0062F349 8D4F 02 LEA ECX,DWORD PTR DS:[EDI+2]
0062F34C 7E 12 JLE SHORT elementc.0062F360
0062F34E 8D4424 14 LEA EAX,DWORD PTR SS:[ESP+14]
0062F352 8B50 04 /MOV EDX,DWORD PTR DS:[EAX+4]
0062F355 83C0 04 |ADD EAX,4
0062F358 8911 |MOV DWORD PTR DS:[ECX],EDX
0062F35A 83C1 04 |ADD ECX,4
0062F35D 4E |DEC ESI
0062F35E ^75 F2 \JNZ SHORT elementc.0062F352
0062F360 A1 0CB9A500 MOV EAX,DWORD PTR DS:[A5B90C] <--- base adress
0062F365 53 PUSH EBX <--- code length
0062F366 57 PUSH EDI <--- code position in client
0062F367 8B48 20 MOV ECX,DWORD PTR DS:[EAX+20] <--- ecx = [base + 0x20] (char struct)
0062F36A E8 A1EFFDFF CALL elementc.0060E310 <--- used call
0062F36F 57 PUSH EDI
0062F370 E8 8B9D1B00 CALL elementc.007E9100
0062F375 83C4 04 ADD ESP,4
0062F378 5F POP EDI
0062F379 5E POP ESI
0062F37A 5B POP EBX
0062F37B C3 RETN
so letz build a script in autoit to make our script get the adress for us...
all we have to do is replace the variable call and jump adresses by placeholders and run regexp funcs to get the adresses.
Edit:
btw Interest07 you should make autoit caluculate the packet size.
and beside that static stuff should allways stay written in the client. if you keep on redoing the same stuff over and over again, you're just wasting cpu and memory.
oops, little error in that function Smurfin, it should say $amount, not $invIndex.
I edited it in the first post now
@lolkop, i know I can just calculate the size of the packet, but I like it better this way (not sure why, just gives me a more complete view of the different packets to me I guess). What static stuff are you referring to?
@lolkop, i know I can just calculate the size of the packet, but I like it better this way (not sure why, just gives me a more complete view of the different packets to me I guess). What static stuff are you referring to?
everything thats not needing any parameters is static.
simply store the code to push in the memory. there's no need to delete it right after using it and rewrite it some secs later...
what tools do you use to get packets ? is it wpepro ?
can we intercept packets and tamper with it before send it back to the game ?
I remember ever done it using wpe pro on other game, putting 1million gold to storage/inventory bank then withdraw 100k, the server will send packet contain a value of 100.000 [in hex i think] , then wpepro will search that value in the packet and alter it then send it back to the game, but I was disconnected. Tried it on PW long time ago when I play on pw my en, but I forgot the result, it just didn't work.
I wonder if we can use it like that, record a succesful refine equipment packet, then replace whatever incoming packet with the recorded succesful refine packet for the next refines, is it doable ?
The packets are encrypted before sent to the server as far as I know, so WPE pro won't help. I view the packets by settings a breakpoint at the sendPacket function (so before encryption) using MHS and displaying whats in the stack. YOu can automatically edit the packets here if you wish, but the above methods shouldn't be possible though, as you send a packet to the server saying "Please refine this n that item" instead of "I refined this item, update it please"
@Interest07 :
ohh I see , thought it was that simple.
btw have you ever found anything related to refining equips, like the formula of how the game decide the success rate, do they put like a 100% fail rate randomly too ?
hi vuduy, what other language do you suggest ? the easiest one for beginner.
C# is the easiest/quickest to use and program anything.
Like you, I started with AutoIt 5-6 years ago, then I switched to coding in C++/.NET which is alright, then on to C# which I find so easy and fast to make a program.
Of course, everything is self-learn. If you can learn AutoIt on your own then you will be able to learn C# easily, and you will find that whatever things you do in AutoIt, you can do it in C# with fewer lines and a lot faster.
Did I mention that you will cut CPU usage down by at least 50%?
I agree autoit seems like using too much resources, the tool I made uses like from 0 to 24% CPU usage randomly at times on a quadcore x3350, could be because of my noobness in making it though , but still kinda surprising coz when I look in task manager sometimes it's just on top and even beat elementclient.exe itself lol
Did I mention that you will cut CPU usage down by at least 50%?
Epic Fail!
code efficience is not language related!
Quote:
Originally Posted by vuduy
If you can learn AutoIt on your own then you will be able to learn C# easily, and you will find that whatever things you do in AutoIt, you can do it in C# with fewer lines and a lot faster.
you won't be able to do anything in less lines than it could be done in autoit.
Help with sending packets in autoit 08/16/2010 - AutoIt - 1 Replies ive been lookin around different sites for ways to send packets to the game server. the only examples i see is to create a server and a client which i dont need, i think. well to the point now, can someone lead me in a direction or tell me how to send packets to a game? also if i send packets then that means i dont need the game to be active, correct? Because in autoit when u use keys u need to have the game active, and control send does not work. ty
Sending Packets !!! 09/07/2008 - Kal Online - 14 Replies now i know how to sniff / analyse packets ... but what then ? :)
how can i send packets ?? to pimp or mix weapon for example
i just need the way to send , and then i can depend on myself :D
Sending Packets (need advice) 03/20/2008 - Conquer Online 2 - 7 Replies OK well im finaly trying to stop leaching off of everybodys work its been great n all download n play :D But im tired of being a begger n the past couple months ive been learning as much as i can about macros memery add blah blah you know ...
After playing around with ce and ahk the past couple months i stumbled across wpe pro, theres not alot of tuturals and its hard to find good help.
Well heres what ive been doing so far, open my CO then i attach it to my sniffer.
I change my...
Scamming by sending packets??? 04/15/2006 - Conquer Online 2 - 1 Replies Well my friend and i came up with the idea to send packets to the server to show a certain item in the trade window. We want to use this as a type of scam. I didnt see this in any other threads and was wondering if anyone knew if this is possible and if they could point use in the right direction. My friend was pretty good with packets in CO 1.0 but we arent really sure to go about doing it. If anyone one could please lend a helping hand?
P.S.- Before I get flamed for this because i know i...
Sending packets 10/12/2005 - Conquer Online 2 - 10 Replies I've a question. Is it possible to send 1 packet multiple times at the exact same time?