Skip to main content

Posts

Showing posts from August, 2019

receives 5 numbers, and prints them back in reverse order assembly yasm/nasm/fasm

This program receives 5 numbers, and prints them back in reverse order. yasm - BITS 32 global main extern exit section .data     ; 5 dwords:     keep_nums  times 5  dd (12345678h)     section .text main:     mov ecx, 5   read_one_number:     dec     ecx     call    read_hex     mov     esi,ecx     ; Calculate the address of dword number ecx:     shl     esi,2 ; multiply by 4. Every dword is 4 bytes!     add     esi,keep_nums     ; Store the number inside dword number ecx:     mov     dword [esi],eax     test    ecx,ecx     jnz     read_one_number     mov     edi,5     mov     ecx,0 ; Now we print all the numbers, in reverse order: print_one_number:     mov     esi,ecx     ; Calculate the address of dword number ecx:     shl     esi,2     add     esi,keep_nums     ; Read from dword number ecx:     mov     eax,dword [esi]     call    print_eax     inc     ecx     cmp     ecx,edi     jnz     print_one_number            push    0     ca

dup (nasm) alternative times for yasm

 yasm ------- BITS 32 global main extern exit %include    'training.s'   ;=========================================== section .data     ; 5 dwords:      keep_nums  times 5  dd (12345678h)     section .text main:     mov ecx, 5   read_one_number:     dec     ecx     call    read_hex     mov     esi,ecx     ; Calculate the address of dword number ecx:     shl     esi,2 ; multiply by 4. Every dword is 4 bytes!     add     esi,keep_nums     ; Store the number inside dword number ecx:     mov     dword [esi],eax     test    ecx,ecx     jnz     read_one_number     mov     edi,5     mov     ecx,0 ; Now we print all the numbers, in reverse order: print_one_number:     mov     esi,ecx     ; Calculate the address of dword number ecx:     shl     esi,2     add     esi,keep_nums     ; Read from dword number ecx:     mov     eax,dword [esi]     call    print_eax     inc     ecx     cmp     ecx,edi     jnz     print_one_number       

difference between att and intel (gdb)

AT&T immediate operands use a $ to denote them, whereas Intel immediate operands are undelimited. Thus, when referencing the decimal value 4 in AT&T syntax, you would use dollar 4, and in Intel syntax you would just use 4. AT&T prefaces register names with a %, while Intel does not. Thus, referencing the EAX register in AT&T syntax, you would use %eax. AT&T syntax uses the opposite order for source and destination operands. To move the decimal value 4 to the EAX register, AT&T syntax would be movl $4, %eax, whereas for Intel it would be mov eax, 4. AT&T syntax uses a separate character at the end of mnemonics to reference the data size used in the operation, whereas in Intel syntax the size is declared as a separate operand. The AT&T instruction movl $test, %eax is equivalent to mov eax, dword ptr test in Intel syntax. Long calls and jumps use a different syntax to define the segment and offset val original assembly  BITS 32 %include    'traini

Traceback (most recent call last):File "yt.py", line 73, in threader.put(Subscribe,[credentials[0],credentials[1],yt_id])File "/root/Documents/youtubebot/YouTubeShop-master/lib/multi.py", line 43, in putfor _ in xrange(self.q.qsize()): self.__t()NameError: name 'xrange' is not defined

Traceback (most recent call last):File "yt.py", line 73, in <module>threader.put(Subscribe,[credentials[0],credentials[1],yt_id])File "/root/Documents/youtubebot/YouTubeShop-master/lib/multi.py", line 43, in putfor _ in xrange(self.q.qsize()): self.__t()NameError: name 'xrange' is not defined $ pip install requests $ pip install colorama