Results 1 to 6 of 6
  1. #1
    ADACH
    ADACH is offline
    Member-in-training ADACH's Avatar
    Join Date
    2010 May
    Posts
    170
    Thanks Thanks Given 
    25
    Thanks Thanks Received 
    168
    Thanked in
    46 Posts
    Rep Power
    15

    Login data autofill

    Несколько дней назад мне понадобилось реализовать авто заполнение логина и пароля.
    Вот то, что из этого получилось:

    Поля ввода

    являются объектами класса gui_InputLine и имеют такие id: LOGIN_ID_INPUTLINE, LOGIN_PW_INPUTLINE.

    Задать им необходимые значения проще всего установив сплайс на конструктор данного класса (экспортируемая функция из GUI.dll gui_InputLine::gui_InputLine(gui_Base *,char const *))
    с помощью функции gui_InputLine::SetInputText(char const *).


    Code:
    #include <Windows.h>
    #include "../externalModules/spliceHookClass.h"
    #include "dbgLib.h"
    
    const char nameInputLineID [] = "LOGIN_ID_INPUTLINE";
    const char passInputLineID [] = "LOGIN_PW_INPUTLINE";
    
    DWORD setInputText;
    DWORD inputLineConstrOrig;
    spliceHook inputLineConstrHk;
    
    DWORD stage = 0;
    static char login    [4096];
    static char password [4096];
    
    void __declspec(naked) constructorSplice()
    {
    	DWORD parentItem;
    	char * newItemId;
    	DWORD pThis;
    	DWORD result;
    	//инициализация
    	_asm
    	{
    		//пролог ф-и
    		push ebp
    		mov ebp, esp
    		sub esp, __LOCAL_SIZE
    		//и сохранение необходимых значений (this и параметры)
    		mov eax, [ebp+0x8]
    		mov [parentItem],eax
    		mov eax, [ebp+0xC]
    		mov [newItemId],eax
    		mov [pThis],ecx
    	}
    	//сравнение id элемента с искомым
    	if(stage == 0 &&!strcmp(nameInputLineID,newItemId))
    		stage = 1;
    	else if(stage == 1 && !strcmp(passInputLineID,newItemId))
    		stage = 2;
    	//вызов оригинальной функции и сохранение результатов вызова
    	_asm
    	{
    		mov ecx,[pThis]
    		push [newItemId]
    		push [parentItem]
    		call [inputLineConstrOrig]
    		mov [result],eax
    	}
    	//установка логина
    	if(stage == 1)
    	{
    		_asm
    		{
    			mov ecx,[result]
    			lea eax, login
    			push eax
    			call [setInputText]
    
    			mov eax,[result]
    			mov ecx,[pThis]
    			mov esp,ebp
    			pop ebp
    			retn 8
    		}
    	}
    	//установка пароля и завершение работы
    	if(stage == 2)
    	{
    		_asm
    		{
    			mov ecx,[result]
    			lea eax, password
    			push eax
    			call [setInputText]
    		}
    		inputLineConstrHk.UnHook();
    		_asm
    		{
    			mov eax,[result]
    			mov ecx,[pThis]
    			mov esp,ebp
    			pop ebp
    			retn 8
    		}
    	}
    }
    
    void fillLoginData(const char * pLogin, const char * pPassword)
    {
    	strcpy(login,pLogin);
    	strcpy(password,pPassword);
    	HMODULE hDll = GetModuleHandleA("GUI.dll");
    	dbgBreak(!hDll);
    	DWORD inputLineConstr = (DWORD)GetProcAddress(hDll,"??0gui_InputLine@@QAE@PAVgui_Base@@PBD@Z");
    	dbgBreak(!inputLineConstr);
    	setInputText = (DWORD)GetProcAddress(hDll,"?SetInputText@gui_InputLine@@QAEXPBD@Z");
    	dbgBreak(!setInputText);
    	inputLineConstrOrig = inputLineConstrHk.Hook((PTR)inputLineConstr,(PTR)constructorSplice);
    }

  2. The Following 6 Users Say Thank You to ADACH For This Useful Post:


  3. #2
    fr33k
    fr33k is offline
    New member
    Join Date
    2011 Mar
    Posts
    16
    Thanks Thanks Given 
    1
    Thanks Thanks Received 
    6
    Thanked in
    2 Posts
    Rep Power
    0
    Can you help me?
    I'm new to programming and I don't know why do I get errors for dbglib.h and spliceHookClass.h, it says "no such file or directory". (Im using Code::Blocks with GCC Compiler and GDB debugger.)

    If these headers are some basic ones which should be in the system or somewhere already, please tell me how can I set them up correctly. And if they are some custom ones, let me know how to make them or just give a full code, please..
    Last edited by fr33k; 2011-03-17 at 07:29 PM.

  4. #3
    ADACH
    ADACH is offline
    Member-in-training ADACH's Avatar
    Join Date
    2010 May
    Posts
    170
    Thanks Thanks Given 
    25
    Thanks Thanks Received 
    168
    Thanked in
    46 Posts
    Rep Power
    15
    Quote Originally Posted by fr33k View Post
    And if they are some custom ones, let me know how to make them
    dbglib.h - some debugging macroses (in this code used only dbgBreak macro).
    spliceHookClass.h - my own private (and buggy ) splice hooking engine (write your own or use some public engine).
    Quote Originally Posted by fr33k View Post
    or just give a full code, please..
    This code is enough to understand the ideas and writing their own version, but not enough for easy ripping.

  5. #4
    fr33k
    fr33k is offline
    New member
    Join Date
    2011 Mar
    Posts
    16
    Thanks Thanks Given 
    1
    Thanks Thanks Received 
    6
    Thanked in
    2 Posts
    Rep Power
    0
    Im totally new to these kinds of things... I think I'll just pass on it..as I don't understand almost everything. :/

  6. #5
    bbExTr1m`
    bbExTr1m` is offline
    New member
    Join Date
    2011 May
    Posts
    5
    Thanks Thanks Given 
    0
    Thanks Thanks Received 
    1
    Thanked in
    1 Post
    Rep Power
    0
    ну не знаю) по моему логин ввести пустяковое дело) лень лень лень)

  7. #6
    magnym
    magnym is offline
    Member-in-training
    Join Date
    2010 Jun
    Posts
    86
    Thanks Thanks Given 
    17
    Thanks Thanks Received 
    1
    Thanked in
    1 Post
    Rep Power
    0
    да это нужно для полной автоматизации бота,запускаешь скриптом все это дело,скриптом запускаешь бота у пд,выставляешь время и все,можно компом удаленно управлять.раз в 3-4 часа перезапуск)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •