Exetools  

Go Back   Exetools > General > Source Code

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 10-03-2022, 01:23
Insid3Code's Avatar
Insid3Code Insid3Code is offline
Family
 
Join Date: May 2013
Location: Algeria
Posts: 84
Rept. Given: 47
Rept. Rcvd 60 Times in 30 Posts
Thanks Given: 24
Thanks Rcvd at 108 Times in 56 Posts
Insid3Code Reputation: 60
Hi,
Using MSVC to compile "C snippet" and generate masm listing code:

Code:
	.686p
	.mmx
	.xmm
	.model flat, stdcall
	option casemap :none

	printf PROTO c :vararg
	EXTRN getchar:PROC

	includelib msvcrt.lib

.const
result DB 'se! %i', 0aH, 00H

.Code
tv273 = -52						; size = 4
_a$ = -48						; size = 4
tv529 = -44						; size = 4
tv440 = -40						; size = 4
tv351 = -36						; size = 4
tv326 = -32						; size = 4
tv302 = -28						; size = 4
tv544 = -24						; size = 4
_b$ = -20						; size = 4
_c$ = -16						; size = 4
_d$ = -12						; size = 4
_e$ = -8						; size = 4
_f$ = -4						; size = 4
start	PROC

; 4    : {

	push	ebp
	mov	ebp, esp
	sub	esp, 52					; 00000034H
	push	ebx
	push	esi

; 5    : int a,b,c,d,e,f;
; 6    : int n;
; 7    : 
; 8    : for (a=2; a<=9; a++)

	mov	DWORD PTR _a$[ebp], 2
	mov	DWORD PTR tv544[ebp], 222222		; 0003640eH
	push	edi
$LL37@main:

; 9    : for (b=2; b<=9; b++)

	mov	ecx, DWORD PTR _a$[ebp]
	mov	eax, ecx
	imul	eax, ecx
	imul	eax, ecx
	imul	eax, ecx
	imul	eax, ecx
	imul	eax, ecx
	mov	DWORD PTR tv273[ebp], eax
	mov	eax, DWORD PTR tv544[ebp]
	mov	DWORD PTR _b$[ebp], 2
	mov	DWORD PTR tv529[ebp], eax
$LL38@main:

; 10   : for (c=2; c<=9; c++)

	mov	eax, DWORD PTR _b$[ebp]
	mov	esi, eax
	imul	esi, eax
	imul	esi, eax
	imul	esi, eax
	imul	esi, eax
	imul	esi, eax
	mov	eax, DWORD PTR tv529[ebp]
	mov	DWORD PTR _c$[ebp], 2
	mov	DWORD PTR tv440[ebp], eax
$LL39@main:

; 11   : for (d=2; d<=9; d++)

	mov	eax, DWORD PTR _c$[ebp]
	mov	edx, eax
	imul	edx, eax
	imul	edx, eax
	imul	edx, eax
	imul	edx, eax
	imul	edx, eax
	mov	eax, DWORD PTR tv440[ebp]
	mov	DWORD PTR _d$[ebp], 2
	mov	DWORD PTR tv351[ebp], eax
$LL40@main:

; 12   : for (e=2; e<=9; e++)

	mov	eax, DWORD PTR _d$[ebp]
	mov	ecx, eax
	imul	ecx, eax
	imul	ecx, eax
	imul	ecx, eax
	imul	ecx, eax
	imul	ecx, eax
	mov	eax, DWORD PTR tv351[ebp]
	mov	DWORD PTR _e$[ebp], 2
	mov	DWORD PTR tv326[ebp], eax
$LL41@main:

; 13   : for (f=2; f<=9; f++)

	mov	edi, DWORD PTR _e$[ebp]
	mov	eax, edi
	imul	eax, edi
	imul	eax, edi
	imul	eax, edi
	imul	eax, edi
	imul	eax, edi
	mov	edi, DWORD PTR tv326[ebp]
	mov	DWORD PTR _f$[ebp], 2
	mov	DWORD PTR tv302[ebp], edi
$LL4@main:

; 14   : {
; 15   : n = 100000*a + 10000*b + 1000*c + 100*d + 10*e +f;
; 16   : if (a*a*a*a*a*a + b*b*b*b*b*b + c*c*c*c*c*c + d*d*d*d*d*d + e*e*e*e*e*e + f*f*f*f*f*f == n)

	mov	edi, DWORD PTR _f$[ebp]
	mov	ebx, edi
	imul	ebx, edi
	imul	ebx, edi
	imul	ebx, edi
	imul	ebx, edi
	imul	ebx, edi
	add	ebx, DWORD PTR tv273[ebp]
	add	ebx, esi
	add	ebx, edx
	add	ebx, ecx
	add	ebx, eax
	cmp	ebx, DWORD PTR tv302[ebp]
	je	SHORT $LN30@main

; 13   : for (f=2; f<=9; f++)

	inc	DWORD PTR _f$[ebp]
	inc	DWORD PTR tv302[ebp]
	push	9
	pop	edi
	cmp	DWORD PTR _f$[ebp], edi
	jle	SHORT $LL4@main

; 12   : for (e=2; e<=9; e++)

	inc	DWORD PTR _e$[ebp]
	add	DWORD PTR tv326[ebp], 10		; 0000000aH
	cmp	DWORD PTR _e$[ebp], edi
	jle	SHORT $LL41@main

; 11   : for (d=2; d<=9; d++)

	inc	DWORD PTR _d$[ebp]
	add	DWORD PTR tv351[ebp], 100		; 00000064H
	cmp	DWORD PTR _d$[ebp], edi
	jle	$LL40@main

; 10   : for (c=2; c<=9; c++)

	inc	DWORD PTR _c$[ebp]
	add	DWORD PTR tv440[ebp], 1000		; 000003e8H
	cmp	DWORD PTR _c$[ebp], edi
	jle	$LL39@main

; 9    : for (b=2; b<=9; b++)

	inc	DWORD PTR _b$[ebp]
	add	DWORD PTR tv529[ebp], 10000		; 00002710H
	cmp	DWORD PTR _b$[ebp], edi
	jle	$LL38@main

; 5    : int a,b,c,d,e,f;
; 6    : int n;
; 7    : 
; 8    : for (a=2; a<=9; a++)

	add	DWORD PTR tv544[ebp], 100000		; 000186a0H
	inc	DWORD PTR _a$[ebp]
	cmp	DWORD PTR tv544[ebp], 922222		; 000e126eH
	jle	$LL37@main

; 14   : {
; 15   : n = 100000*a + 10000*b + 1000*c + 100*d + 10*e +f;
; 16   : if (a*a*a*a*a*a + b*b*b*b*b*b + c*c*c*c*c*c + d*d*d*d*d*d + e*e*e*e*e*e + f*f*f*f*f*f == n)

	jmp	SHORT $LN17@main
$LN30@main:

; 17   : {
; 18   : printf("se! %i\n", n);

	push	DWORD PTR tv302[ebp]
	push	OFFSET result
	call	printf
	pop	ecx
	pop	ecx

; 19   : getchar();

	call	getchar
$LN17@main:

; 20   : return 0;
; 21   : }
; 22   : }
; 23   : } 

	pop	edi
	pop	esi
	xor	eax, eax
	pop	ebx
	leave
	ret	0
start	ENDP
END
You can compile it with MASM32...
Attached source and (binary size 1KB) clean asm code easy to debug...

External link:
https://www.sendspace.com/file/olce5h
Attached Files
File Type: rar release.rar (1.9 KB, 7 views)
__________________
Computer Forensics
Reply With Quote
 

Tags
source co

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VC++ to VS2010 conversion Zeocrack Source Code 11 10-03-2022 17:03
Firmware Analysis - ZLIB file conversion to Bitmap psgama General Discussion 3 08-02-2021 05:03
Anyone can help interpret the algorithm on the data conversion below(ECC related)? bridgeic General Discussion 1 10-01-2014 17:39


All times are GMT +8. The time now is 16:55.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )