github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

emonti / jruby_jrmi_toys

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 3
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Tree: dfa6808

click here to add a description

click here to add a homepage

  • Branches (1)
    • master
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

JRuby JRMI Toys. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

added files 
emonti (author)
Thu Feb 05 23:05:18 -0800 2009
commit  dfa68087bf86559e49396331acf285c1daab54c7
tree    02150dd10e6271c31e0755f3c5d73608f6ed429b
parent  5962a321101d25ae5f6ef3e2ac2e3c10222e451e
jruby_jrmi_toys / rmiquery.rb rmiquery.rb
100755 58 lines (52 sloc) 1.398 kb
edit raw blame history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env jruby
# emonti@matasano.com - 2008
#
# This script will attempt to enumerate RMI interfaces and their exposed
# methods using JRuby.
#
# The script takes one argument, which is the URL for a remote RMI registry.
# Example:
#
# rmiquery.rb //127.0.0.1:1099
#
# Method names and prototypes are only available if RMI application stubs are
# included. You can include them by dropping their JAR or class files into
# the same directory that you run this script from and they will be
# automatically loaded.
#
# For info on RMI:
#
# java.rmi.Naming @
# http://java.sun.com/j2se/1.5/docs/api/java/rmi/Naming.html
#
# java.rmi.registry.LocateRegistry @
# http://java.sun.com/j2se/1.5/docs/api/java/rmi/registry/LocateRegistry.html
 
include Java
import java.rmi.Naming
 
require 'pp'
 
unless (regurl = ARGV[0])
  STDERR.puts "need a rmiregistry url i.e. //127.0.0.1:1099"
  exit 1
end
 
# load all jar files in the current dir
Dir.foreach(".") do |x|
  if x =~ /\.jar$/
    STDERR.puts "Importing #{x}"
    require x
  end
end
 
STDERR.puts
registry = Naming.lookup(regurl)
registry.list.each do |remote_name|
  puts "RMI Interface Found: #{remote_name}"
  begin
    remote = registry.lookup(remote_name)
    puts " #{remote}"
    remote.java_class.declared_instance_methods.each do |meth|
      puts " #{meth.to_s}"
    end
  rescue
    puts " **ERROR** #{$!}"
  end
  puts
end
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server