Saturday, May 3, 2014

What is AMF3?


AMF3 (Action Message Format, version 3) is a binary protocol developed by Adobe Systems. It is primarily used for remote procedure calls by Flash/Flex applications. (i.e. communicating with a web server)

A primary goal in the design of AMF3 is that transmitted data be as small as possible. (Just look at U29 integers) 

Reading binary AMF3 data in hex string format manually presents a challenged because it looks compressed.

[to be continued. . .]

Efficient looping in Python

Nested loop:
for elem in names:
  for elem2 in names:
    for elem3 in names:
      name = elem+elem2+elem3

 
Using itertools:
for elem, elem2, elem3 in itertools.product(names, repeat=3)
 name = elem+elem2+elem3

Friday, April 4, 2014

Loops in Assembly

There are 3 types of loops in most programming languages:

1. for loop
2. while loop
3. do-while loop

For loop looks something like this:
(JS example)

for (var x=0;x<10;x++){
 doSomething();
}

While loop:

while (x<10) {
  doSomething();
  x += 2;
}


 Do-while loop:
do{
  doSomething();
  x += 3; 
} while (x<10); 

So how do we construct the loops in assembly?
Well, assembly relies on branches (jumps).
Essentially to "loop" the CPU jumps back to a specific instruction and resume running from that point again.

Following are examples of how to construct a loop in assembly:
For loop:

push ecx
mov ecx, 0x00000000
->
//doSomething()
inc ecx
cmp ecx, 0x0000000a
jl short ->
pop ecx

While loop:

push ecx
jmp short =>
->
//doSomething()
add ecx, 0x00000002
=>
cmp ecx, 0x0000000a
jl short ->
pop ecx

Do-while loop:

push ecx
->
//doSomething()
add ecx, 0x00000003
cmp ecx, 0x0000000a
jl short ->
pop ecx

Please remember stack balance. . . STACK BALANCE!!!!!! 

Ready for Easter

[placeholder for an Easter surprise]
heheheh. . .

Oh dear I seem not to be working on my Flash Engine anymore. . . :(

Friday, February 7, 2014

Globeriz's BS Talk (2)

There are attributes that some people covet but they are never able to acquire in their life, whereas for others they are inborn.

Is it something I should work towards in my life? Or am I pursuing a chimera asininely?

I abhor myself for having an idiosyncratic benchmark of fortune.

Life is for enjoying not for suffering.

Saturday, January 25, 2014

Flash Engine - Update (2)

Update:
Displays the instruction size of push commands
Working raw hex assembly (single-line)
Fixed alignment bugs in obtaining addresses (for constant pool)
Attempts to resolve some operations on push stack
Added number of unique variables as result
Obtain corresponding bytecode from selected instruction (double-click)

Scan/disassemble speed:
(from picture) 24260 entries at 55.79seconds
=> 434.8 entries/s

Todo:
resolve multi-line push stack operations

Friday, January 24, 2014

Flash Engine - Update (1)

Added:
Actually scans memory of Flash plugin(FireFox only)
Scans for constant pool and resolve to variable names
Scans for push instructions and resolve to variable names using result from constant pool

Todo:
Single-line push instruction assembling