ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

How To Make a 'File Stealing' App on a Mac

Updated on December 1, 2014

What we'll be doing:

In this tutorial, you will learn to create an executable application that searches for files and copies them to a USB. What this means, is you will write a program that will then compile into an executable application. You will put this application on to a USB. Once that is done, you will be able to plug your USB into another computer and have it search for files, then copy them back on to the USB.

Please do not use this knowledge for illicit activities as this tutorial is meant only for educational purposes.

What you need:

TextEdit is the basic text editor that comes installed on Apple computers.

Platypus is an open source software that allows you to compile text files in to executable apps. For this tutorial, we will write our program in a text editor (TextEdit), save that file as a plain text file, and then use Platypus to compile that text file in to an executable app.

What the finished code will look like

mkdir /Volumes/your_flashdrive_name/Data

echo "File Locations" > /Volumes/your_flashdrive_name/Data/FileLocations.txt
mdfind testingtesting >> /Volumes/your_flashdrive_name/Data/FileLocations.txt

find ~/ -iname "thisisatest*" -exec cp {} /Volumes/your_flashdrive_name/Data/ \;

killall FileStealer

Let's begin

Go ahead and open up TextEdit (which comes with every Mac computer), and Copy and paste the code in to a new file. Click format, make plain text, and then save it. Now we'll go over each line of code, what it does, and how you can customize it.

If, at any time, you wish to learn more about a command we are using, you can open up Terminal and type in "man your-command-name" then hit enter for the documentation of that command.

Don't forget to erase your_flashdrive_name and replace it with the name of your flash drive. As an example, my flash drive's name is VUSB, so I would put VUSB in place of your_flashdrive_name

Breaking down the code

Line 1:

mkdir /Volumes/your_flashdrive_name/Data

This line uses the mkdir command to make a folder called Data on your flash drive. So this is essentially making a directory (folder) at /Volumes/your_flashdrive_name/ called 'Data'. This folder is where we will store the files that we copy off of the target computer as well as their locations.

Line 2:

echo "File Locations" > /Volumes/VUSB/Data/FileLocations.txt

This line is another pretty simple one. It uses the "echo" command to creat a text file called FileLocations.txt at the specified file path, and writing the words "File Location" to the beginning of the file. Another example of using the echo command is if you type echo "this is my file" > /your_file_path/output.txt in to terminal, it will create a file at the specified path with the contents "this is my file".

Line 3:

mdfind testingtesting >> /Volumes/VUSB/Data/FileLocations.txt

The third line uses the "mdfind" command to search the entire computer for anything containing "testingtesting", and then outputs all of the file locations to our FileLocations.txt file. Notice the '>>' in the code. Since there are two greater-than signs, that means the output will append to the file, or add on to the end of the file without erasing it. If only one greater than sign is used, the output will replace the contents of the file. With this in mind, it is possible to have the program search for multiple different things and output all of their locations to our text file.

Make sure to replace "testingtesting" with whatever you want the program to search for.


Line 4:

find ~/ -iname "thisisatest*" -exec cp {} /Volumes/VUSB/Data/ \;

Poll:

Why Are You Making This App?

See results

Finding file locations is great and all, but now it's time to copy some actual files. The fourth line of our program is pretty big, so we'll break it down piece by piece. The first thing this line does is it uses the 'find' command to search the entire system, written as " ~/ ", for anything that has "thisisatest*" in the name. It is important to note that since we used -iname, only the file names will be searched, not the contents. It is also important to notice the asterisk ( * ) after the words 'thisisatest'. This asterisk makes the program account for any kind of file ending, so it can be thought of as almost a synonym for all because it searches all file endings. So now we don't have to make a new line to search for every file type.

The second part of line 4 is where the actual copying is done. It starts off with '-exec', which basically means, if anything is found with 'thisisatest' in the name as we just specified, execute the following command. The following command happens to be 'cp' which stands for 'copy', and the two curly braces signify what is to be copied, but in this case, the file we just searched for is implied as the file to be copied. The file path is simply the location where we wish to copy our files, which in this case, is the Data folder on our USB.

