@@ -57,7 +57,7 @@ def setup()
57
57
58
58
def get_xml_rpc_url ( ip )
59
59
# code to find the xmlrpc url when passed in IP
60
- vprint_status ( "Enumerating XML-RPC URI for #{ ip } ..." )
60
+ vprint_status ( "#{ ip } - Enumerating XML-RPC URI..." )
61
61
62
62
begin
63
63
@@ -74,23 +74,23 @@ def get_xml_rpc_url(ip)
74
74
if res [ 'X-Pingback' ]
75
75
return res [ 'X-Pingback' ]
76
76
else
77
- vprint_status ( "X-Pingback header not found at #{ ip } " )
77
+ vprint_status ( "#{ ip } - X-Pingback header not found" )
78
78
return nil
79
79
end
80
80
else
81
81
return nil
82
82
end
83
83
rescue ::Rex ::ConnectionRefused , ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout
84
- print_error ( "Unable to connect to #{ ip } ")
84
+ vprint_error ( " #{ ip } - Unable to connect ")
85
85
return nil
86
86
rescue ::Timeout ::Error , ::Errno ::EPIPE
87
- print_error ( "Unable to connect to #{ ip } ")
87
+ vprint_error ( " #{ ip } - Unable to connect ")
88
88
return nil
89
89
end
90
90
end
91
91
92
92
# Creates the XML data to be sent
93
- def generate_pingback_xml ( target , valid_blog_post )
93
+ def generate_pingback_xml ( target , valid_blog_post )
94
94
xml = "<?xml version=\" 1.0\" encoding=\" iso-8859-1\" ?>"
95
95
xml << "<methodCall>"
96
96
xml << "<methodName>pingback.ping</methodName>"
@@ -104,15 +104,15 @@ def generate_pingback_xml (target, valid_blog_post)
104
104
105
105
def get_blog_posts ( xml_rpc , ip )
106
106
# find all blog posts within IP and determine if pingback is enabled
107
- vprint_status ( "Enumerating Blog posts on #{ ip } ..." )
107
+ vprint_status ( "#{ ip } - Enumerating Blog posts on..." )
108
108
blog_posts = nil
109
109
110
110
uri = target_uri . path
111
111
uri << '/' if uri [ -1 , 1 ] != '/'
112
112
113
113
# make http request to feed url
114
114
begin
115
- vprint_status ( "Resolving #{ ip } #{ uri } ?feed=rss2 to locate wordpress feed..." )
115
+ vprint_status ( "#{ ip } - Resolving #{ uri } ?feed=rss2 to locate wordpress feed..." )
116
116
res = send_request_cgi ( {
117
117
'uri' => "#{ uri } ?feed=rss2" ,
118
118
'method' => 'GET'
@@ -122,7 +122,7 @@ def get_blog_posts(xml_rpc, ip)
122
122
123
123
# Follow redirects
124
124
while ( res . code == 301 || res . code == 302 ) and res . headers [ 'Location' ] and count != 0
125
- vprint_status ( "Web server returned a #{ res . code } ...following to #{ res . headers [ 'Location' ] } " )
125
+ vprint_status ( "#{ ip } - Web server returned a #{ res . code } ...following to #{ res . headers [ 'Location' ] } " )
126
126
127
127
uri = res . headers [ 'Location' ] . sub ( /(http|https):\/ \/ .*?\/ / , "/" )
128
128
res = send_request_cgi ( {
@@ -131,30 +131,30 @@ def get_blog_posts(xml_rpc, ip)
131
131
} )
132
132
133
133
if res . code == 200
134
- vprint_status ( "Feed located at http:// #{ ip } #{ uri } " )
134
+ vprint_status ( "#{ ip } - Feed located at #{ uri } " )
135
135
else
136
- vprint_status ( "#{ ip } returned a #{ res . code } ..." )
136
+ vprint_status ( "#{ ip } - Returned a #{ res . code } ..." )
137
137
end
138
138
count = count - 1
139
139
end
140
140
rescue ::Rex ::ConnectionRefused , ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout
141
- print_error ( "Unable to connect to #{ ip } ")
141
+ vprint_error ( " #{ ip } - Unable to connect ")
142
142
return nil
143
143
rescue ::Timeout ::Error , ::Errno ::EPIPE
144
- print_error ( "Unable to connect to #{ ip } ")
144
+ vprint_error ( " #{ ip } - Unable to connect ")
145
145
return nil
146
146
end
147
147
148
148
if res . nil? or res . code != 200
149
- vprint_status ( "Did not recieve HTTP response from #{ ip } " )
149
+ vprint_status ( "#{ ip } - Did not recieve HTTP response from #{ ip } " )
150
150
return blog_posts
151
151
end
152
152
153
153
# parse out links and place in array
154
154
links = res . body . scan ( /<link>([^<]+)<\/ link>/i )
155
155
156
156
if links . nil? or links . empty?
157
- vprint_status ( "Feed at #{ ip } did not have any links present" )
157
+ vprint_status ( "#{ ip } - Feed at #{ ip } did not have any links present" )
158
158
return blog_posts
159
159
end
160
160
@@ -164,11 +164,11 @@ def get_blog_posts(xml_rpc, ip)
164
164
if pingback_response
165
165
pingback_disabled_match = pingback_response . body . match ( /<value><int>33<\/ int><\/ value>/i )
166
166
if pingback_response . code == 200 and pingback_disabled_match . nil?
167
- print_good ( "Pingback enabled: #{ link . join } " )
167
+ print_good ( "#{ ip } - Pingback enabled: #{ link . join } " )
168
168
blog_posts = link . join
169
169
return blog_posts
170
170
else
171
- vprint_status ( "Pingback disabled: #{ link . join } " )
171
+ vprint_status ( "#{ ip } - Pingback disabled: #{ link . join } " )
172
172
end
173
173
end
174
174
end
@@ -189,10 +189,10 @@ def get_pingback_request(xml_rpc, target, blog_post)
189
189
'data' => "#{ pingback_xml } "
190
190
} )
191
191
rescue ::Rex ::ConnectionRefused , ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout
192
- print_error ( "Unable to connect to #{ uri } " )
192
+ vprint_error ( "Unable to connect to #{ uri } " )
193
193
return nil
194
194
rescue ::Timeout ::Error , ::Errno ::EPIPE
195
- print_error ( "Unable to connect to #{ uri } " )
195
+ vprint_error ( "Unable to connect to #{ uri } " )
196
196
return nil
197
197
end
198
198
return res
@@ -217,14 +217,14 @@ def run_host(ip)
217
217
218
218
# once xmlrpc url is found, get_blog_posts
219
219
if xmlrpc . nil?
220
- print_error ( "#{ ip } does not appear to be vulnerable" )
220
+ vprint_error ( "#{ ip } - It doesn't appear to be vulnerable" )
221
221
else
222
222
hash = get_blog_posts ( xmlrpc , ip )
223
223
224
224
if hash
225
225
store_vuln ( ip , hash ) if @db_active
226
226
else
227
- print_status ( " X-Pingback enabled but no vulnerable blogs found on #{ ip } ... ")
227
+ vprint_status ( " #{ ip } - X-Pingback enabled but no vulnerable blogs found")
228
228
end
229
229
end
230
230
end
0 commit comments