login.json 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. {
  2. devices:[
  3. {
  4. id:"Alice",
  5. ports:1,
  6. x:0.5,
  7. y:0.1,
  8. script: {onPacketReceived:function(device, packet) {
  9. doPacketAnimation("Alice", "Router 1", {network:{srcip:"Alice",dstip:"Carol"}});
  10. }}
  11. },
  12. {
  13. id:"Bob",
  14. image:"iphone-1",
  15. ports:1,
  16. x:0.15,
  17. y:0.75,
  18. script: {onPacketReceived:function(device,packet) {
  19. doPacketAnimation("Bob", "Router 2", {network:{srcip:"Bob",dstip:"Alice"}});
  20. }}
  21. },
  22. {
  23. id:"Carol",
  24. image:"monitor",
  25. ports:1,
  26. x:0.85,
  27. y:0.75,
  28. script: {onPacketReceived:function(device,packet) {
  29. doPacketAnimation("Carol", "Router 3", {network:{srcip:"Carol",dstip:"Bob"}});
  30. }}
  31. },
  32. {
  33. id:"Router 1",
  34. ports:3,
  35. x:0.5,
  36. y:0.4,
  37. image:"server",
  38. script: deviceScripts.manualRouter,
  39. rules:[
  40. {dstip:"Alice", portNum:0},
  41. {dstip:"Bob", portNum:1},
  42. {dstip:"Carol", portNum:2}
  43. ]
  44. },
  45. {
  46. id:"Router 2",
  47. ports:3,
  48. x:0.35,
  49. y:0.6,
  50. image:"server",
  51. script: deviceScripts.manualRouter,
  52. rules:[
  53. {dstip:"Bob", portNum:0},
  54. {dstip:"Alice", portNum:1},
  55. {dstip:"Carol", portNum:2}
  56. ]
  57. },
  58. {
  59. id:"Router 3",
  60. ports:3,
  61. x:0.65,
  62. y:0.6,
  63. image:"server",
  64. script: deviceScripts.manualRouter,
  65. rules:[
  66. {dstip:"Carol", portNum:0},
  67. {dstip:"Alice", portNum:1},
  68. {dstip:"Bob", portNum:2}
  69. ]
  70. }
  71. ],
  72. links:[
  73. {
  74. src:"Alice", srcport:0,
  75. dst:"Router 1", dstport:0
  76. },
  77. {
  78. src:"Bob", srcport:0,
  79. dst:"Router 2", dstport:0
  80. },
  81. {
  82. src:"Carol", srcport:0,
  83. dst:"Router 3", dstport:0
  84. },
  85. {
  86. src:"Router 1", srcport:1,
  87. dst:"Router 2", dstport:1
  88. },
  89. {
  90. src:"Router 1", srcport:2,
  91. dst:"Router 3", dstport:1
  92. },
  93. {
  94. src:"Router 2", srcport:2,
  95. dst:"Router 3", dstport:2
  96. }
  97. ],
  98. timeline:[
  99. {
  100. type:"packet",
  101. at:100,
  102. from:"Alice",
  103. payload:{
  104. network:{srcip:"Alice",dstip:"Carol"}
  105. }
  106. },
  107. {
  108. type:"packet",
  109. at:100,
  110. from:"Carol",
  111. payload:{
  112. network:{srcip:"Carol",dstip:"Bob"}
  113. }
  114. },
  115. {
  116. type:"packet",
  117. at:100,
  118. from:"Bob",
  119. payload:{
  120. network:{srcip:"Bob",dstip:"Alice"}
  121. }
  122. }
  123. ],
  124. triggers:[
  125. {
  126. type:"packet",
  127. device:"Carol",
  128. payload:{
  129. network:{srcip:"Bob", dstip:"Carol"}
  130. }
  131. }
  132. ],
  133. nextLevel:"01 Basics/level05.json"
  134. }