Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Descriptions #109

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Descriptions #109

wants to merge 4 commits into from

Conversation

jcstill
Copy link
Contributor

@jcstill jcstill commented Sep 13, 2017

Added some descriptions about the backdoor shell commands

Added some descriptions about the backdoor shell commands
Copy link
Collaborator

@mame82 mame82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I have still no time to test and merge your commits.

Anyway thanks again for the effort, I put some comments on this one. You don't have to necessarily use them.

The only real error is in the description of SendDuckyScript

@@ -635,6 +635,9 @@ def do_GetClientProcs(self, line):
self.client_call_get_proc_list(waitForResult = True)

def do_shell(self, line):
'''
Start a shell inside the target computer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spawns a "cmd.exe" process on the remote host and starts interaction. STDOUT and STDIN of the remote process are piped through the HID device (covert communication channel).
Appending powershell to the command, starts a powershell process instead. The Default is to use cmd.exe, as binding to STDOUT and STDIN of a PowerShell console host could fail (depending on the target's Windows Version). In case binding Fails, the OUTPUT doesn't get transmitted over the HID device. For this reason cmd.exe should be used in favor.

usage: shell <powershell>

@@ -827,6 +830,12 @@ def do_GetKeyboardLanguage(self, line):
print self.duckencoder.getLanguage()

def do_interact(self, line):
'''
Interact with processes on the target
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interaction is only possible with processes vreated by P4wnP1 (using CreateProc or shell).
For other (interactive) processes STDIN/STDERR/STDOUT couldn't be accessed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interaction is only possible with processes vreated by P4wnP1

I am assuming this is not true for:
killproc

'''
Interact with processes on the target
Usage: Interact <process ID>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the process id is omitted, a list of process IDs which allow interaction is shown.

Remark for future change:
I'm planning to change this in future, but I'm still unsure how:

  1. A list of all processes is shown, including the Images (like 'cmd.exe')
  2. A list of processes which allow interaction is shown, including Images + command line (like cmd.exe -c "powershell -c get-date"

Additionally, I plan to implement a menu to choose a process ID interactively.

@@ -851,11 +860,17 @@ def do_interact(self, line):
self.interactWithClientProcess(pid)

def do_exit(self, line):
'''
Exit the Backdoor payload to the pi's command-line
'''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is maybe a good place to Highlight the intended user behavior:

The Server is running in a screen session, which can be detached using CTRL+A followed by D, in order to get access to the command line. In case one wants to interact with the backdoor again sudo Screen -d -r could be used (happens on SSH Login automatically).

The problem is, that this behavior isn't part of the backdoor server itself, but caused by the surrounding payload script, which starts P4wnP1.py in a separate screen session.

print "Exitting..."
# self.ll.stop() # should happen in global finally statement
sys.exit()

def do_state(self, line):
'''
See details about the target computer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shows state of the connection through HID device.
At least at the Moment, the code to fill the client Information (PowerShell Version, target OS) has been removed right now.

@@ -866,6 +881,9 @@ def do_echotest(self, line):
self.client_call_echo(line)

def do_SendDuckyScript(self, line):
'''
Deploys a pre-compiled Ducky script saved in P4wnP1/duckyscrips/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DuckyScript mustn't be precompiled. In fact this Approach is more flexible, as language could be Chosen according to thee target on-demand, while a precompiled script would have the language hardcoded.
According the language, maybe SetkeyboardLanguage command should be mentioned here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize. Bad wording on my part. I even knew it isn't pre-compiled.

print FileSystem.cd(line)

def do_lpwd(self, line):
'''
Print the name of the Pi's current directory
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pi's current Directory

should be replaced with 'P4wnP1's current working directory'

same for lcd and lls

'''
Upload a file from the Pi to the target
Usage: upload <Pi/directory.filetype> <target/directory.filetype>
'''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First Parameter is mandatory, second one optional.

In case target filename is omitted, the source filename is used.
In case path is omitted, the current working directory is used (on both P4wnP1 and remote host)

'''
Download a file from the Pi to the target
Usage: download <target/directory.filetype> <Pi/directory.filetype>
'''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as do_upload

@jcstill
Copy link
Contributor Author

jcstill commented Sep 13, 2017

Thanks for this...

I will take care of it when I get home in a couple hours

@mame82
Copy link
Collaborator

mame82 commented Sep 13, 2017

No rush, I'm not able to work on the code the next days.

Added mame's comments as well as made the formatting more pleasant. 
I am not sure what the correct usage for `CreateProcs` is. 
also someone please review and correct my `SetKeyboardLanguage`
@jcstill
Copy link
Contributor Author

jcstill commented Sep 13, 2017

Added some of mame's comments as well as made the formatting more pleasant.
I am not sure what the correct usage for CreateProcs is.
also someone please review and correct my SetKeyboardLanguage

@mame82
Copy link
Collaborator

mame82 commented Sep 18, 2017

Sorry, I'vedone code changes to add in mouse support to P4wnP1 with SendMouseScript.
Have to check if these are reflected on merge (github shows no conflicts ... not sure on this)

@jcstill
Copy link
Contributor Author

jcstill commented Sep 18, 2017

Will update when I get home.
Maybe @Swiftb0y could help?

@Swiftb0y
Copy link
Contributor

I'm not sure were I could be helpful here. I'm currently only able to push changes in the Evening.

@jcstill
Copy link
Contributor Author

jcstill commented Sep 18, 2017

oh ok. thanks anyways

Added mouse descriptions

Would someone also look at my languages and correct me?
Thanks
@@ -918,6 +1020,14 @@ def do_SendDuckyScript(self, line):
self.duckencoder.outhidDuckyScript(script)

def do_SendMouseScript(self, line):
Copy link
Contributor Author

@jcstill jcstill Sep 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mame82,

Am I correct to believe that keyboard language does not apply here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants