Browse Source

Add background process ID output

Matthew Kienow 4 months ago
parent
commit
0350d87ee4
No account linked to committer's email address
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      msfrpcd

+ 6
- 1
msfrpcd View File

@@ -87,7 +87,11 @@ def start_rpc_service(opts, frameworkOpts, foreground)
87 87
       $stdout.puts "[*] #{RPC_TYPE.upcase}RPC ready at #{Time.now}."
88 88
     else
89 89
       $stderr.puts "[*] #{RPC_TYPE.upcase}RPC backgrounding at #{Time.now}..."
90
-      exit(0) if Process.fork()
90
+      child_pid = Process.fork()
91
+      if child_pid
92
+        $stderr.puts "[*] #{RPC_TYPE.upcase}RPC background PID #{child_pid}"
93
+        exit(0)
94
+      end
91 95
     end
92 96
   rescue ::NotImplementedError
93 97
     $stderr.puts "[-] Background mode is not available on this platform"
@@ -207,6 +211,7 @@ if $PROGRAM_NAME == __FILE__
207 211
       $stderr.puts "[*] JSON-RPC starting on #{opts['ServerHost']}:#{opts['ServerPort']} (#{opts['SSL'] ? "SSL" : "NO SSL"})..."
208 212
       $stderr.puts "[*] URI: /api/v1/json-rpc"
209 213
       $stderr.puts "[*] JSON-RPC server log: #{ws_log}" unless foreground
214
+      $stderr.puts "[*] JSON-RPC server PID file: #{ws_rpc_pid}" unless foreground
210 215
 
211 216
       ws_conf_full_path = File.expand_path(File.join(File.dirname(msfbase), WS_CONF))
212 217
 

Loading…
Cancel
Save