Don't forget to add ' \; ' to the end of the line or it will not execute properly.

Line 5:

killall FileStealer

The final line of our program is very simple. It uses the 'killall' command to kill the application named FileStealer. The only tricky part about this line, is you have replace 'FileStealer' with whatever you name the application in the next step.

Complete with an inconspicuous icon.
Complete with an inconspicuous icon.

Compiling the code

The final step in making our app is to compile the code in to an executable app. To do this, we will use the open source software called Platypus. If you don't have Platypus, you can find it here. Open up Platypus and enter your app name, but make sure it's the same name as the one you used in line 5 of your program. Make sure Script Type is set to shell, and for script path, click select and select your text file that contains the program. You can select your own icon by dragging an image over the default platypus on the left, and set the author to your name. Set output to whatever you want, but I usually just set it to 'none'. This just makes it so that the app won't open any windows (hence the no output) while it's running. Finally, click create.

Once your app is created, put it on your flash drive, plug it in to your computer, and test it out. When you double click it, it should create a folder called Data on the flash drive and create a text file in that folder as well as copying any other files that you specified it to copy. The app is now done!


Taking it further...

So let's say you finished this tutorial and are feeling pretty confident about testing your skills further and learning more. Some challenges to consider might be seeing if you can get the program to email you the information, making the program an executable that is attached to an email, or having it send you information periodically. If you're interested in any of these challenges, or just learning more in general, there are plenty of resources for you to learn coding on the web. Try Googling around for different challenge ideas, and remember that the best way to improve at coding is to keep doing it.

Happy coding!

How did it go?

See results

Comments

    0 of 8192 characters used
    Post Comment

    • profile image

      John Smith 

      22 months ago

      I keep getting this Error:

      ./Library/Saved Application State/com.adobe.flashplayer.installmanager.savedState: Permission denied

      Is there anyway to circumvent this, short of having the owner input their password?

    • profile image

      Mac Stringer 

      22 months ago

      My problem was that the script said that I didn't have permission to perform a function like that. Is that because I have antivirus software or what?

    • profile image

      Johny 

      2 years ago

      Am I just supposed to get text locations or is there a way to actually get the files on my usb.

    • profile image

      Alex 

      2 years ago

      Hello! when I did this it said there was no executable found there. Help?

    • profile image

      John 

      3 years ago

      It worked for me but i don't know how to get the data folder onto the usb drive.it was just on the computer

    • profile image

      4 years ago

      It doesn't seem to work when i put it like this, it finds all pdf documents and puts their location in the .txt file, but it doesn't copy them :/

      here's the code, perhaps there's an obvious mistake i'm making?

      mkdir /Volumes/your_flashdrive_name/Data

      echo "File Locations" "biggerthan"/Volumes/your_flashdrive_name/Data/FileLocations.txt

      mdfind docx "biggerthanx2" /Volumes/your_flashdrive_name/Data/FileLocations.txt

      find ~/ -iname "ekg*" -exec cp {} /Volumes/your_flashdrive_name/Data/ \;

      killall PDFinder

    • VDorchester profile imageAUTHOR

      Vail Dorchester 

      5 years ago from Boulder, Colorado

      Thanks! There are a lot of other good resources around the web if you decide to try to learn more. Programming is very well documented online these days, which makes it pretty easy to find resources to learn from.

    • Marcy Goodfleisch profile image

      Marcy Goodfleisch 

      5 years ago from Planet Earth

      Well, all I can say is that I am impressed, or something, because this sounds like a cool thing to do, and I totally don't understand what it's all about!!! Time to go back to school or something ! Sounds like you know what you're talking about, though, and I think you offered some good information for those who know what it is about!

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://hubpages.com/privacy-policy#gdpr

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)