Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/router/d-link-dir-655-router-statistics-plugin | ||
|---|---|---|
| 43 | 43 |
agent = Mechanize.new |
| 44 | 44 |
x = agent.get(router_path) |
| 45 | 45 |
salt = x.body.match(/salt = "(.*)"/)[1] |
| 46 |
|
|
| 46 |
|
|
| 47 | 47 |
# pad the pasword to length 16 |
| 48 | 48 |
pad_size = (16 - password.length) |
| 49 | 49 |
padded_password = password + "\x01" * pad_size |
| 50 |
|
|
| 50 |
|
|
| 51 | 51 |
# pad it the rest of the way, length 64 for user |
| 52 | 52 |
salted_password = salt + padded_password + ("\x01" * (63 - salt.length - padded_password.length)) + "U"
|
| 53 | 53 |
login_hash = salt + Digest::MD5.hexdigest(salted_password) |
| 54 |
|
|
| 54 |
|
|
| 55 | 55 |
# authenticate against the router using the hash that we just built |
| 56 | 56 |
login_path = "#{router_path}/post_login.xml?hash=#{login_hash}"
|
| 57 | 57 |
x = agent.get(login_path) |
| ... | ... | |
| 120 | 120 |
puts "#{i}_coll.value " + nics[i]["tx_collisions"]
|
| 121 | 121 |
puts "#{i}_err.value " + nics[i]["rx_errors"]
|
| 122 | 122 |
end |
| 123 |
|
|
| 123 |
|
|
| 124 | 124 |
# graph stats for each interface |
| 125 | 125 |
for i in [ "LAN", "WAN", "WLAN" ] do |
| 126 | 126 |
puts "multigraph if_packets.#{i}"
|
| ... | ... | |
| 215 | 215 |
puts 'send.type DERIVE' |
| 216 | 216 |
puts 'send.negative recv' |
| 217 | 217 |
puts 'send.min 0' |
| 218 |
|
|
| 218 |
|
|
| 219 | 219 |
puts "multigraph if_drop.#{i}"
|
| 220 | 220 |
puts "graph_title D-Link DIR-655 #{i} drops"
|
| 221 | 221 |
puts 'graph_category network' |
| ... | ... | |
| 229 | 229 |
puts 'send.type DERIVE' |
| 230 | 230 |
puts 'send.negative recv' |
| 231 | 231 |
puts 'send.min 0' |
| 232 |
|
|
| 232 |
|
|
| 233 | 233 |
puts "multigraph if_collerr.#{i}"
|
| 234 | 234 |
puts "graph_title D-Link DIR-655 #{i} collisions & errors"
|
| 235 | 235 |
puts 'graph_category network' |
Formats disponibles : Unified diff