Add some efficiency improvements

GSoC/Meterpreter_Web_Console
Carter Brainerd 2018-04-17 12:09:46 -04:00 committed by GitHub
parent d91ef7c9dc
commit 85b09a162a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -110,11 +110,9 @@ module System
def get_listening_services(portsonly = false) def get_listening_services(portsonly = false)
services = {} services = {}
begin begin
full = cmd_exec('netstat -tulpn') full = cmd_exec('netstat -tulpn').to_s
raise "You must be root to get listening ports" if full.include? '(No info could be read' raise "You must be root to get listening ports" if full.include? '(No info could be read'
lines = full.split("\n").size full = full[2..-1]
cmd = "netstat -tulpn | tail -n #{lines - 2}"
full = cmd_exec(cmd)
full.delete!(':') # Only happens when getting services full.delete!(':') # Only happens when getting services
if portsonly if portsonly