Skip to content

Instantly share code, notes, and snippets.

@M37r1x
Created July 3, 2014 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save M37r1x/2de9c9368d8295a43171 to your computer and use it in GitHub Desktop.
Save M37r1x/2de9c9368d8295a43171 to your computer and use it in GitHub Desktop.
First program to update my flash drive
import os
import urllib
import sys
import filecmp
import wx
class main:
""" This class includes all functions related to checking for updates
and downloading new tools automatically."""
def checkOS(self):
print '[+] Determining operating system...'
if 'linux' in sys.platform:
self.opSystem = 'Linux'
print '[+] Operating system found: %s' % self.opSystem
elif 'darwin' in sys.platform:
self.opSystem = 'MacOS'
print '[+] Operating system found: %s' % self.opSystem
else:
self.opSystem = 'Windows'
print '[+] Operating system found: %s' % self.opSystem
m.checkFlashDrive()
def checkFlashDrive(self):
""" Checks to see if the flash drive is inserted and exists."""
if m.opSystem == 'Linux':
self.dirCheck = os.path.isdir('/media/justin/MULTIBOOT')
self.path = '/media/justin/MULTIBOOT'
elif m.opSystem == 'MacOS':
print "Mac port not yet completed."
else:
self.dirCheck = os.path.isdir('M:\\')
self.path = 'M:\\'
if self.dirCheck:
print "[+] Flash drive detected..."
print "[+] Continuing..."
m.updateTools()
else:
print '[-] Flash drive not detected.'
def download(self, url, saveAs):
""" This will download each tool passed to it, and then change the
working directory back to the root of the flash drive."""
try:
urllib.urlretrieve(url, saveAs)
print '[+] Download complete.'
except:
print '[-] Download failed. Check your connection.'
os.chdir(m.path)
def comboFix(self):
self.url = "http://download.bleepingcomputer.com/sUBs/ComboFix.exe"
self.fileName = 'ComboFix.exe'
print '[+] Downloading ComboFix...'
os.chdir('/media/justin/MULTIBOOT/Virus')
m.download(self.url, self.fileName)
def updateTools(self):
m.comboFix()
"""Other tools will be listed here as I complete them."""
m = main()
m.checkOS()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment