Advertisement
Guest User

bex

a guest
May 6th, 2021
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.42 KB | None | 0 0
  1. # Zoe Phin, 2021/04/24
  2. # https://phzoe.com/?p=1761
  3.  
  4. wget -O- http://flatassembler.net/fasm-1.73.27.tgz | tar zx fasm/fasm
  5.  
  6. echo '          use32
  7.    org         0x505A4000
  8.      
  9.    db          0x7F, "ELF"    
  10.    dd          1                              
  11.    dd          0                              
  12.    dd          $$                              
  13.    dw          2              
  14.    dw          3              
  15.    dd          start          
  16.    dd          start          
  17.    dd          4              
  18.  
  19.    start:      pop     ecx    
  20.                pop     edi
  21.                jmp     .end    
  22.  
  23.    .arg:       pop     esi    
  24.  
  25.        .char:  lodsb
  26.                cmp     al, 0
  27.                jmp     .cont  
  28.  
  29.    dw          32              
  30.    dd          1              
  31.  
  32.        .cont:  je      .done
  33.                rcr     al, 1
  34.                adc     ah, ah
  35.                jmp     .char
  36.  
  37.        .done:  mov     [edi+edx], ah
  38.                inc     edx
  39.                xor     eax,eax
  40.  
  41.    .end:       loop    .arg
  42.                jmp     edi
  43.  
  44. ' > bex.asm; fasm/fasm bex.asm bex; chmod +x bex
  45.  
  46. input="10110000 00000100 01000011 10001001 11111001 11001101 10000000 10010011 11001101 10000000"
  47.  
  48. output=$(./bex $input | xxd -b -c10 | cut -c11-99)
  49.  
  50. echo "Input:  $input"
  51. echo "Output: $output"
  52.  
  53. [[ $input = $output ]] && echo "Match!" || echo "Error: No Match"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement