def run(self): """Checks if Admin Page/Dir exists""" while True: try: site = self.queue.get(False) except Queue.Empty: break try: conn(site) except urllib2.URLError: pass else: print 'Found: %s' % (site) finally: self.queue.task_done()
def crawl(): """Crawls Ask.com for sites and sends them to appropriate scan""" dork = raw_input('Enter your dork: ') queue = Queue.Queue() pages = raw_input('How many pages(Max 20): ') qdork = urllib2.quote(dork) page = 1 print '\nScanning Ask...' for i in range(int(pages)): host = "http://uk.ask.com/web?q=%s&page=%s" % (str(qdork), page) source = conn(host) start = 0 count = 1 end = len(source) numlinks = source.count('_t" href', start, end) while count < numlinks: start = source.find('_t" href', start, end) end = source.find(' onmousedown="return pk', start, end) link = source[start+10:end-1].replace("amp;","") queue.put(link) start = end end = len(source) count = count + 1 page += 1 return queue
def run(self): """Scans Url for Sql errors""" while True: try: site = self.queue.get(False) except Queue.Empty: break if '=' in site: test = site + self.schar try: data = conn(test) except urllib2.URLError: self.queue.task_done() else: if (re.findall("You have an error in your SQL syntax", data, re.I)): self.mysql(test) elif (re.findall('mysql_fetch', data, re.I)): self.mysql(test) elif (re.findall('JET Database Engine', data, re.I)): self.mssql(test) elif (re.findall('Microsoft OLE DB Provider for', data, re.I)): self.mssql(test) else: print test + ' <-- Not Vuln' else: print site + ' <-- No Parameters' self.queue.task_done()
def run(self): """Checks if Sub Domain responds""" socket.setdefaulttimeout(3) while True: try: domain = self.queue.get(False) except Queue.Empty: break try: test = 'http://' + domain conn(test) except urllib2.URLError: pass else: target = socket.gethostbyname(domain) print 'Found: ' + test + ' - ' + target finally: self.queue.task_done()
def crack(hashm): """Connect and check hash""" try: data = conn("http://md5.hashcracking.com/search.php?md5=%s" % (hashm)) except urllib2.URLError: print "\nError connecting" sys.exit(1) else: if data == "No results returned.": return False else: return data
def __init__(self): self.connector = connect.conn() self.cursor = self.connector.cursor() self.period = "1 MONTH" super(NewForecastMenu, self).__init__() loadUi('Pages/ForecastWindow.ui', self) self.show() self.CurrentView = "Forecast" self.resizeBreakdownTable() SideMenuModule.InitButtons(self, self.ForecastMenuButton) self.updatePage() self.periodComboBox.currentIndexChanged.connect(self.updatePage)
def check(): """Connect to site and grab Ip address""" try: data = conn('http://cmyip.com/') except urllib2.URLError: print 'Error connecting' return None else: start = 0 end = len(data) start = data.find('<title>', start, end) end = data.find('-', start, end) ip_add = data[start+25:end-2].strip() return ip_add
def __init__(self): # initialise variables self.connector = connect.conn() self.cursor = self.connector.cursor() self.CurrentView = "Report" self.startDate = "2020-01-01" self.endDate = "2020-12-31" # initialise window super(NewReportMenu, self).__init__() loadUi('Pages/ReportWindow.ui', self) self.show() # refresh page self.UpdatePage() # setup signals self.monthComboBox.currentIndexChanged.connect(self.UpdatePage) self.yearComboBox.currentIndexChanged.connect(self.UpdatePage) self.ExportReport.clicked.connect(self.Export) SideMenuModule.InitButtons(self, self.ReportMenuButton)
def run(self): """Checks Url for File Inclusion errors""" while True: try: site = self.queue.get(False) except Queue.Empty: break if '=' in site: lsite = site.rsplit('=', 1)[0] if lsite[-1] != "=": lsite = lsite + "=" test = lsite + self.lchar try: data = conn(test) except urllib2.URLError: self.queue.task_done() else: if (re.findall("failed to open stream: No such file or directory", data, re.I)): self.lfi(test) else: print test + ' <-- Not Vuln' else: print site + ' <-- No Parameters' self.queue.task_done()
def run(self): """Checks Url for possible Xss""" while True: try: site = self.queue.get(False) except Queue.Empty: break if '=' in site: xsite = site.rsplit('=', 1)[0] if xsite[-1] != "=": xsite = xsite + "=" test = xsite + self.xchar try: data = conn(test) except urllib2.URLError: self.queue.task_done() else: if (re.findall("<script>alert('xss')</script>", data, re.I)): self.xss(test) else: print test + ' <-- Not Vuln' else: print site + ' <-- No Parameters' self.queue.task_done()
def run(self): """Checks Url for Remote File Inclusion vulnerability""" while True: try: site = self.queue.get(False) except Queue.Empty: break if '=' in site: rsite = site.rsplit('=', 1)[0] if rsite[-1] != "=": rsite = rsite + "=" link = rsite + 'http://google.com' + '?' try: data = conn(link) except urllib2.URLError: self.queue.task_done() else: if (re.findall("""<meta content="Search the world's information, including webpages, images, videos and more.""", data, re.I)): self.rfi(link) else: print link + ' <-- Not Vuln' else: print site + ' <-- No Parameters' self.queue.task_done()
f.close() print(print(str(len(rows)) + ' rows written successfully to ' + f.name)) def result(result): ''' function to export a table as a csv :param result: results ''' # write to file f = open('result.csv', 'w') for row in result: f.write('\"' + '\",\"'.join(str(r) for r in row) + '\"\n') # close file f.close() print(print(str(len(result)) + ' rows written successfully to ' + f.name)) if __name__ == "__main__": connection = connect.conn() cursor = connection.cursor() table('batch') table('customer') table('inventory') table('manufacturer') table('product') table('sale_items') table('sales') result(read.sales_breakdown("2020-01-01", "2020-12-31", cursor))
import sys from PyQt5 import QtWidgets from PyQt5.QtCore import QDate from PyQt5.QtWidgets import QWidget, QApplication, QMainWindow, QTableWidgetItem, QDialog, QTableView, QTableWidget from PyQt5.uic import loadUi from UserInterface import SaleDialog, StockMenu, ReportMenu, ForecastMenu from datetime import datetime import read import tables import connect import insert import UserInterface.SideMenuModule as SideMenuModule connector = connect.conn() c = connector.cursor() # This variable holds an array of product arrays productList = read.table(tables.TableEnum.product, c) # This variable holds an array of customers customerList = read.table(tables.TableEnum.customer, c) class NewSalesMenu(QMainWindow): # This is a hash table that holds individual # added sales (Key: Product Id, Value: Quantity). # It will be added, modified or emptied saleItems = {} # This hash table holds key-value pairs of products
sale_item(arg[0], arg[1], sale_id, db, cursor) result = update.quantity(arg[0], arg[1], db, cursor) if result == -1: db.rollback() return read.prodname_by_id(arg[0], cursor) + " is sold out. " db.commit() return sale_id def sale_item(product_id, quantity, sale_id, db, cursor): ''' Note: This function should never be called from the front end. ''' query = ("INSERT INTO sale_items (`sales_id`, `product_id`, `quantity`) " "VALUES ('" + str(sale_id) + "', '" + str(product_id) + "', '" + str(quantity) + "'); ") cursor.execute(query) return cursor.lastrowid if __name__ == "__main__": # tests connect = connect.conn() # Note: cursor must be set up this way (although the parameter 'buffered=True') # can be omitted. Otherwise 'weakly-referenced object no longer exists' error will occur mycursor = connect.cursor(buffered=True) print(batch(4, '2021-12-10', '2019-09-10', 500, connect, mycursor)) # print(new_sale("2020-09-22", connect, mycursor, 2, [(1, 5), (3, 10)])) connect.close()
def __init__(self): self.history = [] self.history_location = -1 self.message_bar_content = '' self.read_config() self.conn = conn() self.parser = parser() self.search = None #colors self.FG = '#E0E2E4' self.BG = '#2F393C' self.LINK = '#E8E2B7' self.FLINK = '#93C763' self.ACTIVELINK = '#678CB1' self.HLB = '#804000' self.HLF = self.FG self.STATUS_BG = '#293134' self.STATUS_FG = '#FFCD22' self.ERROR = '#EC7600' self.BAR_BG = self.STATUS_BG self.BAR_FG = self.BG self.BAR_HLB = self.HLB self.BAR_HLF = self.FG self.BAR_SLOT = self.FG self.SCROLL = '#434A57' self.TYPES = '#A082BD' self.MENU_BG = self.BAR_BG self.MENU_FG = self.FG self.MENU_HLB = self.LINK self.MENU_HLF = self.BAR_BG #configure root window self.root = tk.Tk(className='Burrow') self.root.title('Burrow') sh = self.root.winfo_screenheight() sw = self.root.winfo_screenwidth() w = int(sw * 0.7) h = sh - 200 self.root.geometry("{}x{}+{}+{}".format(w, h, sw // 2 - w // 2, 50)) self.add_assets() #main frame objects self.top_bar = tk.Frame(self.root, padx=10, height=50, relief=tk.FLAT, bd=2, bg=self.BAR_BG) self.body = tk.Frame(self.root, relief=tk.FLAT, bd=0, bg=self.BG) self.status_bar = tk.Frame(self.root, height="20", relief=tk.FLAT, bg=self.STATUS_BG, takefocus=0) #top bar objects self.btn_back = tk.Button(self.top_bar, image=self.img_back, bd=0, highlightthickness=0, takefocus=1, bg=self.BAR_BG) self.btn_forward = tk.Button(self.top_bar, image=self.img_forward, bd=0, highlightthickness=0, bg=self.BAR_BG) self.btn_favorite = tk.Button(self.top_bar, image=self.img_favorite, bd=0, highlightthickness=0, bg=self.BAR_BG) self.btn_home = tk.Button(self.top_bar, image=self.img_home, bd=0, highlightthickness=0, bg=self.BAR_BG) self.entry_url = tk.Entry(self.top_bar, selectbackground=self.HLB, selectforeground=self.HLF, highlightcolor=self.FG, highlightbackground=self.BAR_BG, fg=self.BAR_FG, bg=self.BAR_SLOT) self.btn_menu = tk.Button(self.top_bar, image=self.img_menu, bd=0, highlightthickness=0, bg=self.BAR_BG) #body objects self.scroll_bar = tk.Scrollbar(self.body, bg=self.BAR_BG, bd=0, highlightthickness=0, troughcolor=self.BG, activebackground=self.SCROLL, activerelief=tk.RAISED) self.site_display = tk.Text(self.body, bg=self.BG, foreground=self.FG, padx=20, pady=20, wrap=tk.WORD, state=tk.DISABLED, spacing2=2, spacing1=2, spacing3=2, yscrollcommand=self.scroll_bar.set, highlightcolor=self.BG, highlightbackground=self.BAR_BG, relief=tk.FLAT, font="TkFixedFont") self.scroll_bar.config(command=self.site_display.yview, width=20, relief=tk.RIDGE) self.site_display.tag_configure('linkcolor', foreground=self.LINK, spacing1=5, spacing2=5, spacing3=5) self.site_display.tag_configure('favoritecolor', foreground=self.FLINK, spacing1=5, spacing2=5, spacing3=5) self.site_display.tag_configure('type_tag', background=self.BG, foreground=self.TYPES, spacing2=1, spacing1=1, spacing3=1) self.site_display.tag_configure('error_text', foreground=self.ERROR, spacing1=5, spacing2=5, spacing3=5) #status bar objects self.status_info = tk.Label(self.status_bar, textvariable=self.message_bar_content, bg=self.STATUS_BG, takefocus=0, fg=self.ACTIVELINK) #menu objects self.context_menu = tk.Menu(self.body, tearoff=0, bg=self.MENU_BG, fg=self.MENU_FG, activebackground=self.MENU_HLB, activeforeground=self.MENU_HLF, activeborderwidth=0) self.pack_geometry() self.add_status_titles() self.add_event_listeners() #load the home screen self.load_home_screen(1)
import connect #from examples.connect import EXAMPLE_IMAGE_NAME def upload_image(conn): print "upload image" imagefile = "/home/controller/Desktop/ciross1.qcow2" data = open(imagefile) #image_attrs={'name':'openstack-cirros-image','data':data,'disk_format':'raw','container_format':'bare','visability':'public'} image_attrs = { 'name': 'openstack-cirros-image', 'data': data, 'disk_format': 'qcow2', 'container_format': 'bare', 'visability': 'public' } conn.image.upload_image(**image_attrs) upload_image(conn=connect.conn())