diff --git a/lib/modules/msfclient.rb b/lib/modules/msfclient.rb new file mode 100644 index 000000000..9c7a4652a --- /dev/null +++ b/lib/modules/msfclient.rb @@ -0,0 +1,29 @@ +require "xmlrpc/client" + +module BeEF + + class MsfClient < ::XMLRPC::Client + + attr_accessor :token + + def login(user,pass) + res = self.call("auth.login", user, pass) + if(not (res and res['result'] == "success")) + raise RuntimeError, "MSF Authentication failed" + end + self.token = res['token'] + true + end + + def call(meth, *args) + if(meth != "auth.login") + if(not self.token) + raise RuntimeError, "client not authenticated" + end + args.unshift(self.token) + end + super(meth, *args) + end + + end +end