Skip to content

Commit 0671e85

Browse files
committed
Default the route command to printing the table
1 parent 8b1d29f commit 0671e85

File tree

1 file changed

+7
-7
lines changed
  • lib/msf/ui/console/command_dispatcher

1 file changed

+7
-7
lines changed

lib/msf/ui/console/command_dispatcher/core.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,10 +1327,7 @@ def cmd_route_help
13271327
# which session a given subnet should route through.
13281328
#
13291329
def cmd_route(*args)
1330-
if (args.length == 0)
1331-
cmd_route_help
1332-
return false
1333-
end
1330+
args << 'print' if args.length == 0
13341331

13351332
action = args.shift
13361333
case action
@@ -1420,8 +1417,7 @@ def cmd_route(*args)
14201417
'Netmask' => { 'MaxWidth' => 17 },
14211418
})
14221419

1423-
Rex::Socket::SwitchBoard.each { |route|
1424-
1420+
Rex::Socket::SwitchBoard.each.with_index { |route, idx|
14251421
if (route.comm.kind_of?(Msf::Session))
14261422
gw = "Session #{route.comm.sid}"
14271423
else
@@ -1431,7 +1427,11 @@ def cmd_route(*args)
14311427
tbl << [ route.subnet, route.netmask, gw ]
14321428
}
14331429

1434-
print(tbl.to_s)
1430+
if tbl.rows.length == 0
1431+
print_status('There are currently no routes defined.')
1432+
else
1433+
print(tbl.to_s)
1434+
end
14351435
else
14361436
cmd_route_help
14371437
end

0 commit comments

Comments
 (0)