Jump to content

darkjohn20

Active Members
  • Posts

    339
  • Joined

  • Last visited

Everything posted by darkjohn20

  1. Check this out. Hopefully THIS doesn't break forum rules. Edit: If you need any additional help with AutoIt and memory editing message me!
  2. $iMinutes = 5 $hTimer = TimerInit() While 1 If TimerDiff($hTimer) > ($iMinutes * 60000) Then ConsoleWrite("5 minutes have passed!" & @CRLF) $hTimer = TimerInit() EndIf WEnd
  3. Use the Pointer functions in NomadMemory.au3 ;================================================================================================= ; Function: _MemoryPointerRead ($iv_Address, $ah_Handle, $av_Offset[, $sv_Type]) ; Description: Reads a chain of pointers and returns an array containing the destination ; address and the data at the address. ; Parameter(s): $iv_Address - The static memory address you want to start at. It must be in ; hex format (0x00000000). ; $ah_Handle - An array containing the Dll handle and the handle of the open ; process as returned by _MemoryOpen(). ; $av_Offset - An array of offsets for the pointers. Each pointer must have an ; offset. If there is no offset for a pointer, enter 0 for that ; array dimension. ; $sv_Type - (optional) The "Type" of data you intend to read at the destination ; address. This is set to 'dword'(32bit(4byte) signed integer) by ; default. See the help file for DllStructCreate for all types. ; Requirement(s): The $ah_Handle returned from _MemoryOpen. ; Return Value(s): On Success - Returns an array containing the destination address and the value ; located at the address. ; On Failure - Returns 0 ; @Error - 0 = No error. ; 1 = $av_Offset is not an array. ; 2 = Invalid $ah_Handle. ; 3 = $sv_Type is not a string. ; 4 = $sv_Type is an unknown data type. ; 5 = Failed to allocate the memory needed for the DllStructure. ; 6 = Error allocating memory for $sv_Type. ; 7 = Failed to read from the specified process. ; Author(s): Nomad ; Note(s): Values returned are in Decimal format, unless a 'char' type is selected. ; Set $av_Offset like this: ; $av_Offset[0] = NULL (not used) ; $av_Offset[1] = Offset for pointer 1 (all offsets must be in Decimal) ; $av_Offset[2] = Offset for pointer 2 ; etc... ; (The number of array dimensions determines the number of pointers) ;================================================================================================= Func _MemoryPointerRead($iv_Address, $ah_Handle, $av_Offset, $sv_Type = 'dword') If IsArray($av_Offset) Then If IsArray($ah_Handle) Then Local $iv_PointerCount = UBound($av_Offset) - 1 Else SetError(2) Return 0 EndIf Else SetError(1) Return 0 EndIf Local $iv_Data[2], $i Local $v_Buffer = DllStructCreate('dword') For $i = 0 To $iv_PointerCount If $i = $iv_PointerCount Then $v_Buffer = DllStructCreate($sv_Type) If @error Then SetError(@error + 2) Return 0 EndIf $iv_Address = '0x' & Hex($iv_Data[1] + $av_Offset[$i]) DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '') If @error Then SetError(7) Return 0 EndIf $iv_Data[1] = DllStructGetData($v_Buffer, 1) ElseIf $i = 0 Then DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '') If @error Then SetError(7) Return 0 EndIf $iv_Data[1] = DllStructGetData($v_Buffer, 1) Else $iv_Address = '0x' & Hex($iv_Data[1] + $av_Offset[$i]) DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '') If @error Then SetError(7) Return 0 EndIf $iv_Data[1] = DllStructGetData($v_Buffer, 1) EndIf Next $iv_Data[0] = $iv_Address Return $iv_Data EndFunc ;==>_MemoryPointerRead ;================================================================================================= ; Function: _MemoryPointerWrite ($iv_Address, $ah_Handle, $av_Offset, $v_Data[, $sv_Type]) ; Description: Reads a chain of pointers and writes the data to the destination address. ; Parameter(s): $iv_Address - The static memory address you want to start at. It must be in ; hex format (0x00000000). ; $ah_Handle - An array containing the Dll handle and the handle of the open ; process as returned by _MemoryOpen(). ; $av_Offset - An array of offsets for the pointers. Each pointer must have an ; offset. If there is no offset for a pointer, enter 0 for that ; array dimension. ; $v_Data - The data to be written. ; $sv_Type - (optional) The "Type" of data you intend to write at the destination ; address. This is set to 'dword'(32bit(4byte) signed integer) by ; default. See the help file for DllStructCreate for all types. ; Requirement(s): The $ah_Handle returned from _MemoryOpen. ; Return Value(s): On Success - Returns the destination address. ; On Failure - Returns 0. ; @Error - 0 = No error. ; 1 = $av_Offset is not an array. ; 2 = Invalid $ah_Handle. ; 3 = Failed to read from the specified process. ; 4 = $sv_Type is not a string. ; 5 = $sv_Type is an unknown data type. ; 6 = Failed to allocate the memory needed for the DllStructure. ; 7 = Error allocating memory for $sv_Type. ; 8 = $v_Data is not in the proper format to be used with the ; "Type" selected for $sv_Type, or it is out of range. ; 9 = Failed to write to the specified process. ; Author(s): Nomad ; Note(s): Data written is in Decimal format, unless a 'char' type is selected. ; Set $av_Offset like this: ; $av_Offset[0] = NULL (not used, doesn't matter what's entered) ; $av_Offset[1] = Offset for pointer 1 (all offsets must be in Decimal) ; $av_Offset[2] = Offset for pointer 2 ; etc... ; (The number of array dimensions determines the number of pointers) ;================================================================================================= Func _MemoryPointerWrite ($iv_Address, $ah_Handle, $av_Offset, $v_Data, $sv_Type = 'dword') If IsArray($av_Offset) Then If IsArray($ah_Handle) Then Local $iv_PointerCount = UBound($av_Offset) - 1 Else SetError(2) Return 0 EndIf Else SetError(1) Return 0 EndIf Local $iv_StructData, $i Local $v_Buffer = DllStructCreate('dword') For $i = 0 to $iv_PointerCount If $i = $iv_PointerCount Then $v_Buffer = DllStructCreate($sv_Type) If @Error Then SetError(@Error + 3) Return 0 EndIf DllStructSetData($v_Buffer, 1, $v_Data) If @Error Then SetError(8) Return 0 EndIf $iv_Address = '0x' & hex($iv_StructData + $av_Offset[$i]) DllCall($ah_Handle[0], 'int', 'WriteProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '') If @Error Then SetError(9) Return 0 Else Return $iv_Address EndIf ElseIf $i = 0 Then DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '') If @Error Then SetError(3) Return 0 EndIf $iv_StructData = DllStructGetData($v_Buffer, 1) Else $iv_Address = '0x' & hex($iv_StructData + $av_Offset[$i]) DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '') If @Error Then SetError(3) Return 0 EndIf $iv_StructData = DllStructGetData($v_Buffer, 1) EndIf Next EndFuncSomething like: $hMemoryOpen = _MemoryOpen(ProcessExists("process.exe")) $aOffsets[3] = [0, Dec(20), Dec(474)] $aRead = _MemoryPointerRead(0x00A5BFCC, $hMemoryOpen, $aOffsets) MsgBox(0, "Test", $aRead[1]) _MemoryClose($hMemoryOpen)should work, but hasn't been tested.
  4. http://msdn.microsoft.com/en-us/library/ms680345%28v=vs.85%29.aspx could be helpful to see if a debugger is present, and if so, close the program.
  5. He means store all of your data on the server, like player's money, etc. so that they can't change it on their computer. Also, by encryption he means encrypt the data being sent to the client so it's not easy to read.
  6. Oops, just realized that I can't have "0x" in my hex value when using Dec(). Problem solved. Sorry about that one. It took me longer to type my question than it did to figure out the answer. School has fried my brain!
  7. Here's a start for you. Not sure if it's what you needed, but it should give you a good idea of how to start. $sInput = InputBox("Add Timer", "Format:" & @CRLF & "mm/dd/yyyy hh:mm:ss 'title' 'description' 'priority'", "12/11/2010 12:34:00 'Test' 'A Test Timer' 'High'") FileWrite("log.log", $sInput) $sRead = FileReadLine("log.log") $aDetails = StringRegExp($sRead, "(\d{1,2}/\d{1,2}/\d{4}) (\d{2}:\d{2}:\d{2}) '(.+)' '(.+)' '(.+)'", 1) MsgBox(0, "FileRead", "Date: " & $aDetails[0] & @CRLF & _ "Time: " & $aDetails[1] & @CRLF & _ "Title: " & $aDetails[2] & @CRLF & _ "Description: " & $aDetails[3] & @CRLF & _ "Priority: " & $aDetails[4]) FileDelete("log.log") Look in the help file for FileReadLine to see how to use it to read the whole file. Currently this reads 1 line and does not support multiline parameters.
  8. Wow, this looks pretty interesting. I do have one question though. What are the advantages of this over FTP.au3, for example. Is it faster? More flexibility? If there were benefits I would definitely use this!
  9. Alright, so I'm trying to connect to a FTP Server. My problem is that I need a way to differentiate between _FTP_Connect: Not finding a ServerHaving trouble logging inAs these things both return 0 by _FTP_Connect, I cannot determine which one is actually the problem. Any ideas?Also, there is no problem with my other code, such as _FTP_Open, because on other servers I can connect just fine. Sorry for the minimal amount of information. I don't know how else to explain what I need help with. Edit: Solved this one myself. Guess this could server as help for anyone else with a similar problem. Func _FTP_ServerExists() Local $sFTP_Error, $sFTP_Message _FTP_GetLastResponseInfo($sFTP_Error, $sFTP_Message) If StringReplace(StringReplace(StringReplace(StringReplace($sFTP_Message, @TAB, ""), @LF, ""), @CR, ""), " ", "") = "" Then ConsoleWrite("No Response!" & @CRLF) Return 0 EndIf Return 1 EndFunc
  10. Alright, thanks. After talking with the creator/writer/whatever you want to call him, I have confirmed that GetClientAddressTCP can only be used in C++, and that GetClientIPTCP is what I was looking for.
  11. Thanks for informing me. I honestly don't have any idea what a constructor is, I was just wondering if it would be of any help. I found the right command so the original question(s) don't need to be answered.
  12. Yes, I am. Since Mike is a friend of mine I'm asking him about the situation. This is the function I'm trying to use, and my guess is it isn't in the "Normal DLL", or it's under an extended name. Edit: AHH. It appears that there is also the command GetClientIPTCP. That's exactly what I need. Problem is most likely solved, because I seem to remember that command from version 1. I feel kind of stupid now. That command was there the whole time, but I didn't find it somehow.
  13. Well, the error code is 3, so I guess the function doesn't exist. I'll review the source code to see if it's under a different name. I also realize that I'm leaving a big gap. At first I figured that NetAddress was the problem, and I also figured that that was a well known Class or whatever you want to call it. About 5 minutes after I posted I realized that it wasn't, which would be confusing to anybody reading the topic. I'll look through the code to see if I can locate the problem. I'll come back when I figure out what is going on. Thanks for your time and sorry for the confusion.
  14. My code doesn't work. I'm trying to figure out why. All I was stating before was that I have everything set up correctly, it's just the DLL Call that isn't working out. The two parameters have the correct values, and the function name is right. Meaning that I'm using $aReturn[0] later in my code. The problem is that the DLL call is failing. My full function is: Func _GetClientAddressTCP($iInstance, $iClientID) Local $aReturn = DllCall($hDLL, "str:cdecl", "GetClientAddressTCP", "ulong_ptr", $iInstance, "ulong_ptr", $iClientID) Return $aReturn[0] EndFunc And yes, the DLL is defined AND opened.
  15. Yes, it throws an error and returns 0. It's named $aReturn for a reason . I also have the $aReturn[0] later in my code, which is why the error is thrown, because [0] doesn't exist. Edit: I believe that it's not working because of a problem with the return type. My other parameters are correct and I'm accessing it correctly later in the script (as an array, that is).
  16. When it doesn't create an array $aReturn gives the value 0. Otherwise it won't give any value.
  17. The problem was that I was using the wrong command. The correct one returns a string. The original question didn't make any sense and was too open ended, so it has been removed. Please don't bump!
  18. It's never returned for me. I've waited minutes, but nothing happened. I even opened the server while it was trying to connect to see if it would pick it up and it didn't. Is there a way to change the timeout in the UDF? And also, is there a way to get around $hSocket returning 0 when a client disconnects? ;... _TCP_RegisterEvent($hServer, $TCP_DISCONNECT, "_OnDisconnect") ;... Func _OnDisconnect($hSocket, $iError) ConsoleWrite($hSocket) ;Writes "0" EndFunc
  19. Thanks, works great. I've got to remember \Q and \E.
  20. When I call _TCP_Client_Create() when no server is present, it doesn't return, it just hangs. What can I do to fix this? This is the function I was hoping to use, but it hangs on the first _TCP_Client_Create(): Func _TCPClientCreateEx($sIP, $iPort) Local $hClient = 0, $iRetries = 0, $iMaxRetries = 10 Do ConsoleWrite("Attempting to connect to " & $sIP & ":" & $iPort & "..." & @CRLF) $hClient = _TCP_Client_Create($sIP, $iPort) $iRetries += 1 Until $hClient Or ($iRetries >= $iMaxRetries) If $iRetries >= $iMaxRetries Then ConsoleWrite("Connection to server failed after " & $iRetries & " retries." & @CRLF) Exit ElseIf $hClient Then _TCP_RegisterEvent($hClient, $TCP_CONNECT, "_OnConnect") _TCP_RegisterEvent($hClient, $TCP_DISCONNECT, "_OnDisconnect") _TCP_RegisterEvent($hClient, $TCP_RECEIVE, "_OnReceive") Return $hClient Else ConsoleWrite("Other error while connecting" & @CRLF) Exit EndIf EndFunc
  21. I'm trying to figure out a way to validate usernames. The StringRegExp needs to find any of the following in any order, in any place, and in any quantity. It doesn't need to return them, just check if it exists. ` ~ @ # $ % ^ & * ( ) { } [ ] ; : ' " / \ > < . , I have this so far, but it doesn't work for some reason. I'm guessing it's probably because of the quotes inside the quotes. "[`~@#$%^&\*\(\)\{\}\[\];:'"\/\\><.,]" I read the page on having double quotes like "here is a ""double-quote"" - ok?" but I don't know if it can help me. I tried that, as well, with no success.
  22. Look at the ini functions, I believe there is something like IniReadSectionNames, which will store everything between the [] to an array, then just read the appropriate section.
  23. Personally I would write it to a .ini file. The section name would be a word, and the key "Definition" would contain the definition. You could even add a hint in there if you felt like it. Then you could read the section names to an array, and randomly select one. As for creating chapters/classes, I would just make a new file for each one. Inside it could look like: [Word1] Definition="Word1's Definition" Hint="Word1's Hint" [Word2] Definition="Word2's Definition" Hint="Word2's Hint" Would you really want the program to accept an input for the answer, or just see if you know it yourself, click "Show Answer" and compare? In my opinion it would be difficult to compare answers. To save the card, the pseudo-code could look like: IniWrite("filename.ini", GuiCtrlRead($TheWord), "Definition", GuiCtrlRead($TheDefinition))
  24. Alright, no problem. Another question: What about Reading/Writing to registers? That would be quite useful for many people. I would do it myself but I'm afraid I don't know much about how to do it in ANY language. Edit:: I found how, but I'm not sure how to go about converting it to AutoIt. I would love to help create this if at all possible. http://msdn.microsoft.com/en-us/library/ms679362%28VS.85%29.aspx #include <windows.h> #include <process.h> #include <stdio.h> #include <assert.h> void mythreadfunc(void *data) { ... _exitthread(); } void changeThreadState() { HANDLE thread = (HANDLE)_beginthread( mythreadfunc, 0, NULL ); CONTEXT context; BOOL success; SuspendThread(thread); // get context context.ContextFlags = (CONTEXT_FULL); success = GetThreadContext(thread, &context); assert(success); printf( "eax=%08X, ebx=%08X, ecx=%08X\n", context.Eax, context.Ebx, context.Ecx ); // change context (dangerous, can crash program) context.Eax = 0x1234BBBB; context.Ecx = 0x2468ABCD; success = SetThreadContext(thread, &context); assert(success); ResumeThread(thread); // the resumed thread should see different values of eax, and ecx }
  25. Any chance you could add reading and writing to pointers? It looks pretty simple based on the NomadMemory version. Just a loop of reading addresses it appears.
×
×
  • Create New...