Skip to content

Commit

Permalink
PowerShell class now fully supports the pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Lorentzen committed Sep 18, 2018
1 parent 5d5850e commit db2ce0e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,12 @@
__pycache__/
*.py[cod]
*$py.class


# au3 files
*.au3

# any content
*.txt
*.doc
*.docx
8 changes: 7 additions & 1 deletion actions/shell/powershell.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ def typing_block(self, commands):
for command in commands:
# these are individual send commands so don't need to be
# wrapped in a block
typing_text += (space + 'Send("' + command + '{ENTER}")\n')
# check to see if the command is an object pipeline command
if ("{" in command or "?" in command or "$_" in command or "|" in command):
# send in the raw keystroke option
typing_text += (space + 'Send("' + command + '", 1)\n')
typing_text += (space + 'Send("{ENTER}")\n')
else:
typing_text += (space + 'Send("' + command + '{ENTER}")\n')
# add in random delay between 2 seconds and 2 minutes
command_delay = str(random.randint(2000, 12000))
typing_text += (space + "sleep(" + command_delay + ")\n")
Expand Down

0 comments on commit db2ce0e

Please sign in to comment.