Completed

Write a script in Python to monitor for connected USB storage devices

I would like a script written in Python to perform the follow:

- Create a variable at the top of the script called "SendTo" which will contain an email address (put example email address for now)

- Create a variable at the top of the script called "Subject" which will contain an email subject (put "Scan report follows....")

- Monitor for when a USB storage device is connected

- When a USB storage device is connected

-- Clean /home/temp of all contents (just in case)

-- Note the number of volumes on the storage device

-- Do a loop through each of the volumes repeating these steps

--- Put the volume label of the partition into a variable called "VOLUMELABEL". If there is no volume label, use "volume x" as the value, where x is the partition/volume number (0, 1, 2, 3, etc)

--- Copy the contents of the volume to /home/temp/VOLUMELABEL (where VOLUMELABEL is the variable you created above) including sub folders, hidden files and full directory tree

-- Repeat above process till all volumes copies to /home/temp

-- Scan the contents of /home/temp (including all subfolders) with ClamAV

--- If ClamAV finds no malware, move the contents of /home/temp to /home/collection/YYYYMMDD/HHmm/ where YYYY is numeric year, MM is numeric month with leading zero, DD is numeric day with leading zero, HH is 24-hour numeric time with leading zero, and mm is numeric minutes, with leading zero

-- ClamAV should be set to move anything infected to a quarantine folder (/home/quarantine) or delete it if necessary

-- Ensure /home/temp is clean (remove anything left if it wasn't moved properly)

- Send email to SendTo variable above with subject Subject above (from variables) showing a list of the files copied, the output from ClamAV and a status of "Clean" or "Infected" added to the beginning of the subject line (ie: "Clean: $Subject blah blah")

- Unmount the USB storage device

- Sit and wait till another storage device is connected and repeat process

A second script to run be run via a cron job that when run

- Has a variable "Age" at the start that specifies how many days old a copy should be (set to 30 to start)

- Firstly checks to make sure the first script isn't running, or hasnt run for the last hour

- If safe to proceed, removes all files and folders older than 30 days from /home/collection (leveraging the YYYYMMDD directory structure to help identify age of folders)

- If not safe to proceed, exits

Skills: Linux, PHP, Raspberry Pi, Software Architecture

See more: python detect usb plugged, linux udev python, python detect usb drive windows, pyudev, python pyusb, python detect usb device, python detect usb insert, python usb detection, write simple script python, retrieving usb video devices connected, python script file write telit, software write mq4, software write chip epson, useful software write book, software write web specs

About the Employer:
( 9 reviews ) Bundall, Australia

Project ID: #14260151

Awarded to:

kvsatya

i have skills in linux programming, python which make god candidate for this project Relevant Skills and Experience linux programming , python Proposed Milestones $111 AUD - script

$111 AUD in 3 days
(0 Reviews)
0.0

13 freelancers are bidding on average $170 for this job

snippetbucket

Python GUI Expert with you, Have been done GUI Python APPs & integrations GUI. Python kivy is most wounderful and populer in the world, so we suggest it, Also we use other GUI application too. Relevant Skills and Exp More

$250 AUD in 5 days
(7 Reviews)
4.2
martini002

You asked for a Python script, but I would suggest you to do this using a shell script, I can do this in that way, one consideration, I never used claimav, I will need to read some documentation to.. Relevant Skills a More

$200 AUD in 3 days
(6 Reviews)
3.3
bhupenderbassan

I will build this using Python for Linux. Relevant Skills and Experience Python, Linux, Shell scripting Proposed Milestones $250 AUD - A script which fulfills all(& only those requirements) requirements mentioned in More

$250 AUD in 15 days
(5 Reviews)
3.3
RisingSuperStar

Hello, man Relevant Skills and Experience Thank you for your job offer. I am confident at it and I am the right one you want. I can finish this task on time you want. Call me with no hesitate. Best regards. From Risin More

$155 AUD in 3 days
(0 Reviews)
0.0
$166 AUD in 8 days
(0 Reviews)
0.0
$183 AUD in 5 days
(0 Reviews)
0.0
ratnasolution

We can write python script for you, that will do the task you've described here. Relevant Skills and Experience We've build many different applications in Python, PHP, AJAX along with using libraries of respective lan More

$200 AUD in 5 days
(0 Reviews)
0.0
Nabeelkhann

Hello,   Over the last 7 years, I have worked for several clients. Joined Freelancer with over 7 years of experience in , Data entry, Linkedin Lead generation , Google Research Expert,Web scraping.  Python and Scrappin More

$35 AUD in 5 days
(0 Reviews)
0.0
$155 AUD in 3 days
(0 Reviews)
0.0
hasnainsohrani

don't you worry we will handle it with care . quick and free 1 revision Relevant Skills and Experience Python php nodeJs Proposed Milestones $155 AUD - extra Care

$155 AUD in 3 days
(0 Reviews)
0.0
$208 AUD in 6 days
(0 Reviews)
0.0
pppktz

A proposal has not yet been provided

$100 AUD in 7 days
(0 Reviews)
0.0
fontex

Use a Python application as background daemon to detect new devices connecting to the machine. Call CamAV and parse the output to detect malicious files, remove all permissions to malicious files. Relevant Skills and More

$250 AUD in 3 days
(0 Reviews)
0.0