Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Virus competition

406 visualizaciones

Publicado el

Slides for a workshop holded at oSC17: https://events.opensuse.org/conference/oSC17/program/proposal/1326

I will start with a short introduction of RedCore, the assembly-like programming language used in CoreWar. Then some time would be given so everybody can write its virus/warrior. And then we will organise a virus competition! If there is time enough we will organise two rounds, so you will be able to modify your first virus and give it another try.

pMARS will be used, you can download it for openSUSE here: https://build.opensuse.org/package/show/home:ammartinez:branches:games/pmars

Publicado en: Software
  • Sé el primero en comentar

  • Sé el primero en recomendar esto

Virus competition

  1. 1. Ana María Martínez Gómez anamma06@gmail.com Virus competition Write a virus in assembly language
  2. 2. Ana María Martínez Gómez OBS Frontend Engineer http://anamaria.martinezgomez.name
  3. 3. CoreWar
  4. 4. What is CoreWar? Programming game in which two or more programs (warriors or viruses) written in Redcore try to destroy each other in the memory of a simulated computer
  5. 5. Redcode
  6. 6. What is Redcode? Abstract and simplified assembly language
  7. 7. Redcode: instructions ● DAT - kills the process ● MOV - move ● ADD - add ● SUB - subtract ● MUL - multiply ● DIV - divide ● MOD - modulus ● JMP - jump ● JMZ - jump if zero ● JMN - jump if not zero ● DAT - decrement and jump if not zero ● SPL - starts a second process ● CMP/SEQ - skip if equal ● SNE - skip if not equal ● SLT - skip if lower than ● LDP - load from p-space ● STP - save to p-space ● NOP - do nothing
  8. 8. Redcode: The Imp MOV 0, 1 MOV 0, 1 ; this was just executed MOV 0, 1 ; this instruction will be executed next DAT #0, #0
  9. 9. Redcode: The addressing modes # immediate $ direct (omitted) * A-field indirect @ B-field indirect { A-field indirect with predecrement < B-field indirect with predecrement } A-field indirect with postincrement > B-field indirect with postincrement
  10. 10. Redcode: the Dwarf ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0 ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0 ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0 ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0
  11. 11. Redcode: the Dwarf ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0 ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0 ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0 ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0
  12. 12. Redcode: the Dwarf ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0 ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0 ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0 ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #4
  13. 13. Redcode: the Dwarf ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0 ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0 ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0 ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #4 … … … DAT #0, #4
  14. 14. Redcode: the Dwarf ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0 ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0 ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #0 ADD #4, 3 MOV 2, @2 JMP -2 DAT #0, #4 … … … DAT #0, #4
  15. 15. CoreWar: The game
  16. 16. The game ● The core is a continuous array and circular of instructions, empty except for the competing programs ● The programs are randomnly loaded ● There are only relative addresses ● The programs execute alternately, one instruction at a time ● The execution of all instruction takes always one cycle
  17. 17. Processes SPL 0 MOV 0, 1
  18. 18. Processes SPL 0 MOV 0, 1 SPL 0 MOV 0, 11 2
  19. 19. Processes SPL 0 MOV 0, 1 SPL 0 MOV 0, 11 2 SPL 0 MOV 0, 1 MOV 0, 1 2 3 1
  20. 20. Processes ● Program A, process 1 ● Program B ● Program A, process 2 ● Program B ● Program A, process 3 ● Program B ● Program A, process 1
  21. 21. CoreWar: strategies
  22. 22. Strategies: stone/paper/scanner ● Stone: Bomb blindly (the Dwarf) ● Paper: Make multiple copies (SPL) ● Scanner: Search the other/s virus Can be combined
  23. 23. Tips ● Size DOES matter ● Fast and furious ● Split yourself, but be careful ● Resistant to bombing
  24. 24. How a virus look like?
  25. 25. ;redcode ;name ANA VIRUS ;author Ana org start myindex dat $0, $0 start add #1021, myindex mov mydat, >myindex mov bomb, >myindex mov bomb+1, >myindex mov bomb+2, @myindex spl <myindex, <1711 jmp start, <1728 mydat dat $0, #5 bomb mov mydat, >mydat mov mydat, >mydat jmp bomb, >mydat
  26. 26. Software
  27. 27. pMARS ● Core War simulator ● Open source https://build.opensuse.org/package/show/home:ammartinez:branches:games/pmars
  28. 28. References
  29. 29. References ● The beginners' guide to Redcode by Ilmari Karonen http://vyznev.net/corewar/guide.html ● KOTH.org http://www.koth.org/info.html
  30. 30. Time to write your virus!
  31. 31. Join Us at www.opensuse.org
  32. 32. License This slide deck is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license. It can be shared and adapted for any purpose (even commercially) as long as Attribution is given and any derivative work is distributed under the same license. Details can be found at https://creativecommons.org/licenses/by-sa/4.0/ General Disclaimer This document is not to be construed as a promise by any participating organisation to develop, deliver, or market a product. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. openSUSE makes no representations or warranties with respect to the contents of this document, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. The development, release, and timing of features or functionality described for openSUSE products remains at the sole discretion of openSUSE. Further, openSUSE reserves the right to revise this document and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. All openSUSE marks referenced in this presentation are trademarks or registered trademarks of SUSE LLC, in the United States and other countries. All third-party trademarks are the property of their respective owners. Credits Template Richard Brown rbrown@opensuse.org Design & Inspiration openSUSE Design Team http://opensuse.github.io/branding- guidelines/

×