def listfiles(): # get current file list filelist = os.listdir("/Users/stevengooday/Desktop/Alexa/TWTD") # for each file in the list for file in filelist: # test if the file is directory, if it is loop that directory if os.path.isdir(file) == True: filelist2 = os.listdir("/Users/stevengooday/Desktop/Alexa/TWTD") zipfile(file)
def backup_onms(options): fp = fpath(options) #import pdb; pdb.set_trace() cmd = '%s -h %s -U opennms -f %s opennms' % (pg_dump_path, options.host, fp) os.system(cmd) zipfile(fp) os.system('del %s' % fp) print u'資料庫已備份至 %s' % fp + '.zip'
def exportStatus(): ''' Exports records for all I485 cases. It will also discard any cases that have a status summary of "not properly filed", "transferred" or "withdrawal". It also filters out any cases that have a status of "Not Available", which occurs sometimes when a case was present before, but then removed from the uscis system. ''' mCases = mUCases.find({ "form_type": "I485", "status_summary": { "$nin": [ "was not properly filed", "mailed a notice acknowledging withdrawal of this application or petition I485" ]}, "status": {"$ne": "Not Available"} }).sort([("receipt_number", 1)]) fieldnames = [ "receipt_number", "service_center", "status", "status_summary", "form_type", "last_updated_date", "status_old", "last_updated_date_old", "status_summary_old", "timestamp", "change_date", "received_date" ] counter = 0 output_filename = 'output/status.csv' if mCases.count() > 0: with open(output_filename, 'wb') as csvfile: writer = csv.DictWriter( csvfile, delimiter=",", fieldnames=fieldnames, extrasaction="ignore" ) writer.writeheader() for mCase in mCases: writer.writerow(mCase) counter += 1 zipfile(output_filename, "output/archive/status_%s.zip" % datetime.now().strftime("%m.%d.%Y")) print "Written %d rows to '%s'." % (counter, output_filename)
def domove(self, current): #directory if self.dir_list[current][2] == True: #clobber if self.dir_list[current][3] == 'yes': shutil.make_archive(save_root + current + ".zip", "zip", self.dir_list[current][0] ) else: #noclobber #get date and time date = datetime.datetime.now() date = date.isoformat().split('.')[0:-1][0].replace(':',"") shutil.make_archive(save_root + current + date + ".zip", "zip", self.dir_list[current][0] ) else: #single file if self.dir_list[current][3] == 'yes': #clobber zf = zipfile(save_root + current + '.zip', 'w') zf.write(self.dir_list[current][0]) zf.close() else: #append to zipfile date = datetime.datetime.now() date = date.isoformat().split('.')[0:-1][0].replace(':',"") zf = zipfile.ZipFile(save_root + current + date+ '.zip', 'w') zf.write(self.dir_list[current][0]) zf.close() return pass
def __zipShapefile(self): zip_file = "{}/{}.zip".format( self.path, self.shp_name ) with zipfile(zip_file, 'w', zipfile.ZIP_DEFLATED, True, 9) as shpzip: files = ['shp', 'shx', 'dbf', 'prj'] for f in files: shpzip.write("{}/{}.{}".format( self.path, self.shp_name, f ))
def unzip(zipName,bname): z = zipfile(path.realpath(zipName)) cpath = getcwd() chdir(bname) for f in z.namelist(): if f.endswith('/'): if not path.exists(f): makedirs(f) else: z.extract(f) chdir(cpath) return
def unzip(): source_zip = "c:\\update\\SW_Servers_20120815.zip" target_dir = "c:\\update\\" myzip = zipfile(source_zip) myfilelist = myzip.namelist() for name in myfilelist: f_handle = open(target_dir + name, "wb") f_handle.write(myzip.read(name)) f_handle.close() myzip.close()
def extract(self, file): if file.endswith("zip"): zip_ = zipfile(file) new_path = join(self.root, self.pathname) zip_.extractall(path=new_path) os.remove(file) elif file.endswith("tgz" or "tar.gz" or "tar"): tar = tarfile.open(file, "r:gz") new_path = join(self.root, self.pathname) tar.extractall(path=new_path) tar.close() os.remove(file)
def __init__(self, filename, mode='r', filedir='./', pwd=''): """ ZipManager(filename, mode='w', filedir='./') <class>: read, write, or rewrite zipfile @filedir + @filename = abspath of zipfile to save zipfile in r_mode @filename<str>: *.zip @mode<str>: r, w, a @pwd<str>: password """ _full_filename = os.path.join(filedir, filename) self._mode = mode self._pwd = pwd if self._mode in ('w', 'a'): os.path.makedirs(filedir) if not os.path.isdir(filedir) else None self._file = zipfile.ZipFile(_full_filename, self._mode, zipfile.ZIP_DEFLATED) elif self._mode in ('r',): self._file = zipfile(_full_filename, self._mode, pwd) if\ self._pwd else zipfile(_full_filename, self._mode) else: raise TypeError("zipfile model has no open_mode: %s" % self._mode)
def compress_course(src, type='mbz'): print '\n> Compressing course...', backup_name = src.split('/')[-1] backup_path = os.path.join(src, backup_name) if type == 'mbz': backup_path += '.mbz' with tarfile.open(backup_path, "w:gz") as tar: for file in listdir(src): tar.add(os.path.join(src, file), arcname=file) tar.close() elif type == 'zip': backup_name += '.zip' with zipfile(backup_name, 'w') as zip: for file in listdir(src): zip.write(os.path.join(src, file)) zip.close() else: print 'Error: Wrong backup extension.' print 'Done.' return backup_path
def OpenKH(): #Create mod.yml file, and fill it with data yml = open("mod.yml", "w+") text = open("event.txt", "r") text = text.read() text = list(text.split("\n")) yml.write("title: Rando Voices\nassets:\n") for x in text: yml.write(" - name: voice/fm/event/" + x + "\n") yml.write(" method: copy" + "\n") yml.write(" source:" + "\n") yml.write(" - name: voice/fm/event/" + x + "\n") text = open("battle.txt", "r") text = text.read() text = list(text.split("\n")) for x in text: yml.write(" - name: voice/us/battle/" + x + "\n") yml.write(" method: copy" + "\n") yml.write(" source:" + "\n") yml.write(" - name: voice/us/battle/" + x + "\n") yml.write(" - name: voice/fm/gumibattle/gumi.vsb" + "\n") yml.write(" method: copy" + "\n") yml.write(" source:" + "\n") yml.write(" - name: voice/fm/gumibattle/gumi.vsb" + "\n") openkhzip = zipfile("Voice_Rando.zip", "w") openkhzip.write("mod.yml") for root, dirs, files in os.walk("voice"): for f in files: openkhzip.write(os.path.join(root, f)) openkhzip.close() yml.close() os.remove("mod.yml")
def tritymain(): while True: try: main = raw_input('' + G + '' + color.BOLD + color.UNDERLINE + 'Tri>' + color.END) if main in swear: print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "Watch your language!" + color.END) elif main in spell: print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "Do you know how to spell?!" + color.END) elif main == "joke": joke() elif main == "info": info() elif main == "help": print "" + W + "+----------------------------+" print "" + C + "help " + W + "- displays this help message" print "" + C + "clear " + W + "- clears the screen" print "" + C + "exit " + W + "- exits tool" print "" + C + "tool " + W + "- displays info about the tool" print "" + C + "info " + W + "- displays computer and network info" print "" + C + "cd " + W + "- change working directories" print "" + W + "+----------------------------+" print "" + P + "speak " + W + "- text to speech" print "" + P + "ping " + W + "- ping a host" print "" + P + "banner " + W + "- print a new banner" print "" + P + "joke " + W + "- tell a joke" print "" + P + "quote " + W + "- print a quote" print "" + P + "contact " + W + "- contact me" print "" + W + "+----------------------------+" print "" + R + "website " + W + "- enter a website and get its ip" print "" + R + "clone" + W + " - clone a websites source " print "" + R + "whois" + W + " - whois a website" print "" + R + "web" + W + " - extract info from a website" print "" + R + "siteexists" + W + " - check if a site exists" print "" + R + "google" + W + " - find google results for a query" print "" + W + "+----------------------------+" print "" + G + "ip " + W + "- geolocate an ip" print "" + W + "+----------------------------+" print "" + O + "xss " + W + "- simple check for a xss vulnerability" print "" + O + "sql " + W + "- basic check for a sql vulnerability" print "" + O + "admin " + W + "- scan a website for its admin panel" print "" + W + "+----------------------------+" print "" + T + "email " + W + "- bomb an email address" print "" + T + "spoof email " + W + "- spoof an email address" print "" + T + "anonymous " + W + "- send an anonymous email" print "" + T + "sms" + W + " - spam text messages " print "" + T + "twitter" + W + " - check the details of a twitter account" print "" + W + "+----------------------------+" print color.CYAN + "craft" + W + " - generate useful scripts " print color.CYAN + "qr" + W + " - generate a qr code" print color.CYAN + "zip" + W + " - crack a password-protected zip file" print "" + W + "+----------------------------+" print color.BLUE + "encode base64" + W + " - text to base64" print color.BLUE + "decode base64" + W + " - base64 to text" print color.BLUE + "encode hex" + W + " - text to hex" print color.BLUE + "decode hex" + W + " - hex to text" print "" + W + "+----------------------------+" elif main == "sms": sms() elif main == "xss": xss() elif main == "sql": sql() elif main == "anonymous": anon() elif main == "encode base64": encode() elif main == "decode base64": decode() elif main == "email": smtp() elif main == "quote": quote() elif main == "spoof email": spoofemail() elif main == "zip": zipfile() elif main == "decode hex": decode1() elif main == "encode hex": encode1() elif main == "google": googleSearch() elif main == "web": web() elif main == "siteexists": siteexists() elif main == "qr": gen_qrcode() elif main == "twitter": twitter() elif main == "anonymous": anon() elif main == "contact": print('' + T + '' + color.UNDERLINE + 'Skype:' + W + '' + color.BOLD + ' [email protected]' + color.END) print('' + T + '' + color.UNDERLINE + 'Instagram:' + W + '' + color.BOLD + ' @_t0x1c - www.instagram.com/_t0x1c' + color.END) print('' + T + '' + color.UNDERLINE + 'Email me:' + W + '' + color.BOLD + ' [email protected]' + color.END) print('' + T + '' + color.UNDERLINE + 'XMPP:' + W + '' + color.BOLD + ' [email protected]' + color.END) print('' + T + '' + color.UNDERLINE + 'Twitter:' + W + '' + color.BOLD + ' @toxicnull' + color.END) elif main == "ping": while True: hostname = raw_input('' + T + '' + color.UNDERLINE + 'Host>' + color.END) os.system("ping " + hostname) elif main == "craft": while True: table() elif main == "whois": whoisweb() elif main == "admin": admin() elif main == "banner": os.system('clear') banner() banner1() elif main == "speak": while True: speak = raw_input('' + T + '' + color.UNDERLINE + 'What to say>' + color.END) os.system('espeak "' + speak + '"') elif main == "clone": clone() elif main == "cd": try: path = raw_input('' + T + '' + color.UNDERLINE + 'Directory>' + color.END) os.chdir(path) except OSError: print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "That is not a directory!" + color.END) elif main == "tool": print(color.UNDERLINE + '' + C + 'Version: ' + (VersionNum) + color.END) print(color.UNDERLINE + '' + C + '34 options to choose from!' + color.END) print(color.UNDERLINE + '' + C + 'Time spent on it: 76 hours - 14 minutes' + color.END) print(color.UNDERLINE + '' + C + 'toxic is a sp00ky h4ck3r' + color.END) elif main == "website": while True: a = raw_input('' + T + '' + color.UNDERLINE + 'Website>' + color.END) try: print socket.gethostbyname(a) except socket.gaierror: print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "Apparently host is unknown! :/" + color.END) elif main == "ip": ip = raw_input('' + T + '' + color.UNDERLINE + 'IP>' + color.END) if ip is None or ip == "": sys.exit("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "Please enter an IP!" + color.END) reversed_dns = socket.getfqdn(ip) geoip = urllib.urlopen( 'http://api.hackertarget.com/geoip/?q=' + ip).read().rstrip() print("" + G + "[*] " + color.UNDERLINE + "\033[91m" + "IP Info" + color.END) print geoip elif main == "clear": os.system('clear') elif main == "exit": print("" + G + "[*] " + color.UNDERLINE + "\033[91m" + "Exiting..." + color.END) print("" + G + "[*] " + color.UNDERLINE + "\033[92m" + "GoodBye!" + color.END) time.sleep(0.2) sys.exit() elif main == "": print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "Please enter an option!" + color.END) else: print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "That is not an option!" + color.END) except KeyboardInterrupt: print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "\nCtrl-C Pressed! Use 'exit' to close the tool!" + color.END) tritymain()
@author: User """ #бинаризация изображения #import random import glob from PIL import Image, ImageDraw #Подключим необходимые библиотеки. import zipfile import os #image = Image.open("C:/Users/User/Desktop/image/original.jpg") #Открываем изображение. #path="C:/Users/User/Desktop/image/original" #images=glob.glob(path + "/*.jpg") zip = zipfile(os.path, 'r') n = 0 for i in range(len(os.filepath) - 1, 0, -1): if (os.filepath[i] != "/"): n += 1 zip.extractall(os.filepath[:n]) #draw = ImageDraw.Draw(image) #Создаем инструмент для рисования. #width = image.size[0] #Определяем ширину. #height = image.size[1] #Определяем высоту. #pix = image.load() #Выгружаем значения пикселей. #оттенки серого ''' for i in range(width): for j in range(height):
def OnSaveObjects(self, event): #import cPickle import zipfile zf = zipfile()
def traverseDirectory(): rootDir = '/Users/stevengooday/Desktop/Alexa/TWTD' for dirName, subdirList, fileList in os.walk(rootDir, topdown=False): for fname in fileList: print('\t%s' % fname) zipfile(fname)
def extract_sprites(): log.debug("Extracting sprites...") zip = zipfile('static01.zip', 'r') zip.extractall('static') zip.close()
def tritymain(): while True: try: main = raw_input('' + G + '' + color.BOLD + color.UNDERLINE + 'Tri>' + color.END) if main in swear: print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "Watch your language!" + color.END) elif main in spell: print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "Do you know how to spell?!" + color.END) elif main == "joke": joke() elif main == "info": info() elif main == "help": print "" + W + "+----------------------------+" print "" + C + "help " + W + "- displays this help message" print "" + C + "clear " + W + "- clears the screen" print "" + C + "exit " + W + "- exits tool" print "" + C + "tool " + W + "- displays info about the tool" print "" + C + "info " + W + "- displays computer and network info" print "" + C + "cd " + W + "- change working directories" print "" + C + "ls " + W + "- see files in working directory" print "" + W + "+----------------------------+" print "" + P + "echo " + W + "- echo given words" print "" + P + "speak " + W + "- text to speech" print "" + P + "ping " + W + "- ping a host" print "" + P + "banner " + W + "- print a new banner" print "" + P + "joke " + W + "- tell a joke" print "" + P + "quote " + W + "- print a quote" print "" + P + "contact " + W + "- contact me" print "" + W + "+----------------------------+" print "" + R + "website " + W + "- enter a website and get its ip" print "" + R + "clone" + W + " - clone a websites source " print "" + R + "whois" + W + " - whois a website" print "" + R + "web" + W + " - extract info from a website" print "" + R + "siteexists" + W + " - check if a site exists" print "" + R + "google" + W + " - find google results for a query" print "" + R + "clickjacking" + W + " - test websites for clickjacking vulnerability" print "" + W + "+----------------------------+" print "" + G + "ip " + W + "- geolocate an ip" print "" + W + "+----------------------------+" print "" + O + "spoof mac" + W + " - spoof mac address" print "" + W + "+----------------------------+" print "" + T + "email " + W + "- bomb an email address" print "" + T + "spoof email " + W + "- spoof an email address" print "" + T + "sms" + W + " - spam text messages " print "" + T + "crack" + W + " - bruteforce an email" print "" + T + "anonymous" + W + " - send an anonymous email" print "" + T + "facebook" + W + " - bruteforce a facebook account" print "" + T + "twitter" + W + " - check the details of a twitter account" print "" + W + "+----------------------------+" print color.CYAN + "craft" + W + " - generate useful scripts " print color.CYAN + "qr" + W + " - generate a qr code" print color.CYAN + "zip" + W + " - crack a password-protected zip file" print "" + W + "+----------------------------+" print color.BLUE + "encode base64" + W + " - text to base64" print color.BLUE + "decode base64" + W + " - base64 to text" print color.BLUE + "encode hex" + W + " - text to hex" print color.BLUE + "decode hex" + W + " - hex to text" print "" + W + "+----------------------------+" elif main == "spoof mac": print "" + C + "1 - Random MAC address" print "" + C + "2 - Set MAC address" print "" + C + "3 - See available addresses" while True: spoofmac = raw_input('' + G + '' + color.UNDERLINE + 'Tri>Spoof>' + color.END) if spoofmac == "1": try: inter = raw_input('' + T + '' + color.UNDERLINE + 'Interface>' + color.END) os.system('spoof-mac.py randomize ' + inter) print "" + G + "[*] Done! " + C + "To change you MAC Address back to your original, restart your computer\n or set your MAC address to your original" except: print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "Oops.... Something went wrong!" + color.END) elif spoofmac == "2": try: inter = raw_input('' + T + '' + color.UNDERLINE + 'Interface>' + color.END) setmac = raw_input('' + T + '' + color.UNDERLINE + 'New MAC>' + color.END) os.system('spoof-mac.py set ' + setmac + ' ' + inter) print "" + C + "Keep in mind you won't have internet during the time of your spoofed MAC!" print "" + G + "[*] Done!" + C + " To change you MAC Address back to your original, restart your computer\n or set your MAC address to your original" except: print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "Oops... Something went wrong!" + color.END) elif spoofmac == "3": os.system('spoof-mac.py list') else: print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "That is not an option!" + color.END) elif main == "sms": sms() elif main == "encode base64": encode() elif main == "decode base64": decode() elif main == "email": smtp() elif main == "quote": quote() elif main == "spoof email": spoofemail() elif main == "zip": zipfile() elif main == "decode hex": decode1() elif main == "encode hex": encode1() elif main == "google": googleSearch() elif main == "web": web() elif main == "clickjacking": clickjacking() elif main == "siteexists": siteexists() elif main == "qr": gen_qrcode() elif main == "twitter": twitter() elif main == "crack": gmail() elif main == "anonymous": anon() elif main == "contact": print('' + T + '' + color.UNDERLINE + 'Skype:' + W + '' + color.BOLD + ' infamouzgaming' + color.END) print('' + T + '' + color.UNDERLINE + 'Instagram:' + W + '' + color.BOLD + ' @_t0x1c - www.instagram.com/_t0x1c' + color.END) print('' + T + '' + color.UNDERLINE + 'Email me:' + W + '' + color.BOLD + ' [email protected]' + color.END) print('' + T + '' + color.UNDERLINE + 'XMPP:' + W + '' + color.BOLD + ' [email protected]' + color.END) elif main == "ping": while True: hostname = raw_input('' + T + '' + color.UNDERLINE + 'Host>' + color.END) os.system("ping " + hostname) elif main == "craft": while True: table() elif main == "facebook": facebook() elif main == "whois": whoisweb() elif main == "admin": admin() elif main == "banner": os.system('clear') banner() banner1() elif main == "speak": while True: speak = raw_input('' + T + '' + color.UNDERLINE + 'What to say>' + color.END) os.system('espeak "' + speak + '"') elif main == "echo": while True: echo = raw_input('' + T + '' + color.UNDERLINE + 'What to echo>' + color.END) os.system('echo ' + echo) elif main == "clone": clone() elif main == "cd": try: path = raw_input('' + T + '' + color.UNDERLINE + 'Directory>' + color.END) os.chdir(path) except OSError: print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "That is not a directory!" + color.END) elif main == "ls": os.system('ls') elif main == "tool": print(color.UNDERLINE + '' + C + 'Version: 3.0.1' + color.END) print(color.UNDERLINE + '' + C + 'Time spent on it: 74 hours - 21 minutes' + color.END) print(color.UNDERLINE + '' + C + 'toxic is a sp00ky h4ck3r' + color.END) elif main == "website": while True: a = raw_input('' + T + '' + color.UNDERLINE + 'Website>' + color.END) try: print socket.gethostbyname(a) except socket.gaierror: print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "Apparently host is unknown! :/" + color.END) elif main == "ip": ip = raw_input('' + T + '' + color.UNDERLINE + 'IP>' + color.END) if ip is None or ip == "": sys.exit("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "Please enter an IP!" + color.END) reversed_dns = socket.getfqdn(ip) geoip = urllib.urlopen( 'http://api.hackertarget.com/geoip/?q=' + ip).read().rstrip() print("" + G + "[*] " + color.UNDERLINE + "\033[91m" + "IP Info" + color.END) print geoip elif main == "clear": os.system('clear') elif main == "exit": print("" + G + "[*] " + color.UNDERLINE + "\033[91m" + "Exiting..." + color.END) print("" + G + "[*] " + color.UNDERLINE + "\033[92m" + "GoodBye!" + color.END) time.sleep(0.2) sys.exit() elif main == "": print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "Please enter an option!" + color.END) else: print("" + R + "[!] " + color.UNDERLINE + "\033[91m" + "That is not an option!" + color.END) except KeyboardInterrupt: print "\n" tritymain()
# import packages import zipfile import os from zipfile import ZipFile # delete zip from drive def deletezip(): os.remove("alexaskill002.zip") print("Zip File Deleted") #deletezip() # zip up file into a zip archive, ready for Lambda Upload def zipfile(file): zipf = ZipFile("alexaskill002.zip", "a") zipf.write(file) zipf.close() print(file + " zipped") # calls for individuals files - these need to be listed as files zipfile("InteractionControl.py") zipfile("language.json")
# ZIPFILE IS A MODULE IN PYTHON FOR. # ZIPPING AND UNZIPPING A FILE CONTENT. from zipfile import * # CREATE A ZIP FILE f = zipfile('test.zip', 'w', ZIP_DEFLATED) # ADD SOME FILES f.write('file1.txt') f.write('file2.txt') f.write('file3.txt') # CLOSE THE ZIP FILE print('test.zip created') f.close()
def tritymain(): while True: try: main = raw_input(''+G+'' + color.BOLD + color.UNDERLINE + 'Tri>' + color.END) if main in swear: print(""+R+"[!] " + color.UNDERLINE + "\033[91m" + "Watch your language!" + color.END) elif main in spell: print(""+R+"[!] " + color.UNDERLINE + "\033[91m" + "Do you know how to spell?!" + color.END) elif main == "joke": joke() elif main == "info": info() elif main == "help": print ""+W+"+----------------------------+" print ""+C+"help "+W+"- displays this help message" print ""+C+"clear "+W+"- clears the screen" print ""+C+"exit "+W+"- exits tool" print ""+C+"tool "+W+"- displays info about the tool" print ""+C+"info "+W+"- displays computer and network info" print ""+C+"cd "+W+"- change working directories" print ""+W+"+----------------------------+" print ""+P+"speak "+W+"- text to speech" print ""+P+"ping "+W+"- ping a host" print ""+P+"banner "+W+"- print a new banner" print ""+P+"joke "+W+"- tell a joke" print ""+P+"quote "+W+"- print a quote" print ""+P+"contact "+W+"- contact me" print ""+W+"+----------------------------+" print ""+R+"website "+W+"- enter a website and get its ip" print ""+R+"clone"+W+" - clone a websites source " print ""+R+"whois"+W+" - whois a website" print ""+R+"web"+W+" - extract info from a website" print ""+R+"siteexists"+W+" - check if a site exists" print ""+R+"google"+W+" - find google results for a query" print ""+W+"+----------------------------+" print ""+G+"ip "+W+"- geolocate an ip" print ""+W+"+----------------------------+" print ""+O+"xss "+W+"- simple check for a xss vulnerability" print ""+O+"sql "+W+"- basic check for a sql vulnerability" print ""+O+"admin "+W+"- scan a website for its admin panel" print ""+W+"+----------------------------+" print ""+T+"email "+W+"- bomb an email address" print ""+T+"spoof email "+W+"- spoof an email address" print ""+T+"anonymous "+W+"- send an anonymous email" print ""+T+"sms"+W+" - spam text messages " print ""+T+"twitter"+W+" - check the details of a twitter account" print ""+W+"+----------------------------+" print color.CYAN + "craft"+W+" - generate useful scripts " print color.CYAN + "qr"+W+" - generate a qr code" print color.CYAN + "zip"+W+" - crack a password-protected zip file" print ""+W+"+----------------------------+" print color.BLUE + "encode base64"+W+" - text to base64" print color.BLUE + "decode base64"+W+" - base64 to text" print color.BLUE + "encode hex"+W+" - text to hex" print color.BLUE + "decode hex"+W+" - hex to text" print ""+W+"+----------------------------+" elif main == "sms": sms() elif main == "xss": xss() elif main == "sql": sql() elif main == "anonymous": anon() elif main == "encode base64": encode() elif main == "decode base64": decode() elif main == "email": smtp() elif main == "quote": quote() elif main == "spoof email": spoofemail() elif main == "zip": zipfile() elif main == "decode hex": decode1() elif main == "encode hex": encode1() elif main == "google": googleSearch() elif main == "web": web() elif main == "siteexists": siteexists() elif main == "qr": gen_qrcode() elif main == "twitter": twitter() elif main == "anonymous": anon() elif main == "contact": print(''+T+'' + color.UNDERLINE + 'Skype:'+W+'' + color.BOLD + ' [email protected]' + color.END) print(''+T+'' + color.UNDERLINE + 'Instagram:'+W+'' + color.BOLD + ' @_t0x1c - www.instagram.com/_t0x1c' + color.END) print(''+T+'' + color.UNDERLINE + 'Email me:'+W+'' + color.BOLD + ' [email protected]' + color.END) print(''+T+'' + color.UNDERLINE + 'XMPP:'+W+'' + color.BOLD + ' [email protected]' + color.END) print(''+T+'' + color.UNDERLINE + 'Twitter:'+W+'' + color.BOLD + ' @toxicnull' + color.END) elif main == "ping": while True: hostname = raw_input(''+T+'' + color.UNDERLINE + 'Host>' + color.END) os.system("ping " + hostname) elif main == "craft": while True: table() elif main == "whois": whoisweb() elif main == "admin": admin() elif main == "banner": os.system('clear') banner() banner1() elif main == "speak": while True: speak = raw_input(''+T+'' + color.UNDERLINE + 'What to say>' + color.END) os.system('espeak "' + speak + '"') elif main == "clone": clone() elif main == "cd": try: path = raw_input(''+T+'' + color.UNDERLINE + 'Directory>' + color.END) os.chdir(path) except OSError: print (""+R+"[!] " + color.UNDERLINE + "\033[91m" + "That is not a directory!" + color.END) elif main == "tool": print(color.UNDERLINE + ''+C+'Version: ' + (VersionNum) + color.END) print(color.UNDERLINE + ''+C+'34 options to choose from!' + color.END) print(color.UNDERLINE + ''+C+'Time spent on it: 76 hours - 14 minutes' + color.END) print(color.UNDERLINE + ''+C+'hackingurwifi is a hacker' + color.END) elif main == "website": while True: a = raw_input(''+T+'' + color.UNDERLINE + 'Website>' + color.END) try: print socket.gethostbyname(a) except socket.gaierror: print (""+R+"[!] " + color.UNDERLINE + "\033[91m" + "Apparently host is unknown! :/" + color.END) elif main == "ip": ip = raw_input(''+T+'' + color.UNDERLINE + 'IP>' + color.END) if ip is None or ip == "": sys.exit(""+R+"[!] " + color.UNDERLINE + "\033[91m" + "Please enter an IP!" + color.END) reversed_dns = socket.getfqdn(ip) geoip = urllib.urlopen('http://api.hackertarget.com/geoip/?q=' + ip).read().rstrip() print (""+G+"[*] " + color.UNDERLINE + "\033[91m" + "IP Info" + color.END) print geoip elif main == "clear": os.system('clear') elif main == "exit": print (""+G+"[*] " + color.UNDERLINE + "\033[91m" + "Exiting..." + color.END) print (""+G+"[*] " + color.UNDERLINE + "\033[92m" + "GoodBye!" + color.END) time.sleep(0.2) sys.exit() elif main == "": print (""+R+"[!] " + color.UNDERLINE + "\033[91m" + "Please enter an option!" + color.END) else: print (""+R+"[!] " + color.UNDERLINE + "\033[91m" + "That is not an option!" + color.END) except KeyboardInterrupt: print (""+R+"[!] " + color.UNDERLINE + "\033[91m" + "\nCtrl-C Pressed! Use 'exit' to close the tool!" + color.END) wyattmain()
ftp.login(config.name, config.passwd) ftp.cwd("/acs2003/Core_Tables") # fnbase= "PRISM_ppt_stable_4KM" # fnmid = "2_ " # 2years before 1981 # fnend = "_all_bill.zip" fn_name = "ACS_2003_001.zip" savdir = cwd() os.chdir(savdir) start_year = 1990 end_year = 2016 for year in range(start_year, end_year): if year > 1980: fnmid = "3_" ftp.cwd(str(year)) fn = fnbase + fnmid + str(year) + fnend with open(fn, 'wb') as f: ftp.retrbinary("RETR " + fn, f.write) zfile = zipfile(fn) zfile.extractall() zfile.close() os.remove(fn) ftp.cwd("../") print(str(year) + ' is done') # to upload fn_name = "ACS_2003_001_modified.zip" ftp.storbinary('STOR ' + os.path.basename(fn_name), open(fn_name, 'rb')) print('upload done') ftp.quit()
def readFiles(filename): try: if filename is None: return # if receipt_handle is None: # return # if attempts >= MAX_PREPROCESSING_ATTEMPTS: # return # deleteMessage(receipt_handle) print "downloading raw image %s" % filename attemptsString = getFileMetadata(BUCKET_NAME_RAW_IMAGES, filename, META_DATA_ATTEMPTS_KEY) if attemptsString is None: attempts = 0 else: attempts = int(attemptsString) updateFileMetadata(BUCKET_NAME_RAW_IMAGES, filename, { META_DATA_STATUS_KEY: ProcessStatus.PROCESSING, META_DATA_ATTEMPTS_KEY: "%s" % (attempts + 1) }) downloadFile(inputPath, filename, BUCKET_NAME_RAW_IMAGES) zipfile() print "starting preprocessing" # listdir = os.listdir(inputPath) # for filename in listdir: if ce.checkMissingFiles(inputPath, filename): startTime = time.time() processStatusJSon = processStatusPath + "processing.json" data = readProcessStatusInJson(processStatusJSon) jsonData = { "status: ": ProcessStatus.PROCESSING, "starttime": startTime } addProcessStatusDataToJson(filename, data, jsonData) writeProcessStatusInJson(processStatusJSon, data) preprocessImage(filename) except OrbitNotIncludedException as err: error_message = "Orbit error: {0}".format(err) print(error_message) sendNotification(err, error_message, filename, attempts) updateFileMetadata(BUCKET_NAME_RAW_IMAGES, filename, {META_DATA_STATUS_KEY: ProcessStatus.ERROR}) except VVBandNotIncludedException as err: error_message = "VV Band error: {0}".format(err) print(error_message) sendNotification(err, error_message, filename, attempts) updateFileMetadata(BUCKET_NAME_RAW_IMAGES, filename, {META_DATA_STATUS_KEY: ProcessStatus.ERROR}) except VHBandNotIncludedException as err: error_message = "VH error: {0}".format(err) print(error_message) sendNotification(err, error_message, filename, attempts) updateFileMetadata(BUCKET_NAME_RAW_IMAGES, filename, {META_DATA_STATUS_KEY: ProcessStatus.ERROR}) except PreprocessedCommandException as err: error_message = "Preprocessing command error: {0}".format(err) print(error_message) sendNotification(err, error_message, filename, attempts) updateFileMetadata(BUCKET_NAME_RAW_IMAGES, filename, {META_DATA_STATUS_KEY: ProcessStatus.ERROR}) except: error_message = "Error: unable to preprocess" print error_message traceback.print_exc(file=sys.stdout) sendNotification(Exception(), error_message, filename, attempts) updateFileMetadata(BUCKET_NAME_RAW_IMAGES, filename, {META_DATA_STATUS_KEY: ProcessStatus.ERROR})
def OnSaveObjects(self, event): import cPickle import zipfile zf = zipfile()
def tritymain(): while True: try: main = raw_input(''+G+'' + color.BOLD + color.UNDERLINE + 'Tri>' + color.END) if main in swear: print(""+R+"[!] " + color.UNDERLINE + "\033[91m" + "Watch your language!" + color.END) elif main in spell: print(""+R+"[!] " + color.UNDERLINE + "\033[91m" + "Do you know how to spell?!" + color.END) elif main == "joke": joke() elif main == "info": info() elif main == "help": print ""+W+"+----------------------------+" print ""+C+"help "+W+"- displays this help message" print ""+C+"clear "+W+"- clears the screen" print ""+C+"exit "+W+"- exits tool" print ""+C+"tool "+W+"- displays info about the tool" print ""+C+"info "+W+"- displays computer and network info" print ""+C+"cd "+W+"- change working directories" print ""+C+"ls "+W+"- see files in working directory" print ""+W+"+----------------------------+" print ""+P+"speak "+W+"- text to speech" print ""+P+"ping "+W+"- ping a host" print ""+P+"banner "+W+"- print a new banner" print ""+P+"joke "+W+"- tell a joke" print ""+P+"quote "+W+"- print a quote" print ""+P+"contact "+W+"- contact me" print ""+W+"+----------------------------+" print ""+R+"website "+W+"- enter a website and get its ip" print ""+R+"clone"+W+" - clone a websites source " print ""+R+"whois"+W+" - whois a website" print ""+R+"web"+W+" - extract info from a website" print ""+R+"siteexists"+W+" - check if a site exists" print ""+R+"google"+W+" - find google results for a query" print ""+R+"clickjacking"+W+" - test websites for clickjacking vulnerability" print ""+W+"+----------------------------+" print ""+G+"ip "+W+"- geolocate an ip" print ""+W+"+----------------------------+" print ""+T+"email "+W+"- bomb an email address" print ""+T+"spoof email "+W+"- spoof an email address" print ""+T+"sms"+W+" - spam text messages " print ""+T+"crack"+W+" - bruteforce an email" print ""+T+"anonymous"+W+" - send an anonymous email" print ""+T+"facebook"+W+" - bruteforce a facebook account" print ""+T+"twitter"+W+" - check the details of a twitter account" print ""+W+"+----------------------------+" print color.CYAN + "craft"+W+" - generate useful scripts " print color.CYAN + "qr"+W+" - generate a qr code" print color.CYAN + "zip"+W+" - crack a password-protected zip file" print ""+W+"+----------------------------+" print color.BLUE + "encode base64"+W+" - text to base64" print color.BLUE + "decode base64"+W+" - base64 to text" print color.BLUE + "encode hex"+W+" - text to hex" print color.BLUE + "decode hex"+W+" - hex to text" print ""+W+"+----------------------------+" elif main == "sms": sms() elif main == "encode base64": encode() elif main == "decode base64": decode() elif main == "email": smtp() elif main == "quote": quote() elif main == "spoof email": os.system("python emaill.py") elif main == "zip": zipfile() elif main == "decode hex": decode1() elif main == "encode hex": encode1() elif main == "google": googleSearch() elif main == "web": web() elif main == "clickjacking": clickjacking() elif main == "siteexists": siteexists() elif main == "qr": gen_qrcode() elif main == "twitter": twitter() elif main == "crack": gmail() elif main == "anonymous": anon() elif main == "contact": print(''+T+'' + color.UNDERLINE + 'Facebook:'+W+'' + color.BOLD + ' https://www.facebook.com/Cyber.S3C.Professional' + color.END) print(''+T+'' + color.UNDERLINE + 'GitHub:'+W+'' + color.BOLD + ' https://CybernetiX-S3C.github.io/' + color.END) elif main == "ping": while True: hostname = raw_input(''+T+'' + color.UNDERLINE + 'Host>' + color.END) os.system("ping " + hostname) elif main == "craft": while True: table() elif main == "facebook": facebook() elif main == "whois": whoisweb() elif main == "admin": admin() elif main == "banner": os.system('clear') banner() banner1() elif main == "speak": while True: speak = raw_input(''+T+'' + color.UNDERLINE + 'What to say>' + color.END) os.system('espeak "' + speak + '"') elif main == "echo": while True: echo = raw_input(''+T+'' + color.UNDERLINE + 'What to echo>' + color.END) os.system('echo ' + echo) elif main == "clone": clone() elif main == "cd": try: path = raw_input(''+T+'' + color.UNDERLINE + 'Directory>' + color.END) os.chdir(path) except OSError: print (""+R+"[!] " + color.UNDERLINE + "\033[91m" + "That is not a directory!" + color.END) elif main == "ls": os.system('ls') elif main == "tool": print(color.UNDERLINE + ''+C+'Version: 4.2.1' + color.END) print(color.UNDERLINE + ''+C+'Time spent on it: 98 hours - 54 minutes' + color.END) print(color.UNDERLINE + ''+C+'John Modica @ CybernetiX S3C' + color.END) elif main == "website": while True: a = raw_input(''+T+'' + color.UNDERLINE + 'Website>' + color.END) try: print socket.gethostbyname(a) except socket.gaierror: print (""+R+"[!] " + color.UNDERLINE + "\033[91m" + "Apparently host is unknown! :/" + color.END) elif main == "ip": ip = raw_input(''+T+'' + color.UNDERLINE + 'IP>' + color.END) if ip is None or ip == "": sys.exit(""+R+"[!] " + color.UNDERLINE + "\033[91m" + "Please enter an IP!" + color.END) reversed_dns = socket.getfqdn(ip) geoip = urllib.urlopen('api.hackertarget.com/geoip/?q=' + ip).read().rstrip() print (""+G+"[*] " + color.UNDERLINE + "\033[91m" + "IP Info" + color.END) print geoip elif main == "clear": os.system('clear') elif main == "exit": print (""+G+"[*] " + color.UNDERLINE + "\033[91m" + "Exiting..." + color.END) print (""+G+"[*] " + color.UNDERLINE + "\033[92m" + "GoodBye!" + color.END) time.sleep(0.2) sys.exit() elif main == "": print (""+R+"[!] " + color.UNDERLINE + "\033[91m" + "Please enter an option!" + color.END) else: print (""+R+"[!] " + color.UNDERLINE + "\033[91m" + "That is not an option!" + color.END) except KeyboardInterrupt: print "\n" tritymain()
import zipfile import os from zipfile import ZipFile # delete zip from drive def deletezip(): os.remove("alexaskill.zip") print("Zip File Deleted") deletezip() # zip up file into a zip archive, ready for Lambda Upload def zipfile(file): zipf = ZipFile("alexaskill.zip", "a") zipf.write(file) zipf.close() print(file + " zipped") # calls for individuals files - these need to be listed as files zipfile("beans.json") zipfile("createbeans.py") zipfile("InteractionControl.py") zipfile("InteractionModel.json")
# import packages import zipfile import os from zipfile import ZipFile # delete zip from drive def deletezip(): os.remove("alexaskill003.zip") print("Zip File Deleted") #deletezip() # zip up file into a zip archive, ready for Lambda Upload def zipfile(file): zipf = ZipFile("alexaskill003.zip", "a") zipf.write(file) zipf.close() print(file + " zipped") # calls for individuals files - these need to be listed as files zipfile("InteractionControl.py")