Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (0)

Powered by Vanilla. Made with Bootstrap.
Simple Input/Output [ASM]
  • Sh3llc0d3
    Posts: 1,910
    Another simple example of one particular syntax in ASM, for anyone who wants to try asm on windows this will NOT work for you, neither will any of my other programs.

    # Hello_iexploit_gretting.s
    # Semtex-Primed
    .section .data # initialised data
    welcome:
    .ascii \"Hello iExploit\n\"
    welcome_end:
    greeting:
    .ascii \"Welcome \"
    greeting_end:
    gtfo:
    .ascii \"now GTFO my pc!\n\"
    gtfo_end:
    ### LENGTHS OF VAR's ###
    .equ greeting_len, greeting_end - greeting
    .equ welcome_len, welcome_end - welcome
    .equ gtfo_len, gtfo_end - gtfo
    ### SYSCALLS ###
    .equ STDOUT, 1
    .equ STDIN, 2
    .equ EXIT, 1
    .equ READ, 3
    .equ WRITE, 4
    .equ SYSCALL, 0x80
    .section .bss # uninitialised data
    .lcomm BUFF,100
    .section .text
    .globl _start #declaring program starts at '_start'
    ##program starts
    _start:
    # output welcome msg
    movl $STDOUT, %ebx
    movl $welcome, %ecx
    movl $welcome_len, %edx
    movl $WRITE, %eax
    int $SYSCALL

    # read into buffer
    movl $READ, %eax
    movl $STDIN, %ebx
    movl $BUFF, %ecx
    int $SYSCALL

    # output greeting
    movl $STDOUT, %ebx
    movl $greeting, %ecx
    movl $greeting_len, %edx
    movl $WRITE, %eax
    int $SYSCALL

    # output contents of buffer to same line
    movl $STDOUT, %ebx
    movl $BUFF, %ecx
    movl $WRITE, %eax
    int $SYSCALL

    # gtfo output
    movl $STDOUT, %ebx
    movl $gtfo, %ecx
    movl $gtfo_len, %edx
    movl $WRITE, %eax
    int $SYSCALL

    # program exit.
    movl $0, %ebx
    movl $EXIT, %eax
    int $SYSCALL


    [spoiler=screenshot]http://i.imgur.com/B7lHQ.png[/spoiler]

    Few issues with the program however it does a basic job of showing input and output using pure ASM instead of borrowed/shared libs.
  • Xin
    Posts: 3,251
    Nice, still dont understand unfortunately haha, also i thought you were a mint guy?
    Xin
  • Sh3llc0d3
    Posts: 1,910
    I was but I picked up the new ubuntu 10.10 and just haven't been bothered to check out the latest mint. I probably will upgrade to another distro if I can sort out the acpi driver to work with my laptop.

    RE: not understanding - probably best for you to check out intel x86 assembler or NASM (netwide assembler), plenty of documentation etc online. The syntax I'm learning has very little documentation however I find it a lot easier. Everyone else complains it doesn't make sense.
  • Xin
    Posts: 3,251
    said:


    I was but I picked up the new ubuntu 10.10 and just haven't been bothered to check out the latest mint. I probably will upgrade to another distro if I can sort out the acpi driver to work with my laptop.



    Cool, are you dual booting?
    Xin
  • Sh3llc0d3
    Posts: 1,910
    said:


    said:


    I was but I picked up the new ubuntu 10.10 and just haven't been bothered to check out the latest mint. I probably will upgrade to another distro if I can sort out the acpi driver to work with my laptop.



    Cool, are you dual booting?


    Yeah for the moment, I did want to do a full switchover to *nix but the course I want in on does C# first year and I haven't tried out the *nix alternatives to VS2010 (which I use at the moment for .Net coding).