-
-
Save M37r1x/2de9c9368d8295a43171 to your computer and use it in GitHub Desktop.
First program to update my flash drive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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