Skip to content

install difficulty. #88

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 89 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
579ced5
Merge pull request #50 from hephaest0s/dev
hephaest0s May 9, 2015
255b2f6
Major change, see description, will update readme
hephaest0s May 9, 2015
b47e270
Create settings.ini
hephaest0s May 9, 2015
b3193d2
Update README.md
hephaest0s May 9, 2015
1329537
Update usbkill.py
hephaest0s May 9, 2015
bc50674
added shred example
hephaest0s May 9, 2015
e7cb74b
Merge pull request #10 from hephaest0s/master
pwnsdx May 9, 2015
9e7ade8
Re-adding the crashfix
May 9, 2015
0751675
help_message typo
May 9, 2015
f276cb5
Cosmetic
May 9, 2015
8a27d4d
Added " && " as a variable
May 9, 2015
b622be1
Settings: Typos
May 9, 2015
ca3eb65
Experimental secure erasing system for remove_logs_and_settings
May 9, 2015
2bc935c
Added sys.exit(0) at the end of the killing function
May 9, 2015
e0e7e43
Attempt to fix https://github.com/hephaest0s/usbkill/issues/53
May 9, 2015
75c4500
Typo
May 9, 2015
3d3d0b3
Optimisations and improvements in the secure files wiping code
May 9, 2015
75957ea
Typo
May 9, 2015
0b0c8f8
Fix https://github.com/hephaest0s/usbkill/issues/53
May 9, 2015
96f7143
configparser: Compatibility layer for Python 2/3
May 9, 2015
570a776
README: Typos in the Feature List
May 9, 2015
12c6f4a
README: oops, missed that 0!
May 9, 2015
8cf9680
Typo
May 9, 2015
a7b3728
Attempt to fix https://github.com/hephaest0s/usbkill/issues/53
May 9, 2015
f1c111c
Attempt to fix https://github.com/hephaest0s/usbkill/issues/53
May 9, 2015
f3a6a0b
Finally fixed https://github.com/hephaest0s/usbkill/issues/53
May 9, 2015
4ee9142
get_arg cleanup
May 9, 2015
38c5a58
Added indication to get the usbid on OS X
May 9, 2015
bf9509f
Secure wipe: Added "wipe" program
May 9, 2015
c402e76
Typo
May 9, 2015
576aaac
Fixed some issues with the Configuration File Manager
May 9, 2015
f2d8fbc
Revert "Fixed some issues with the Configuration File Manager"
May 9, 2015
af0449c
Re-adding settings.ini, sorry
May 9, 2015
9e06712
Cleanup
May 9, 2015
f011eb0
Fix JSON decoding errors
May 9, 2015
082eebd
As it is always the same pass, wipe is not DoE/Dod compliant
May 9, 2015
fb28832
Fixed --dev mode
May 9, 2015
104b9b8
Merge pull request #52 from pwnsdx/master
hephaest0s May 10, 2015
5d23c5e
Update settings.ini
hephaest0s May 10, 2015
a739ca3
Significan rollback, sorry
hephaest0s May 10, 2015
1007e34
Update settings.ini
hephaest0s May 10, 2015
b71be8d
Merge pull request #11 from hephaest0s/master
pwnsdx May 10, 2015
ae35382
Typos
May 10, 2015
eee664b
Added the removed secure files wipe in a separate file
May 10, 2015
690a17e
Crash fix for OS X
May 10, 2015
081d8d0
Update settings.ini
hephaest0s May 11, 2015
18c7784
File shredding now supported, new cli arguments
hephaest0s May 11, 2015
211baec
Also remove settings.ini when melting from strange folder
hephaest0s May 11, 2015
a7c7a3f
Small style issue
hephaest0s May 11, 2015
85325a3
remove code from depricated feature
hephaest0s May 11, 2015
7f7c29a
Update README.md
hephaest0s May 11, 2015
252934f
Revert b71be8d..690a17e
May 11, 2015
6c0c934
Merge pull request #12 from hephaest0s/master
pwnsdx May 11, 2015
310fd9c
Comment typos
May 11, 2015
1560a63
Moved strip() to the load_settings function
May 11, 2015
634387c
README improvements + Cleanup
May 11, 2015
4e13ceb
Merge pull request #56 from pwnsdx/master
hephaest0s May 11, 2015
0dd1599
version 1.0-rc.1
hephaest0s May 15, 2015
d71b0dd
version 1.0-rc.1
hephaest0s May 15, 2015
7237652
Update README.md
hephaest0s May 15, 2015
cf220eb
Update README.md
hephaest0s May 15, 2015
29f8151
version 1.0-rc.2
hephaest0s May 23, 2015
009733c
version 1.0-rc.2
hephaest0s May 23, 2015
a90aa1e
version 1.0-rc.2
hephaest0s May 23, 2015
91b5df1
Add version printing
nadavge Jul 2, 2015
06c8566
Merge pull request #65 from nadavge/patch-1
hephaest0s Jul 3, 2015
2091325
implement real double_usbid_detection
rsrdesarrollo Jul 11, 2015
a738920
Merge pull request #66 from rsrdesarrollo/master
hephaest0s Jul 12, 2015
58232a6
Update usbkill.py
hephaest0s Jul 12, 2015
d4c3def
Update settings.ini
hephaest0s Jul 12, 2015
4d2896c
Update usbkill.py
hephaest0s Jul 12, 2015
95133cb
Update README.md
hephaest0s Jul 12, 2015
242bb5a
added swap and ram wiping
hephaest0s Jul 29, 2015
3386542
added swap and ram wiping
hephaest0s Jul 29, 2015
430dc76
Update README.md
hephaest0s Jul 29, 2015
9443a2a
Update README.md
hephaest0s Jul 29, 2015
da4ab40
Update usbkill.py
hephaest0s Sep 4, 2015
0fd752c
now installable
Sep 4, 2015
f385482
bad JSON syntax, and multi-usb not implemented
rsrdesarrollo Sep 28, 2015
48195e0
fix easy_install module name problem
rsrdesarrollo Sep 28, 2015
78a47df
Merge pull request #70 from rsrdesarrollo/master
hephaest0s Oct 4, 2015
4b972fe
Fixed a bug with Apple products (apple_vendor_id) that cause usbkill …
Jan 18, 2016
98b9da8
Merge pull request #71 from pwnsdx/master
hephaest0s May 2, 2016
ad12c6e
Update README.md
hephaest0s May 2, 2016
d899fa9
fix circular import
Jul 23, 2016
a2e71d6
Fix copy/paste typo.
deekayen Jul 28, 2016
a58cc9d
Merge pull request #73 from Wh1t3Fox/init_update
hephaest0s Jul 30, 2016
f8024e3
Merge pull request #74 from deekayen/patch-3
hephaest0s Jul 30, 2016
d3df79e
Update README.md
hephaest0s Jul 30, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ docs/_build/

