News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Beginner question - would this work on any CPU?

Started by securityaudit, June 18, 2018, 09:44:30 PM

Previous topic - Next topic

Caché GB

Caché GB's 1 and 0-nly language:MASM

jj2007

Folks, be kind to a newbie. Those who come here to get advice on malware (and we have them regularly) behave differently.

Quote from: securityaudit on June 18, 2018, 09:44:30 PMI have spent a few years coding in C and Java ... I have never coded anything advanced.

Quote from: securityaudit on June 19, 2018, 05:31:35 AM
Don't worry I will not post on here asking for help related to it, if you have any doubts I invite you to contact me privately and you can look at my LinkedIn (I work for a multinational that does security audit).

felipe

Ok, how about the "simple" example program that comes with the masm32 package as a welcome:

; #########################################################################

      .386
      .model flat, stdcall
      option casemap :none   ; case sensitive

; #########################################################################

      include \masm32\include\windows.inc
      include \masm32\include\user32.inc
      include \masm32\include\kernel32.inc

      includelib \masm32\lib\user32.lib
      includelib \masm32\lib\kernel32.lib

; #########################################################################

    .code

start:

    jmp @F
      szDlgTitle    db "Minimum MASM",0
      szMsg         db "  --- Assembler Pure and Simple ---  ",0
    @@:

    push MB_OK
    push offset szDlgTitle
    push offset szMsg
    push 0
    call MessageBox

    push 0
    call ExitProcess

    ; --------------------------------------------------------
    ; The following are the same function calls using MASM
    ; "invoke" syntax. It is clearer code, it is type checked
    ; against a function prototype and it is less error prone.
    ; --------------------------------------------------------

    ; invoke MessageBox,0,ADDR szMsg,ADDR szDlgTitle,MB_OK
    ; invoke ExitProcess,0

end start


It would be a good exercise to you (maybe) to compare this message box code with a "c" message box code.  :idea:

Raistlin

@jj2007: OK, I'll try to be nice - let's see where it leads....

QuoteMy question: provided I do not want to do something too crazy or obscure, will programs I create work on every CPU?
My focus is on your average computer at home or perhaps servers. Not anything super obscure that mad scientists have in their labs (sorry to exaggerate).

It is possible (proven) that a program/application can seek compatibility on an entire family of CPUs.
It's a simple idea, but NON-TRIVIAL to implement.

Part of a thesis I wrote did it this way (but there are other ways):
STEP 1) Seek instruction set compatibility across CPU architectures (ex. Intel & AMD from x86 to x64).
STEP 2) Seek API compatibility across OS families (ex. Windows XP/Server2003 to Windows 10/Server 2016 and everything in-between).
STEP 3) Use FAT executables to target optimization or unique features of a particular combined (instruction/API) platform.
Are you pondering what I'm pondering? It's time to take over the world ! - let's use ASSEMBLY...

hutch--

securityaudit,

We in fact have good reason to be heavy handed on illegal stuff, trojans, viruses and the likes, many people who are members write professional level code and simply cannot be associated with the type of junk that the idiot fringe play with. There is another factor, as I provide the forum, if any chyte hits the fan, I am the once who cops it so if anyone ever posts dangerous illegal stuff, I will help the CIA, FBI, MOSSAD, MI5, MI6, KGB etc .... track them down, put them in jail and whatever else they do to pests.

On the motivational end, cracking and similar are a junky subset of what you can do as it is looking for techniques to break existing code where programming in assembler is where you make clever things that are fast and powerful. I have been around for a long time and a common factor with almost all crackers is that they are PHUKING lazy and have not bothered to properly learn how assembler code works at the binary level.

Disassemblers are useful things as it lets you see code you have written clearly and a knowledge of how opcodes work helps you understand how and why high quality software works and in security terms, when you know enough about true low level code you will also understand the tricks that many of these morons try and play.

Take the path of doing clever things that are fast and powerful and you will get something for your efforts, go the other way and you piss it against the wall.

securityaudit

Everyone

Aside from the mild trolling/cyber bullying I really appreciate the help and think I have what I need.

I apologise again for breaking any rules I was unaware of (no excuses for not reading the rules) but cannot stress this enough - despite only touching Asm once during my degree (which I have since forgotten) I work in my company's attack team. My job mostly involves pen testing websites. However, I have a decent knowledge of C and with all the time I have spent coding entire projects using just the WinAPI I have been given some research projects, but have never needed Asm.

When I said I have coded nothing advanced it was probably incorrect as I am the most competent out of everyone I know at work and any educational place I have been.

Respectfully speaking I think some people on here are fairly old, the education system has changed significantly since your time. I wish I had the opportunity to learn Asm at university, but instead I got branded with Java...

EDIT: It might be worth locking this thread in a few days since hutch-- makes a good point, although if I wanted to do anything shady i would ask elsewhere (there are numerous forums where this conversation is allowed).

hutch--

 :P

We can generally accommodate the enthusiasm of youth but someone with 5 posts and very little knowledge of assembler is not really in a position to tell people here what to do. If this topic ever needs to be closed, it will be but not at your request. You are right about the age of at least some members but the accumulated knowledge of people here runs into the many hundreds of years and very little ever gets past us.

You are certainly welcome here and there many here who can help you along the way but get used to the idea that to be able to write decent assembler code takes a fair bit of bump and grind to get there.

GoneFishing

I hope that now  when OP has really strong motivation to become an evil-doer he'll not use his pen testing skills on this site  :biggrin:

aw27

Quote
Respectfully speaking I think some people on here are fairly old, the education system has changed significantly since your time.

My impression is that your computer science knowledge is a total confusion and you are probably in a wrong career.
(The educational system has indeed changed a lot, I am well aware of that because I do occasional tutoring in a well known site - I don't do more of it because it does not pay off for the time - most tutors are from India and East European countries and work for peanuts.)