Skip to content

Commit 18f590b

Browse files
authored
Merge pull request #63 from kevthehermit/develop
Merge Devlop with Master
2 parents f9e7a8d + 94aa133 commit 18f590b

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

extensions/volshell/volshell.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
import pexpect
44
from web.common import Extension
55
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}
711

812
class VolShell(Extension):
913

@@ -24,9 +28,20 @@ def run(self):
2428
v = {'volshell_id': None, 'volshell_object': None}
2529

2630
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+
)
3045

3146
# Determine if ipython is installed as this will change the expect regex
3247
try:
@@ -38,20 +53,20 @@ def run(self):
3853

3954
# Start or restore a shell
4055

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']
4358
else:
4459
voll_shell = pexpect.spawn(vol_shell_cmd)
4560
voll_shell.expect(expect_regex)
46-
v['volshell_id'] = session_id
61+
v[session_id] = {'volshell_object': None}
4762

4863
# Now run the inputs
4964

5065
voll_shell.sendline(shell_input)
5166

5267
voll_shell.expect(expect_regex, timeout=60)
5368

54-
v['volshell_object'] = voll_shell
69+
v[session_id]['volshell_object'] = voll_shell
5570

5671
before_data = self.strip_ansi_codes(voll_shell.before)
5772
after_data = self.strip_ansi_codes(voll_shell.after)

0 commit comments

Comments
 (0)