tcpedit_opts.def 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. /*
  2. * Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
  3. * Copyright (c) 2013-2017 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
  4. *
  5. * The Tcpreplay Suite of tools is free software: you can redistribute it
  6. * and/or modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation, either version 3 of the
  8. * License, or with the authors permission any later version.
  9. *
  10. * The Tcpreplay Suite is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with the Tcpreplay Suite. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. flag = {
  19. name = tcpedit;
  20. documentation;
  21. lib-name = tcpedit;
  22. };
  23. flag = {
  24. name = portmap;
  25. value = r;
  26. arg-type = string;
  27. max = 9999;
  28. stack-arg;
  29. descrip = "Rewrite TCP/UDP ports";
  30. doc = <<- EOText
  31. Specify a list of comma delimited port mappingings consisting of
  32. colon delimited port number pairs. Each colon delimited port pair
  33. consists of the port to match followed by the port number to rewrite.
  34. Examples:
  35. @example
  36. --portmap=80:8000 --portmap=8080:80 # 80->8000 and 8080->80
  37. --portmap=8000,8080,88888:80 # 3 different ports become 80
  38. --portmap=8000-8999:80 # ports 8000 to 8999 become 80
  39. @end example
  40. EOText;
  41. };
  42. flag = {
  43. name = seed;
  44. flags-cant = fuzz-seed;
  45. value = s;
  46. arg-type = number;
  47. descrip = "Randomize src/dst IPv4/v6 addresses w/ given seed";
  48. max = 1;
  49. doc = <<- EOText
  50. Causes the source and destination IPv4/v6 addresses to be pseudo
  51. randomized but still maintain client/server relationships.
  52. Since the randomization is deterministic based on the seed,
  53. you can reuse the same seed value to recreate the traffic.
  54. EOText;
  55. };
  56. flag = {
  57. name = pnat;
  58. value = N;
  59. arg-type = string;
  60. max = 2;
  61. stack-arg;
  62. flags-cant = srcipmap;
  63. flass-cant = dstipmap;
  64. descrip = "Rewrite IPv4/v6 addresses using pseudo-NAT";
  65. doc = <<- EOText
  66. Takes a comma delimited series of colon delimited CIDR
  67. netblock pairs. Each netblock pair is evaluated in order against
  68. the IP addresses. If the IP address in the packet matches the
  69. first netblock, it is rewritten using the second netblock as a
  70. mask against the high order bits.
  71. IPv4 Example:
  72. @example
  73. --pnat=192.168.0.0/16:10.77.0.0/16,172.16.0.0/12:10.1.0.0/24
  74. @end example
  75. IPv6 Example:
  76. @example
  77. --pnat=[2001:db8::/32]:[dead::/16],[2001:db8::/32]:[::ffff:0:0/96]
  78. @end example
  79. EOText;
  80. };
  81. flag = {
  82. name = srcipmap;
  83. value = S;
  84. arg-type = string;
  85. max = 1;
  86. flags-cant = pnat;
  87. descrip = "Rewrite source IPv4/v6 addresses using pseudo-NAT";
  88. doc = <<- EOText
  89. Works just like the --pnat option, but only affects the source IP
  90. addresses in the IPv4/v6 header.
  91. EOText;
  92. };
  93. flag = {
  94. name = dstipmap;
  95. value = D;
  96. arg-type = string;
  97. max = 1;
  98. flags-cant = pnat;
  99. descrip = "Rewrite destination IPv4/v6 addresses using pseudo-NAT";
  100. doc = <<- EOText
  101. Works just like the --pnat option, but only affects the destination IP
  102. addresses in the IPv4/v6 header.
  103. EOText;
  104. };
  105. flag = {
  106. ifdef = HAVE_CACHEFILE_SUPPORT;
  107. name = endpoints;
  108. value = e;
  109. arg-type = string;
  110. max = 1;
  111. flags-must = cachefile;
  112. descrip = "Rewrite IP addresses to be between two endpoints";
  113. doc = <<- EOText
  114. Takes a pair of colon delimited IPv4/v6 addresses which will be used to rewrite
  115. all traffic to appear to be between the two IP addresses.
  116. IPv4 Example:
  117. @example
  118. --endpoints=172.16.0.1:172.16.0.2
  119. @end example
  120. IPv6 Example:
  121. @example
  122. --endpoints=[2001:db8::dead:beef]:[::ffff:0:0:ac:f:0:2]
  123. @end example
  124. EOText;
  125. };
  126. flag = {
  127. name = skipbroadcast;
  128. value = b;
  129. descrip = "Skip rewriting broadcast/multicast IPv4/v6 addresses";
  130. doc = <<- EOText
  131. By default --seed, --pnat and --endpoints will rewrite
  132. broadcast and multicast IPv4/v6 and MAC addresses. Setting this flag
  133. will keep broadcast/multicast IPv4/v6 and MAC addresses from being rewritten.
  134. EOText;
  135. };
  136. flag = {
  137. name = fixcsum;
  138. value = C;
  139. descrip = "Force recalculation of IPv4/TCP/UDP header checksums";
  140. doc = <<- EOText
  141. Causes each IPv4/v6 packet to have their checksums recalculated and
  142. fixed. Automatically enabled for packets modified with @samp{--seed},
  143. @samp{--pnat}, @samp{--endpoints} or @samp{--fixlen}.
  144. EOText;
  145. };
  146. flag = {
  147. name = mtu;
  148. value = m;
  149. arg-type = number;
  150. max = 1;
  151. arg-range = "1->MAXPACKET";
  152. default = DEFAULT_MTU;
  153. descrip = "Override default MTU length (1500 bytes)";
  154. doc = <<- EOText
  155. Override the default 1500 byte MTU size for determining the maximum padding length
  156. (--fixlen=pad) or when truncating (--mtu-trunc).
  157. EOText;
  158. };
  159. flag = {
  160. name = mtu-trunc;
  161. max = 1;
  162. descrip = "Truncate packets larger then specified MTU";
  163. doc = <<- EOText
  164. Similar to --fixlen, this option will truncate data in packets from Layer 3 and above to be
  165. no larger then the MTU.
  166. EOText;
  167. };
  168. flag = {
  169. name = efcs;
  170. value = E;
  171. descrip = "Remove Ethernet checksums (FCS) from end of frames";
  172. doc = <<- EOText
  173. Note, this option is pretty dangerous! We do not actually check to see if a FCS
  174. actually exists in the frame, we just blindly delete the last 4 bytes. Hence,
  175. you should only use this if you know know that your OS provides the FCS when
  176. reading raw packets.
  177. EOText;
  178. };
  179. flag = {
  180. name = ttl;
  181. descrip = "Modify the IPv4/v6 TTL/Hop Limit";
  182. arg-type = string;
  183. doc = <<- EOText
  184. Allows you to modify the TTL/Hop Limit of all the IPv4/v6 packets. Specify a number to hard-code
  185. the value or +/-value to increase or decrease by the value provided (limited to 1-255).
  186. Examples:
  187. @example
  188. --ttl=10
  189. --ttl=+7
  190. --ttl=-64
  191. @end example
  192. EOText;
  193. };
  194. flag = {
  195. name = tos;
  196. descrip = "Set the IPv4 TOS/DiffServ/ECN byte";
  197. arg-type = number;
  198. arg-range = "0->255";
  199. max = 1;
  200. doc = <<- EOText
  201. Allows you to override the TOS (also known as DiffServ/ECN) value in IPv4.
  202. EOText;
  203. };
  204. flag = {
  205. name = tclass;
  206. descrip = "Set the IPv6 Traffic Class byte";
  207. arg-type = number;
  208. arg-range = "0->255";
  209. max = 1;
  210. doc = <<- EOText
  211. Allows you to override the IPv6 Traffic Class field.
  212. EOText;
  213. };
  214. flag = {
  215. name = flowlabel;
  216. descrip = "Set the IPv6 Flow Label";
  217. arg-type = number;
  218. arg-range = "0->1048575";
  219. max = 1;
  220. doc = <<- EOText
  221. Allows you to override the 20bit IPv6 Flow Label field. Has no effect on IPv4
  222. packets.
  223. EOText;
  224. };
  225. flag = {
  226. name = fixlen;
  227. value = F;
  228. arg-type = string;
  229. descrip = "Pad or truncate packet data to match header length";
  230. max = 1;
  231. doc = <<- EOText
  232. Packets may be truncated during capture if the snaplen is smaller then the
  233. packet. This option allows you to modify the packet to pad the packet back
  234. out to the size stored in the IPv4/v6 header or rewrite the IP header total length
  235. to reflect the stored packet length.
  236. @table @bullet
  237. @item
  238. @var{pad}
  239. Truncated packets will be padded out so that the packet length matches the
  240. IPv4 total length
  241. @item
  242. @var{trunc}
  243. Truncated packets will have their IPv4 total length field rewritten to match
  244. the actual packet length
  245. @item
  246. @var{del}
  247. Delete the packet
  248. EOText;
  249. };
  250. flag = {
  251. name = fuzz-seed;
  252. arg-type = number;
  253. arg-default = 0;
  254. arg-range = "0->";
  255. descrip = "Fuzz 1 in X packets. Edit bytes, length, or emulate packet drop";
  256. doc = <<- EOText
  257. This fuzzing was designed as to test layer 7 protocols such as voip protocols.
  258. It modifies randomly 1 out of X packets (where X = @var{--fuzz-factor}) in order
  259. for stateful protocols to cover more of their code. The random fuzzing actions
  260. focus on data start and end because it often is the part of the data application
  261. protocols base their decisions on.
  262. Possible fuzzing actions list:
  263. * drop packet
  264. * reduce packet size
  265. * edit packet Bytes:
  266. * Not all Bytes have the same probability of appearance in real life.
  267. Replace with 0x00, 0xFF, or a random byte with equal likelyhook
  268. * Not all Bytes have the same significance in a packet.
  269. Replace the start, the end, or the middle of the packet with equal likelihood.
  270. * do nothing (7 out of 8 packets)
  271. EOText;
  272. };
  273. flag = {
  274. name = fuzz-factor;
  275. flags-must = fuzz-seed;
  276. arg-type = number;
  277. arg-default = 8;
  278. arg-range = "1->";
  279. descrip = "Set the Fuzz 1 in X packet ratio (default 1 in 8 packets)";
  280. doc = <<- EOText
  281. Sets the ratio of for @var{--fuzz-seed} option. By default this value is 8,
  282. which means 1 in 8 packets are modified by fuzzing. Note that this ratio is
  283. based on the random number genereated by the supplied fuzz seed. Therefore by
  284. default you cannot expect that exactly every eighth packet will be modified.
  285. EOText;
  286. };
  287. #include plugins/dlt_stub.def