assembly

Help me understand this JavaScript exploit

I usually do not have difficulty to read JavaScript script but this one I can't figure out the logic. The code is from an Exploit that has been published 4 days ago. You can find it at milw0rm. Here is the code: <html> <div id="replace">x</div> <script> // windows/exec - 148 bytes // http://www.metasploit.com ...

calling code stored in the heap from vc++

Imagine I am doing something like this: void *p = malloc (1000); *((char*)p) = some_opcode; *((char*)p+1) = another_opcode; // for the sake of the example: the opcodes are ok .... etc... How can I define a function pointer to call p as if it was a function? (i'm using VC++ 2008 express). Thanks ...

Splitting a string on AT&T IA-32 Linux Assembler (gas)

.section .data astring: .asciz "11010101" format: .asciz "%d\n" .section .text .globl _start _start: xorl %ecx, %ecx movb astring(%ecx,1), %al movzbl %al, %eax pushl %eax pushl $format call printf addl $8, %esp movl $1, %eax movl $0, %ebx int $0x80 Suppose I wanna break the .asciz string 1101011 and get it's first one. How do I...

creating a substring on Linux IA-32 assembler (gas)

I wanna create a substring (ministring) of 3 asciz chars out of my original (thestring). The thing ain't printing when being run so I don't know what the hell I'm I doing. Why it ain't printing? Am I creating the ministring correctly? .section .data thestring: .asciz "111010101" ministring: .asciz "" formatd: .asciz "%d" formats:...

Why do we teach assembly language programming?

Is assembly language programming taught just for the sake of history ? Do compilers generate better assembly code than the one written by a novice programmer? DEFINE better -> from the point of the execution time of the assembly program ...

ASM print over allready printed values

I have an ASM script that displays date(day, month, year) and time(hours, minutes, seconds). This prints the current datetime on the DOS-box. Thing is, it's static. What I want to do is make it dynamic, meaning I have to write the new value in the exact place where the current value is standing on the screen. How do you do this in ASM? ...

What is the best resource for learning (N)ASM?

I've been wanting to learn assembly for a while now, and although I've tried a few times before, I haven't really been able to get past "Hello, world". Are there any good introductory tutorials to assembly (preferably using NASM, as I use Windows and Linux)? I do have a bit of C knowledge, but mainly code in higher-level languages such a...

What are the practical advantages of learning Assembly?

Most people suggest that learning assembly is essential, its important to know the underlying workings of the computer, and so forth. But what I'm looking for are some practical suggestions that will make the effort of learning Assembly to be worth it. What are your suggestions? What am I missing out on by not learning Assembly and poin...

LLVM vs GCC MIPS code generation, any benchmarks?

I'm interested in knowing what is "best" free/OSS compiler for MIPS code, GCC or LLVM, or is there anything even better than those? I'm interested in knowing more about fast and memory constrained generated Assembly code than code size. In other words, does llvm-opt do the job better than gcc -O3? ...

Exactly how "fast" are modern CPUs?

When I used to program embedded systems and early 8/16-bit PCs (6502, 68K, 8086) I had a pretty good handle on exacly how long (in nanoseconds or microseconds) each instruction took to execute. Depending on family, one (or four) cycles equated to one "memory fetch", and without caches to worry about, you could guess timings based on the ...

What is the fastest virtual machine design for x86?

I will implement a virtual machine in x86 and I wonder what kind of design would yield best results. What should I concentrate on to squish out the juice? I will to implement the whole virtual machine in x86 assembly. I haven't much instructions and I can choose their form. The instructions project directly into smalltalk's syntax in bl...

Emulated ARM assembler environment?

I would like my son to learn ARM assembler, and I'm considering buying him an embedded system that he can program so he can make LEDs flash and other cool stuff that I got a kick out of as a kid. Are there any emulated or virtual "workbenches" that offer this type of programming environment on the PC without using actual hardware? I'm ke...

Is SQL the assembly for databases?

Talking about hibernate and others ORMs, the ORMs evangelists talk about SQL like the assembly language for Databases. I think is soon to assert this, but I guess can be true on a near future, not sure. UPDATE: The analogy I was referring means SQL is to assembly what ORM is to C/Java/C#. Of course, an exact analogy is not possible. Th...

Interpreting assembly code

Any assembly interpreters out there? What I'm looking for: I have some assembly firmware code I want to run, but not on the actual hardware. I would like to run the code and see what it is doing. So, is there some sort of free and easy to use assembly simulator out there? Any other pointers you can think of? ...

how to count the number of digits assembly code ?

assume that i have a program written in assembly language which takes an input sentence from the user ( combination of digits and letters) and on the next line will display the number of small letters in the sentence. Also display the number of digits in the sentence. my question is: how i can make the count instruction to count the nu...

Writing firmware: assembly or high level?

Related to: Testing firmware starting a microcontroller simulator/emulator Interpreting assembly code If you are writing code for a microcontroller is there a real difference if you write in assembly or C or some other high level language? If you wrote C code, how would you compile it? Thanks ...

What should I know when switching from MIPS to x86 assembly?

At school we have been programming in MIPS assembly language for some time. I'm interested into delving into x86 assembly and I have heard that is somewhat harder (even my MIPS textbook says this). What core information should I know as a MIPS programmer before making the dive into the x86 world? ...

Helping understanding RedCode

I'm trying to learn redcode, because it looks fun to make a warrior. Introduction For those who don't know what redcode is, here's a short explenation. It's an ASM-like language, but far more easy an stripped. It is used to write little programs that need to shut down other programs in a virtual memory. (See for more info here: http://...

How can I program MIPS assembly from x86 linux?

Are there any command line interpreters around for x86 linux inorder to run MIPS assembly programs? I'd like to be able to write simple MIPS assembly programs and run them from the console on my local machine. I know of SPIM but it requires X Windows and I'm curious if there are better options out there. Edit: Turns out it doesn't req...

Assembly code vs Machine code vs Object code?

What is the difference between object code, machine code and assembly code? Can you give a visual example of their difference? ...