Devilzc0de Forum Follow @devilzc0de
  • Home
  • Hacking
  • Networking
  • Programming
  • O.S
  • Server
  • Tweets
  • Search
  • Member List
  • Calendar
Current time: 05-24-2013, 06:56 PM Hello There, Guest! (Login — Register)
Devilzc0de Forum › Information Technology › Programming › Assembly v
1 2 3 Next »

kodingan iseng-iseng

Home General Computer Multimedia Business Lounge

Post Reply 
Tweet
Threaded Mode | Linear Mode
kodingan iseng-iseng
07-12-2012, 11:34 AM (This post was last modified: 07-12-2012 11:35 AM by syn_attack.)
Post: #1
syn_attack Away
execl("/bin/sh", "sh", NULL);
**
Moderators
Posts: 306
Joined: Sep 2011
Reputation: 55
kodingan iseng-iseng
aku iseng-iseng praktekin algoritma "insertion sort" di assembly... lebih detail tentang algoritmanya bisa dilihat di sini kak....

http://en.wikipedia.org/wiki/Insertion_sort

kita langsung ke kode programnya aja ya kak....


# sort.S - "Insertion Sort" Algorithm
#
# Programmer : Paulus Gandung Prakosa
#
# Contact me on :
# --> syn-attack@devilzc0de.org
# --> syn1988@sdf.lonestar.org
#
# How to compile :
# --> as -o sort.o sort.S
# --> ld -dynamic-linker /lib/ld-linux.so.2 -lc -o sort sort.o

# this data section defined as read-only, cannot modify it...
.section .rodata

.globl array_length
array_length:
.int 10
.size array_length, 4

.globl stack_align_8bits
stack_align_8bits:
.int 8
.size stack_align_8bits, 4

.globl stack_align_4bits
stack_align_4bits:
.int 4
.size stack_align_4bits, 4

# do anything with this data section (read, overwrite, other)...
.section .data

cval_array:
.int 105, 235, 61, 315, 134, 221, 53, 145, 117, 5

str_before:
.asciz "Before sorting : "

str_after:
.asciz "After sorting : "

each_num:
.asciz "%d "

print_trailing_linebreak:
.asciz "\n"

.section .text
.globl _start
_start:
xorl %ebx, %ebx
xorl %edi, %edi
movl $cval_array, %esi

pushl $str_before
call printf
# clear up the stack
addl stack_align_4bits, %esp

print_before_sorted:
movl cval_array(, %edi, 4), %eax
pushl %eax
pushl $each_num
call printf
# clear up the stack
addl stack_align_8bits, %esp
inc %edi
cmpl array_length, %edi
jne print_before_sorted

pushl $print_trailing_linebreak
call printf
# clear up the stack
addl stack_align_4bits, %esp

# make "%eax" register empty
xorl %eax, %eax
# make "%edi" register empty
xorl %edi, %edi

# for memory address backup
movl %esi, %edi

outer_loop:
nop
inc %ebx
cmpl array_length, %ebx
je safe_checkpoint
imull stack_align_4bits, %ebx
addl %ebx, %esi
sar $2, %ebx

inner_loop:
nop
movl (%esi), %eax
cmpl %eax, -4(%esi)
jge swap_val
sub stack_align_4bits, %esi
cmpl %edi, %esi
jne inner_loop
je outer_loop

swap_val:
xchg %eax, -4(%esi)
movl %eax, (%esi)
sub stack_align_4bits, %esi
cmpl %edi, %esi
jne inner_loop
je outer_loop

safe_checkpoint:
pushl $str_after
call printf
# clear up the stack
addl stack_align_4bits, %esp

xorl %edi, %edi

print_after_sorted:
movl (%esi), %eax
pushl %eax
pushl $each_num
call printf
# clear up the stack
addl stack_align_8bits, %esp
addl stack_align_4bits, %esi
inc %edi
cmpl array_length, %edi
jne print_after_sorted

pushl $print_trailing_linebreak
call printf
# clear up the stack
addl stack_align_4bits, %esp

push_back_esi_to_head:
subl stack_align_4bits, %esi
dec %edi
cmpl $0, %edi
jne push_back_esi_to_head

# zero up "%edi"
xorl %edi, %edi

xorl %ecx, %ecx
xorl %edx, %edx

# exit....
xorl %eax, %eax
xorl %ebx, %ebx
movl $1, %eax
movl $0, %ebx
int $0x80


cara kompilenya gini kak

as -o sort.o sort.S
ld -dynamic-linker /lib/ld-linux.so.2 -lc -o sort sort.o

kalau programnya dijalankan, ini dia hasilnya kakak....

[Image: geek2.png]


^_^
Visit this user's website Find all posts by this user
Quote this message in a reply
 Reputed by :  CitooZz(+1)
07-13-2012, 09:59 AM
Post: #2
putri sitasari Offline
cewek cantik calon presiden
Posts: 100
Joined: Jan 2011
Reputation: 6
RE: kodingan iseng-iseng
sundul aja deh pu3 blom bisa ksh rep (+)
Find all posts by this user
Quote this message in a reply
07-13-2012, 10:17 AM
Post: #3
CitooZz Online
./pemburu kimblak
**
Moderators
Posts: 1,299
Joined: Jun 2011
Reputation: 22
RE: kodingan iseng-iseng
iseng-isengny aja kyk gini lemes
Find all posts by this user
Quote this message in a reply
10-06-2012, 12:14 AM
Post: #4
1st_N3iCs Offline
./Devilz Officer
Posts: 147
Joined: Jan 2012
Reputation: 3
RE: kodingan iseng-iseng
itu program compilernya apa ? Geany yah,,,
ane butuh inpoh nih.. buat belajar kayak ente sync-attack...
Visit this user's website Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


Topic Tools
Topic Link :
BBCode :
HTML Code :
View a Printable Version Send Thread to a Friend Subscribe to this thread
Submit Google Submit Face book Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
Tongue [Tutor] Iseng with Assembly nyiurmelambai 12 1,127 01-17-2012 05:30 PM
Last Post: darkdante
  getpriv.s kodingan iseng2 ev1lut10n 1 283 01-14-2012 09:16 AM
Last Post: chaer.newbie

Users Browsing
1 Guest(s)

  • Contact Us
  • devilzc0de
  • Return to Top
  • Mobile Version
  • RSS Syndication
  • Help
Current time: 05-24-2013, 06:56 PM Powered By MyBB, © 2002-2013 MyBB Group. Theme created by Justin S. | Mixed By Chaer.Newbie | Fixed By Aditya

USING THIS SITE INDICATES THAT YOU HAVE READ AND ACCEPT OUR TERMS. IF YOU DO NOT ACCEPT THESE TERMS, YOU ARE NOT AUTHORIZED TO USE THIS SITE