3
3
import pexpect
4
4
from web .common import Extension
5
5
from web .database import Database
6
- v = {'volshell_id' : None , 'volshell_object' : None }
6
+
7
+ v = {}
8
+
9
+
10
+ #v = {'volshell_id': None, 'volshell_object': None}
7
11
8
12
class VolShell (Extension ):
9
13
@@ -24,9 +28,20 @@ def run(self):
24
28
v = {'volshell_id' : None , 'volshell_object' : None }
25
29
26
30
session = db .get_session (session_id )
27
- vol_shell_cmd = 'vol.py --profile={0} -f {1} volshell' .format (session ['session_profile' ],
28
- session ['session_path' ]
29
- )
31
+
32
+ # Shell type
33
+
34
+ if session ['session_profile' ].lower ().startswith ('linux' ):
35
+ shell_type = 'linux_volshell'
36
+ elif session ['session_profile' ].lower ().startswith ('mac' ):
37
+ shell_type = 'mac_volshell'
38
+ else :
39
+ shell_type = 'volshell'
40
+
41
+ vol_shell_cmd = 'vol.py --profile={0} -f {1} {2}' .format (session ['session_profile' ],
42
+ session ['session_path' ],
43
+ shell_type
44
+ )
30
45
31
46
# Determine if ipython is installed as this will change the expect regex
32
47
try :
@@ -38,20 +53,20 @@ def run(self):
38
53
39
54
# Start or restore a shell
40
55
41
- if v [ 'volshell_id' ] :
42
- voll_shell = v ['volshell_object' ]
56
+ if session_id in v :
57
+ voll_shell = v [session_id ][ 'volshell_object' ]
43
58
else :
44
59
voll_shell = pexpect .spawn (vol_shell_cmd )
45
60
voll_shell .expect (expect_regex )
46
- v ['volshell_id' ] = session_id
61
+ v [session_id ] = { 'volshell_object' : None }
47
62
48
63
# Now run the inputs
49
64
50
65
voll_shell .sendline (shell_input )
51
66
52
67
voll_shell .expect (expect_regex , timeout = 60 )
53
68
54
- v ['volshell_object' ] = voll_shell
69
+ v [session_id ][ 'volshell_object' ] = voll_shell
55
70
56
71
before_data = self .strip_ansi_codes (voll_shell .before )
57
72
after_data = self .strip_ansi_codes (voll_shell .after )
0 commit comments