Skip to content

Commit

Permalink
Merge pull request #63 from kevthehermit/develop
Browse files Browse the repository at this point in the history
Merge Devlop with Master
  • Loading branch information
kevthehermit committed Dec 1, 2016
2 parents f9e7a8d + 94aa133 commit 18f590b
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions extensions/volshell/volshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
import pexpect
from web.common import Extension
from web.database import Database
v = {'volshell_id': None, 'volshell_object': None}

v = {}


#v = {'volshell_id': None, 'volshell_object': None}

class VolShell(Extension):

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

session = db.get_session(session_id)
vol_shell_cmd = 'vol.py --profile={0} -f {1} volshell'.format(session['session_profile'],
session['session_path']
)

# Shell type

if session['session_profile'].lower().startswith('linux'):
shell_type = 'linux_volshell'
elif session['session_profile'].lower().startswith('mac'):
shell_type = 'mac_volshell'
else:
shell_type = 'volshell'

vol_shell_cmd = 'vol.py --profile={0} -f {1} {2}'.format(session['session_profile'],
session['session_path'],
shell_type
)

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

# Start or restore a shell

if v['volshell_id']:
voll_shell = v['volshell_object']
if session_id in v:
voll_shell = v[session_id]['volshell_object']
else:
voll_shell = pexpect.spawn(vol_shell_cmd)
voll_shell.expect(expect_regex)
v['volshell_id'] = session_id
v[session_id] = {'volshell_object': None}

# Now run the inputs

voll_shell.sendline(shell_input)

voll_shell.expect(expect_regex, timeout=60)

v['volshell_object'] = voll_shell
v[session_id]['volshell_object'] = voll_shell

before_data = self.strip_ansi_codes(voll_shell.before)
after_data = self.strip_ansi_codes(voll_shell.after)
Expand Down

0 comments on commit 18f590b

Please sign in to comment.