Skip to content

Commit

Permalink
Fix issue nil0x42#10 (lrun is able to change $PWD)
Browse files Browse the repository at this point in the history
  • Loading branch information
nil0x42 committed Aug 20, 2014
1 parent 3e624b4 commit 12254a4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### Version 2.2.1b *(IN DEVELOPMENT)*
- Fix issue #9 (small bug in api.payload.Payload())
- Remove deprecated commands `lcd` and `lpwd` in favor of `lrun`.
- Fix some small bugs and documentation misspells.
- Fix issue #6 (*_proxy env var handling through http tunnel).

### Version 2.2.0b *(2014-08-09)*
- **Rewritten the whole PhpSploit framework** in python 3 with new skeleton.
- The `system` have been renamed into `run`.
Expand Down
18 changes: 16 additions & 2 deletions src/ui/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""
import os
import sys
import traceback
import subprocess

Expand Down Expand Up @@ -408,7 +409,7 @@ def do_lcd(self, argv):
lcd <LOCAL DIRECTORY>
DESCRIPTION:
Change the local workiong directory from your own local
Change the local working directory from your own local
operating system. This command works like the `cd`
command in unix shells.
Expand Down Expand Up @@ -449,8 +450,21 @@ def do_lrun(self, argv):
"""
if len(argv) == 1:
return self.interpret("help lrun")

if sys.platform.startswith("win"):
postcmd = " & echo %CD%"
else:
postcmd = " ; pwd"

cmd = " ".join(argv[1:])
subprocess.call(cmd, shell=True)
output = subprocess.getoutput(cmd + postcmd)
lines = output.splitlines()
if os.path.isabs(lines[-1]):
os.chdir(lines[-1])
if not lines[:-1]:
return
output = os.linesep.join(lines[:-1])
print(output)

###################
# COMMAND: source #
Expand Down

0 comments on commit 12254a4

Please sign in to comment.