inline asm to bytes menu

User Tag List

Results 1 to 5 of 5
  1. #1
    karapidiola's Avatar Active Member
    Reputation
    51
    Join Date
    Mar 2008
    Posts
    166
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    inline asm to bytes

    not the best way but a works way at all

    Code:
    #include <stdio.h>
    #include <windows.h>
    
    
    void TestFunction(){
    
    
    	__asm{
    	
    	
    		nop
    		nop
    		nop
    		nop
    		
    		push	1
    		call	exit
    	
    		nop
    		nop
    		nop
    		nop
    
    	};
    
    }
    
    	/*
    		push	tmpptr
    		push	ffs
    		call	printf
    */
    void FuncToBytes(void*function,DWORD byte_start,DWORD byte_end){
    
    	char *ff_s = "Hacking Into The Function Location : 0x%x\n";
    	char *ffs = "ESI First 4 Bytes Location : 0x%x\n";
    	char *ff_s_ = "ESI Last 4 Bytes Location : 0x%x\n";
    	char *Bytez = "OpCodes 0x%x In Addr 0x%x\n";
    
    	DWORD	*start_addr;
    	DWORD	*end_addr;
    
    	__asm{
    
    		mov		esi,	function
    
    		push	esi
    		push	ff_s
    		call	printf
    
    		jmp		de
    
    jmp_inc:inc		esi
    		jmp		de
    de:
    		mov		ebx,	[esi]
    		cmp		ebx,	byte_start
    		jne		jmp_inc
    
    		push	esi
    		push	ffs
    		call	printf
    		
    		mov		start_addr,		esi
    
    		jmp		next_
    
    next_:	add		esi,	4
    		xor		ebx,	ebx
    		jmp		s_scan	
    		
    jmp_:	inc		esi
    
    		jmp		s_scan
    
    s_scan:	mov		ebx,	[esi]
    		cmp		ebx,	byte_end
    		jne		jmp_
    
    
    		mov		end_addr,		esi
    		//sub		end_addr,		4
    
    		push	esi
    		push	ff_s_
    		call	printf
    
    		xor		esi,	esi
    
    	};
    
    	printf("\n");
    
    	for(DWORD i=(unsigned long)start_addr; i<(unsigned long)end_addr;i++){
    			//Bytez	
    		__asm{
    			
    			mov		esi,	i
    			mov		ebx,	[esi]
    
    			push	esi
    			push	ebx
    			push	Bytez
    			call	printf
    					
    		}
    
    	
    	}
    	__asm{
    	
    			call	exit
    	
    	}
    }
    
    int main(){
    					      //first nops //last nops
    	FuncToBytes(TestFunction,0x90909090,0x90909090);
    
    	return 0;
    }

    inline asm to bytes
  2. #2
    flo8464's Avatar Active Member
    Reputation
    30
    Join Date
    Apr 2009
    Posts
    434
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, looks usefull.

  3. #3
    xLeo123's Avatar Member
    Reputation
    1
    Join Date
    Jan 2009
    Posts
    27
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    void Start(){}
    void Function()
    {
    
    }
    void End(){}
    
    
    
    void doit()
    {
    	unsigned char tmpbuf[512];//let's try this.
    	unsigned char buf[512];
    	int EndAddy = (long)&End;
    	int StartAddy = (long)&Start;
    	printf("End: %X -- Start: %X\n\n", EndAddy, StartAddy);
    	int size = ((long)&End) - ((long)&Start);
    	printf("Injecting Code [%d]\nFunction ASM: \n", size);
    	memcpy(tmpbuf, (void*)((long)&Function), size);
    	for(int i=0;i<size;i++)
    	{
    		buf[i] = tmpbuf[i];
    		printf("%.2X ", buf[i]);	
    		if(tmpbuf[i] == 0xC3)
    			break;
    	}
    	printf("\n");
    }

  4. #4
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1356
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Much better alternative to most applications of inline ASM:
    asmjit - Project Hosting on Google Code

    AsmJit ftw.

  5. #5
    xLeo123's Avatar Member
    Reputation
    1
    Join Date
    Jan 2009
    Posts
    27
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Will take a look, thanks

Similar Threads

  1. [Guide] Modifying Bytes (NPC customization)
    By dBloc in forum WoW EMU Guides & Tutorials
    Replies: 5
    Last Post: 04-09-2009, 07:06 AM
  2. Injecting ASM problems
    By lanman92 in forum WoW Memory Editing
    Replies: 33
    Last Post: 03-16-2009, 06:46 AM
  3. [ASM]MMOPro ArcEmu Server Manager CMS
    By ghostay in forum World of Warcraft Emulator Servers
    Replies: 12
    Last Post: 09-05-2008, 09:27 AM
  4. ASM function call?
    By akh in forum WoW Memory Editing
    Replies: 15
    Last Post: 09-02-2008, 12:31 AM
  5. Some Useful ASM info
    By Hausmaster in forum WoW Memory Editing
    Replies: 1
    Last Post: 03-23-2008, 06:32 PM
All times are GMT -5. The time now is 05:52 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search