flat assembler
Message board for the users of flat assembler.

Index > Windows > Making Executable File ?

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
Overflowz



Joined: 03 Sep 2010
Posts: 1046
Overflowz 19 Feb 2011, 10:25
Hello everyone, I have some questions..
I'm trying to make executable file from source code. For example, some program builder. Like only messagebox. This is my idea and I'm stuck on it..
1) Inputbox asking for text string
After OK is pressed then:
2) Create executable file with MessageBox API and shows that text.
How can I do that ? Thank you.
Post 19 Feb 2011, 10:25
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1905
DOS386 19 Feb 2011, 11:29
Overflowz wrote:
I'm trying to make executable file from source code.


1. format PE

or

2. format binary as "EXE"

http://board.flatassembler.net/topic.php?t=11170 GUI with DLL
http://board.flatassembler.net/download.php?id=4878 console
http://board.flatassembler.net/topic.php?t=10873 console

Quote:
For example, some program builder. Like only messagebox. This is my idea and I'm stuck on it..
1) Inputbox asking for text string
After OK is pressed then:
2) Create executable file with MessageBox API and shows that text.
How can I do that ?


Ask for text and then brew the file. Don't forget to care about the "file exists" condition. Learn how to ask for text (painful ???) and how to brew files (see FASM source), then put it together Wink

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 19 Feb 2011, 11:29
View user's profile Send private message Reply with quote
Overflowz



Joined: 03 Sep 2010
Posts: 1046
Overflowz 19 Feb 2011, 14:14
DOS386
Sorry, I don't understand lot from your post.. I can't understand what you're doing on that examples.. Can you tell me some easy way if exists ? Smile
Post 19 Feb 2011, 14:14
View user's profile Send private message Reply with quote
MinhHung



Joined: 10 Sep 2010
Posts: 51
Location: Viet Nam
MinhHung 19 Feb 2011, 22:45
please, read some example at fasm\example.
Post 19 Feb 2011, 22:45
View user's profile Send private message Yahoo Messenger Reply with quote
MinhHung



Joined: 10 Sep 2010
Posts: 51
Location: Viet Nam
MinhHung 19 Feb 2011, 22:50
aha. did you mean you have 2 executable file. enter text in file 1 and out at file 2
Post 19 Feb 2011, 22:50
View user's profile Send private message Yahoo Messenger Reply with quote
Overflowz



Joined: 03 Sep 2010
Posts: 1046
Overflowz 19 Feb 2011, 23:21
I'm trying to make stub. Then write there some data and it should show me MessageBox API with that text.
Post 19 Feb 2011, 23:21
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 20 Feb 2011, 16:49
Dou you mean this:


Ask for user string: example (MessageBox)

Translate the input into widows API (check if a function with that name exists)

if so, execute the corresponding function (MessageBox in this case)


Code:
format PE GUI 4.0

include 'win32ax.inc'
include 'api/user32.inc'
include 'api/kernel32.inc'

section '.txt' code readable executable

;Get instance handle to this image and call the dialog box procedure

push ..
...
call [DialogBoxParam]

push eax
call [ExitProcess]

proc DialogProcedure

      save pointers etc here

    ; check for commands
    OK button pressed
    local functionString:TCHAR
   invoke GetDlgItemText,[dlg],IDC_TEXT,addr functionString
   push functionString
   call   lstrlen
   inc   eax
   mov byte[functionString+eax],0 ;<---- terminate string.... Not sure if windows does that automatically.

    invoke strcmp,dictionary_function_array_ptr,functionString

   cmp eax,0
   je     .buildExe

.buildExe:

     ; assuming you have IMAGE_NT_XXX and the like for building exes' in   your data section. You then use them here
      
    execution pointer points to the function selected by user.
    
    You can use CreateFile, ReadFile, WriteFile,
  
     

      pop saved ptrs and return
ret
    



Is the code flow example that I just gave above what you wanted to do ? If it's clear at all Very Happy Rolling Eyes
Post 20 Feb 2011, 16:49
View user's profile Send private message Reply with quote
Overflowz



