author | Mahlon E. Smith <mahlon@martini.nu> |
Tue, 03 Mar 2009 22:23:45 +0000 | |
changeset 7 | 4460fc10c6a3 |
permissions | -rwxr-xr-x |
7
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1 |
#!/usr/bin/env ruby |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2 |
# |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3 |
# An example of the 'jls' utility in ruby. |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4 |
# Output is sorted by hostname. |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5 |
# |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6 |
|
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7 |
BEGIN { |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8 |
require 'pathname' |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9 |
basedir = Pathname.new( __FILE__ ).dirname.parent |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
10 |
|
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
11 |
$LOAD_PATH.unshift basedir + "ext" unless |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
12 |
$LOAD_PATH.include? basedir + "ext" |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
13 |
} |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
14 |
|
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
15 |
require 'jail' |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
16 |
|
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
17 |
puts " JID IP Address Hostname Path" |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
18 |
BSD::Jail.sort_by {|j| j.host }.each do |j| |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
19 |
puts "%6d %-15.15s %-29.29s %.74s" % [ j.jid, j.ip, j.host, j.path ] |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
20 |
end |
4460fc10c6a3
* Now with 87% more hot jail action!
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
21 |