Permalink
Browse files

Patch from Jonathan Steel to fix double-symlinks

git-svn-id: file:///home/svn/framework3/trunk@6203 4d416f70-5f16-0410-b530-b9f4589650da
  • Loading branch information...
1 parent e6ef0ab commit beb0cc7cb31d4f8e096430b43f9a00a7632c9522 HD Moore committed Jan 30, 2009
Showing with 66 additions and 14 deletions.
  1. +5 −1 msfcli
  2. +5 −1 msfconsole
  3. +5 −1 msfd
  4. +5 −1 msfelfscan
  5. +5 −1 msfencode
  6. +5 −1 msfgui
  7. +5 −1 msfmachscan
  8. +6 −2 msfopcode
  9. +5 −1 msfpayload
  10. +5 −1 msfpescan
  11. +5 −1 msfrpc
  12. +5 −1 msfrpcd
  13. +5 −1 msfweb
View
6 msfcli
@@ -5,7 +5,11 @@
# or web-based interface.
#
-msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
+msfbase = __FILE__
+while File.symlink?(msfbase)
+ msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
+end
+
$:.unshift(File.join(File.dirname(msfbase), 'lib'))
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
View
@@ -4,7 +4,11 @@
# framework.
#
-msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
+msfbase = __FILE__
+while File.symlink?(msfbase)
+ msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
+end
+
$:.unshift(File.join(File.expand_path(File.dirname(msfbase)), 'lib'))
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
View
6 msfd
@@ -6,7 +6,11 @@
# possible for sessions to to be shared from a single vantage point.
#
-msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
+msfbase = __FILE__
+while File.symlink?(msfbase)
+ msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
+end
+
$:.unshift(File.join(File.dirname(msfbase), 'lib'))
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
View
@@ -2,7 +2,11 @@
# $Id$
-msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
+msfbase = __FILE__
+while File.symlink?(msfbase)
+ msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
+end
+
$:.unshift(File.join(File.dirname(msfbase), 'lib'))
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
View
@@ -1,6 +1,10 @@
#!/usr/bin/env ruby
-msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
+msfbase = __FILE__
+while File.symlink?(msfbase)
+ msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
+end
+
$:.unshift(File.join(File.dirname(msfbase), 'lib'))
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
View
6 msfgui
@@ -3,7 +3,11 @@
# This is a basic user interface using the Gtk2 GUI library
#
-msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
+msfbase = __FILE__
+while File.symlink?(msfbase)
+ msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
+end
+
$:.unshift(File.join(File.expand_path(File.dirname(msfbase)), 'lib'))
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
View
@@ -1,6 +1,10 @@
#!/usr/bin/env ruby
-msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
+msfbase = __FILE__
+while File.symlink?(msfbase)
+ msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
+end
+
$:.unshift(File.join(File.dirname(msfbase), 'lib'))
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
View
@@ -5,7 +5,11 @@
# and to display information about modules.
#
-msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
+msfbase = __FILE__
+while File.symlink?(msfbase)
+ msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
+end
+
$:.unshift(File.join(File.dirname(msfbase), 'lib'))
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
@@ -362,4 +366,4 @@ case cmd
puts("\n" + tbl.to_s + "\n")
else
$stderr.puts("Unsupported command: #{cmd}")
-end
+end
View
@@ -1,6 +1,10 @@
#!/usr/bin/env ruby
-msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
+msfbase = __FILE__
+while File.symlink?(msfbase)
+ msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
+end
+
$:.unshift(File.join(File.dirname(msfbase), 'lib'))
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
View
@@ -1,6 +1,10 @@
#!/usr/bin/env ruby
-msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
+msfbase = __FILE__
+while File.symlink?(msfbase)
+ msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
+end
+
$:.unshift(File.join(File.dirname(msfbase), 'lib'))
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
View
6 msfrpc
@@ -4,7 +4,11 @@
# instance through a XMLRPC socket.
#
-msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
+msfbase = __FILE__
+while File.symlink?(msfbase)
+ msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
+end
+
$:.unshift(File.join(File.dirname(msfbase), 'lib'))
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
View
@@ -4,7 +4,11 @@
# it with an XMLRPC interface to the Metasploit Framework.
#
-msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
+msfbase = __FILE__
+while File.symlink?(msfbase)
+ msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
+end
+
$:.unshift(File.join(File.dirname(msfbase), 'lib'))
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
View
6 msfweb
@@ -3,7 +3,11 @@
# This user interface provides users with a web-based interface to the framework
#
-msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
+msfbase = __FILE__
+while File.symlink?(msfbase)
+ msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
+end
+
$:.unshift(File.join(File.dirname(msfbase), 'lib'))
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']

0 comments on commit beb0cc7

Please sign in to comment.