@@ -47,6 +47,7 @@ def initialize(shell)
47
47
def commands
48
48
c = {
49
49
"?" => "Help menu" ,
50
+ "background" => "Backgrounds the current session" ,
50
51
"exit" => "Terminate the hardware bridge session" ,
51
52
"help" => "Help menu" ,
52
53
"irb" => "Drop into irb scripting mode" ,
@@ -55,6 +56,7 @@ def commands
55
56
"bgrun" => "Executes a meterpreter script as a background thread" ,
56
57
"bgkill" => "Kills a background meterpreter script" ,
57
58
"bglist" => "Lists running background scripts" ,
59
+ "sessions" => "Quickly switch to another session" ,
58
60
"status" => "Fetch bridge status information" ,
59
61
"specialty" => "Hardware devices specialty" ,
60
62
"reset" => "Resets the device (NOTE: on some devices this is a FULL FACTORY RESET)" ,
@@ -73,6 +75,40 @@ def name
73
75
"Core"
74
76
end
75
77
78
+ def cmd_sessions_help
79
+ print_line ( 'Usage: sessions <id>' )
80
+ print_line
81
+ print_line ( 'Interact with a different session Id.' )
82
+ print_line ( 'This works the same as calling this from the MSF shell: sessions -i <session id>' )
83
+ print_line
84
+ end
85
+
86
+ def cmd_sessions ( *args )
87
+ if args . length == 0 || args [ 0 ] . to_i == 0
88
+ cmd_sessions_help
89
+ elsif args [ 0 ] . to_s == client . name . to_s
90
+ print_status ( "Session #{ client . name } is already interactive." )
91
+ else
92
+ print_status ( "Backgrounding session #{ client . name } ..." )
93
+ # store the next session id so that it can be referenced as soon
94
+ # as this session is no longer interacting
95
+ client . next_session = args [ 0 ]
96
+ client . interacting = false
97
+ end
98
+ end
99
+
100
+ def cmd_background_help
101
+ print_line "Usage: background"
102
+ print_line
103
+ print_line "Stop interacting with this session and return to the parent prompt"
104
+ print_line
105
+ end
106
+
107
+ def cmd_background
108
+ print_status "Backgrounding session #{ client . name } ..."
109
+ client . interacting = false
110
+ end
111
+
76
112
#
77
113
# Terminates the hwbridge
78
114
#
0 commit comments