# PyBuilder
target/

.idea
49 changes: 31 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,53 @@

« usbkill » is an anti-forensic kill-switch that waits for a change on your USB ports and then immediately shuts down your computer.

> The project is still under development but it does work and is effective.

To run:

```shell
sudo python usbkill.py
```
or
```shell
sudo python3 usbkill.py
```

Related project; same idea, but implemented as a Linux driver: https://github.com/NateBrune/silk-guardian


### Why?

There are 3 reasons (maybe more?) to use this tool:
Some reasons to use this tool:

- In case the police or other thugs come busting in (or steal your laptop from you when you are at a public library as happened to Ross). The police commonly uses a « [mouse jiggler](http://www.amazon.com/Cru-dataport-Jiggler-Automatic-keyboard-Activity/dp/B00MTZY7Y4/ref=pd_bxgy_pc_text_y/190-3944818-7671348) » to keep the screensaver and sleep mode from activating.
- You don't want someone to install backdoors or malware on your computer or to retrieve documents from your computer via USB.
- You want to improve the security of your (Full Disk Encrypted) home or corporate server (e.g. Your Raspberry).
- In case the police or other thugs come busting in (or steal your laptop from you when you are at a public library, as happened to Ross). The police commonly uses a « [mouse jiggler](http://www.amazon.com/Cru-dataport-Jiggler-Automatic-keyboard-Activity/dp/B00MTZY7Y4/ref=pd_bxgy_pc_text_y/190-3944818-7671348) » to keep the screensaver and sleep mode from activating.
- You dont want someone to add or copy documents to or from your computer via USB.
- You want to improve the security of your (encrypted) home or corporate server (e.g. Your Raspberry).

> **[!] Important**: Make sure to use full disk encryption! Otherwise they will get in anyway.
> **[!] Important**: Make sure to use disk encryption for all folders that contain information you want to be private. Otherwise they will get it anyway. Full disk encryption is the easiest and surest option if available

> **Tip**: Additionally, you may use a cord to attach a USB key to your wrist. Then insert the key into your computer and start usbkill. If they steal your computer, the USB will be removed and the computer shuts down immediately.

### Feature List

- Compability with Linux, *BSD and OS X
- Shutdown the computer when there is USB activity
- Ability to whitelist an USB device
- Ability to change the check interval (default: 0.5)
- Work perfectly in sleep mode (OS X)
- Low memory consumption
- No dependency except Python

and more to come! Custom commands for when a USB change is observed will be implemented.
(version 1.0-rc.4)
- Compatible with Linux, *BSD and OS X.
- Shutdown the computer when there is USB activity.
- Customizable. Define which commands should be executed just before shut down.
- Ability to whitelist a USB device.
- Ability to change the check interval (default: 250ms).
- Ability to melt the program on shut down.
- RAM and swap wiping.
- Works with sleep mode (OS X).
- No dependency except secure-delete iff you want usbkill to delete files/folders for you or if you want to wipe RAM or swap. ```sudo apt-get install secure-delete```
- Sensible defaults


### Supported command line arguments (partially for devs):

- -h or --help: show help message, exit.
- --version: show version of the program, exit.
- --no-shut-down: if a malicious change on the USB ports is detected, execute all the (destructive) commands you defined in settings.ini, but don’t turn off the computer.
- --cs: Copy program folder settings.ini to /etc/usbkill/settings.ini

### Contact

[[email protected]](mailto:[email protected]) - PGP/GPG Fingerprint: 8764 EF6F D5C1 7838 8D10 E061 CF84 9CE5 42D0 B12B


37 changes: 37 additions & 0 deletions install/usbkill
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python

# _ _ _ _ _
# | | | | (_) | |
# _ _ ___| |__ | | _ _| | |
# | | | |/___) _ \| |_/ ) | | |
# | |_| |___ | |_) ) _ (| | | |
# |____/(___/|____/|_| \_)_|\_)_)
#
#
# Hephaestos <[email protected]> - 8764 EF6F D5C1 7838 8D10 E061 CF84 9CE5 42D0 B12B
# <https://github.com/hephaest0s/usbkill>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.


import os

# Check if program is run as root, else exit.
# Root is needed to power off the computer.
if not os.geteuid() == 0:
import sys
sys.exit("\n[ERROR] This program needs to run as root.\n")

import usbkill
usbkill.go()
153 changes: 153 additions & 0 deletions install/usbkill.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# _ _ _ _ _
# | | | | (_) | |
# _ _ ___| |__ | | _ _| | |
# | | | |/___) _ \| |_/ ) | | |
# | |_| |___ | |_) ) _ (| | | |
# |____/(___/|____/|_| \_)_|\_)_)
#
#
# Hephaestos <[email protected]> - 8764 EF6F D5C1 7838 8D10 E061 CF84 9CE5 42D0 B12B
# <https://github.com/hephaest0s/usbkill>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

[config]

######################## ########################
# First are settings about usbkill behavior, then about the kill/destruction commands
######################## ########################

########################
# Usbkill behavior commands:

# whitelist
# sleep
# log_file
########################

# Whitelist command lists the USB ids that you want whitelisted
# How to get the correct usbid for your trusted USB device?
# BSD/Linux: run "lsusb", the usbid will looks like this: 0123:9abc
# Mac OS X: run "system_profiler SPUSBDataType" in the terminal and find the Vendor/Product ID, it will looks like this:
# > Product ID: 0x8403
# > Vendor ID: 0x05ac (Apple Inc.)
# Take the 4 characters after the 0x and merge them (Vendor ID first), it will look like: 05ac:8403
# Be warned! Other parties can copy your trusted usbid to another usb device!
# use whitelist command and single space separation as follows:
# whitelist = ["4c2a:d2b0", "0b2d:a2c4"]
# To allow multiple (2 and 4) USBs with same id: [ {"4c2a:d2b0":2}, {"0b2d:a2c4":4}] or
# [ "4c2a:d2b0","4c2a:d2b0", "0b2d:a2c4", ..., "0b2d:a2c4" ] (be consistent)
whitelist = []

# allow for a certain amount of sleep time between checks, e.g. 0.25 seconds:
sleep = 0.25

# Log file location:
log_file = /var/log/usbkill/usbkill.log


########################
# Usbkill destruction commands:
# N.B: all these commands are executed in the following order, except that ram and swap-wipe are in parallel.

# remove_file_cmd
# files_to_remove
# folders_to_remove
# melt_usbkill

# kill_commands
# do_sync

# wipe_ram
# wipe_ram_cmd
# wipe_swap
# wipe_swap_cmd
########################

##########
# Remove commands:

# remove_file_cmd
# files_to_remove
# folders_to_remove
# melt_usbkill
##########

# use srm to remove files.
# Check srm --help for available options
remove_file_cmd = srm -l

# What files should be removed upon a kill?
# Provide absolute paths to the files (paths that start with '/' or '~').
# Use " not ' to define the strings, e.g.:
# files_to_remove = ["~/Desktop/contacts.txt", "~/Desktop/dpr_journal.txt"]
files_to_remove = []

# What folders should be removed upon a kill?
# Provide absolute paths to the files (paths that start with '/' or '~').
# Content in folders will be removed recursively
# Use " not ' to define the strings, e.g.:
# folders_to_remove = ["~/Desktop/sensitive/", "~/Desktop/dpr_journal_entries/"]
folders_to_remove = [ ]

# Remove log (folder) and settings (folder) and usbkill program (folder) upon kill?
# This might be usefull if you only encrypt portions of your disk (home folder or volumes).
# Make sure to sync the system (using do_sync=True) if this is a critical feature for you.
# (True/False)
melt_usbkill = False


##########
# Custom commands:

# kill_commands
# do_sync
##########

# Custom kill commands that can not be specified using above described mechanisms.
# This is where you want to release volumes, etc.
# These commands will run in order and as root, as the last commands.
# Sync should be activated once more if you want to sync
# Use " not ' to define the strings, e.g.:
# kill_commands = [ "bash ~/scripts/destroy.sh", "sync" ]
kill_commands = [ ]

# Should usbkill sync the file system for you?
# This should not be a problem on most computers.
# Sync will save some of your work to disk before killing your computer.
do_sync = True

##########
# Wipe commands:
# Note: if both are set, the commands are excecuted in parallel.
# These commands will take a long time to complete and also make the device unresponsive!
# These commands will greatly stall the halting of your system!

# do_wipe_swap
# wipe_swap_cmd
# do_wipe_ram
# wipe_ram_cmd
##########


# Set do_wipe_ram to True in order clean the ram.
do_wipe_ram = False
# Check sdmem --help for available options
wipe_ram_cmd = sdmem -fll

# Set do_wipe_swap to True in order clean the swap.
do_wipe_swap = False
# Check sswap --help for available options
wipe_swap_cmd = sswap -l

47 changes: 47 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env python

# _ _ _ _ _
# | | | | (_) | |
# _ _ ___| |__ | | _ _| | |
# | | | |/___) _ \| |_/ ) | | |
# | |_| |___ | |_) ) _ (| | | |
# |____/(___/|____/|_| \_)_|\_)_)
#
#
# Hephaestos <[email protected]> - 8764 EF6F D5C1 7838 8D10 E061 CF84 9CE5 42D0 B12B
# <https://github.com/hephaest0s/usbkill>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.


from distutils.core import setup
from os import path

DIRNAME = path.dirname(path.realpath(__file__))

name = lambda x : path.join(DIRNAME, x)

setup(name='usbkill',
version='1.0-rc.4',
description='usbkill is an anti-forensic kill-switch that waits for a change on your USB ports and then immediately shuts down your computer.',
author='Hephaestos',
author_email='[email protected]',
license='GPLv3',
url='https://github.com/hephaest0s/usbkill',

packages=['usbkill'],
scripts=[name('install/usbkill')],
data_files=[ ('/etc/', [ name('install/usbkill.ini') ]) ]
)

Loading