Generate traffic from different clients

From Tech-Wiki
Jump to: navigation, search

Back to iRules

when HTTP_REQUEST {
  # Good traffic
  if { [IP::addr [IP::client_addr] equals 10.1.10.100] } {
     #set xff 153.172.223.[expr int(rand()*100)]
     set xff [expr int(rand()*100)].[expr int(rand()*100)].[expr int(rand()*100)].[expr int(rand()*100)]
     HTTP::header insert X-Forwarded-For $xff
  }
  # Attack traffic
  if { [IP::addr [IP::client_addr] equals 10.1.10.200] } {
      set xff 132.173.99.[expr int(rand()*25)]
      HTTP::header insert X-Forwarded-For $xff
 }
}