Joined: 03 Sep 2010
Posts: 1046
Overflowz 20 Feb 2011, 17:05
typedef
No no mate Smile) I'll try to explain easy. (Sorry for my English !)
1) Program asks user to type something.
2) User typed Hello
3) Program created another binary file.
4) When opening another binary file, it should do messagebox with Hello string.
Maybe I should show you what I'm trying to do. I've write simple downloader that downloads files from web. Instead of stub, I did really weird thing.. (I'm not gonna write trojans or kiddy things like that..)
Here's my source and you'll understand what I mean. Smile BTW this code works what I've done but I think there must be more easy way to do this..
P.S I'm not of kind person who writes trojans keyloggers or whatever.. It was difficult idea for me and tried to make one. Please, don't judge me with that reason. Thank you!

Removed source for some security reasons.


Last edited by Overflowz on 22 Feb 2011, 12:49; edited 1 time in total
Post 20 Feb 2011, 17:05
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 20 Feb 2011, 17:11
Post 20 Feb 2011, 17:11
View user's profile Send private message Reply with quote
Overflowz



Joined: 03 Sep 2010
Posts: 1046
Overflowz 20 Feb 2011, 17:14
typedef
I'm sorry mate, I don't understand C/C++ or any other languages Sad
Post 20 Feb 2011, 17:14
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 20 Feb 2011, 17:17
Nevermind I get it now Very Happy
Post 20 Feb 2011, 17:17
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 20 Feb 2011, 17:21
Post 20 Feb 2011, 17:21
View user's profile Send private message Reply with quote
Overflowz



Joined: 03 Sep 2010
Posts: 1046
Overflowz 20 Feb 2011, 17:25
typedef
Hmm.. Looks interesting.. Thank you for help! But I guess this is injection only hehe Smile
Post 20 Feb 2011, 17:25
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 20 Feb 2011, 17:29
Nice proggy..Looks like a trojan to me...No offense... I could actually make it into one. Very Happy..... Make it a thread that multiplies every 30 Mins.

Like a human cell.... Very Happy

Nice though...Good job
Post 20 Feb 2011, 17:29
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 20 Feb 2011, 17:34
SOrry one question though. How were you able to read the file from the net. Which API did you use ? Is it the
Code:
stub db xx,xx,xx,xx    


Did you obfusticate it or you used another way ? Very Happy
Post 20 Feb 2011, 17:34
View user's profile Send private message Reply with quote
Overflowz



Joined: 03 Sep 2010
Posts: 1046
Overflowz 20 Feb 2011, 17:34
typedef
Yes, it looks like trojan but it was only job for me. It was very hard for me. Wrote in like 9-10 hours Sad But anyway I did it! My goals was:
1) Make stub.
2) Modify stub with input data.
3) Create executable file
4) Write modified stub
The only function that makes this program not trojan is Execute after download hehe (: and I'm not gonna write that. It was just excercise for me. Thanks for reply!
Regards.
Post 20 Feb 2011, 17:34
View user's profile Send private message Reply with quote
Overflowz



Joined: 03 Sep 2010
Posts: 1046
Overflowz 20 Feb 2011, 17:36
I used another way, used tool called "Multi-Format Shellcode Encoding Tool"
Lol still stuck about binary things Sad(
Post 20 Feb 2011, 17:36
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 20 Feb 2011, 17:48
Hey, good productive thought. You can extend your program into a thread so it lurks around your PC download important files for you from the Net....

You can make your own encryption engine. ( Useful when DLoading sensitive data, and also assuming you have your own server. )

Just a thought. See I like to do all those kinds of stuff on my PC... Keyloggers, tell me who was on my PC (I use system wide hooks)....

I was recently trying to make a Kernel mode driver to let me know when a program is about to exectute and ask me if I want to approve it or not. But I'm a slacker when it comes to completing projects... LOL
Post 20 Feb 2011, 17:48
View user's profile Send private message Reply with quote
Overflowz



Joined: 03 Sep 2010
Posts: 1046
Overflowz 20 Feb 2011, 17:58
typedef
off topic:
Hehe really nice. I'm doing things like that too. I love when someone sends me keylogger, after that I'm using sniffer so, I know which name/pass it used to connect on server and their server is mine lol. after that deleting everything there and changing password for good reasons.. Smile I'm not so prof to write kernel mode things cause I don't understand a lot. I'm just starter hehe Smile learning ASM since Sep, 01, 2010 and I'm on right way now ))
can I contact you on some IRC server ? if you can help me with just some little things.. Smile
Post 20 Feb 2011, 17:58
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 03 Oct 2011, 22:21
bump...lol Very Happy
Post 03 Oct 2011, 22:21
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.