I think this if can be simplified if you're using an OptAddessRange you can do:

```ruby
ip_list = Rex::Socket::RangeWalker.new(datastore['TARGET'])
ip_list.each { |ip|
    generate_requests(hash, "http://#{ip}")
}
```

Feel free to check but I think should work