def initPlugin(self, info): version = AjaxTelemetry().getPluginVersion(info, 'credit') if not version: version = self.getVersion(info) if version: Exploits().verifExploit(info[1], version) else: print( chalk.white('\t[-] Version not found : ', bold=True) + chalk.yellow(Config.GLPI_URL + info[0], bold=True))
def getVersion(self, info): if Config.DEBUG: print("[DEBUG] GET : " + Config.GLPI_URL + info[0]) r = requests.get(Config.GLPI_URL + info[0], verify=False, proxies=Config.PROXY, headers=Config.HEADERS) content = r.content.decode("utf-8") if content.find('Racks plugin ') != -1: version = content[content.find('Racks plugin ') + len('Racks plugin '):] version = version[:version.find('\\')] print( chalk.white('\t[+] Version of [', bold=True) + chalk.yellow(info[1], bold=True) + chalk.white('] : [', bold=True) + chalk.yellow(version, bold=True) + chalk.white(']', bold=True)) return version return False
def checkServer(self): try: if Config.DEBUG: print("[DEBUG] GET : " + Config.GLPI_URL) r = requests.get(Config.GLPI_URL, timeout=10, verify=False, proxies=Config.PROXY, headers=Config.HEADERS) print(chalk.white('[+] Server Header : ', bold=True) + chalk.yellow(r.headers['Server'], bold=True)) Config.SERVER_ROOT = "/".join(Config.GLPI_URL.split("/", 3)[:3]) self.tryTelemetry() self.checkVersion() return True except Exception as e: print(chalk.red('[-] ' + Config.GLPI_URL + ' seems not accessible', bold=True)) return False
def main(): parsing() print( chalk.white("[+] GLPI Scan start : " + Config.GLPI_URL + "\n", bold=True)) if (Infos.UrlCheck().getInfo()): if (Config.ALLCHECK or Config.CREDSCHECK or Config.CREDSFILE): Credentials.CredentialsCheck().credentials() if (Config.ALLCHECK or Config.FILESCHECK): Files.FilesCheck().files() if (Config.ALLCHECK or Config.PLUGINSCHECK): Plugins.PluginsCheck().plugins()
def cv_predict_mat(self, frame, verbose=False): faces = self.import_image_from_path(frame) if (len(faces) == 0 or isinstance(faces, int)): if (verbose): print(chalk.white('No faces')) return [], [[0]] if (verbose): print(chalk.white(str(len(faces)) + ' faces detected')) faces_embeddings = [ self.nn4_small2_pretrained.predict(np.expand_dims(face, axis=0))[0] for face in faces ] r = [] for idx, f in enumerate(faces_embeddings): k = [] for jdx, a in enumerate(self.anchors_embeddings): d = self.distance(f, a) if (verbose): print( chalk.yellow( d, 'face#' + str(idx) + ' with anchor#' + str(jdx))) k.append(d) r.append(k) return (faces, r)
@contact: [email protected] @date 2015-05-09 23:29 """ import os import sys currentPath = os.path.normpath(os.path.dirname(os.path.realpath(__file__))) rootPath = os.path.normpath(os.path.dirname(currentPath)) sys.path.insert(0, rootPath) import chalk print "%s %s %s %s %s %s %s" % ( chalk.bold("bold"), chalk.dim("dim"), chalk.italic("italic"), chalk.underline("underline"), chalk.inverse("inverse"), chalk.strikethrough("strikethrough"), chalk.black(chalk.gray("black")), ) print "%s %s %s %s %s %s %s %s" % ( chalk.red("red"), chalk.green("green"), chalk.yellow("yellow"), chalk.blue("blue"), chalk.magenta("magenta"), chalk.cyan("cyan"), chalk.white("white"), chalk.gray("gray")) print "%s %s %s %s %s %s %s" % ( chalk.bgRed("bgRed"), chalk.bgGreen("bgGreen"), chalk.bgYellow("bgYellow"), chalk.bgBlue("bgBlue"), chalk.bgMagenta("bgMagenta"), chalk.bgCyan("bgCyan"), chalk.bgWhite("bgWhite"))
#!/usr/bin/env python3 import os, argparse, chalk from inc import Config, Infos, Credentials, Files, Plugins # Ugly way to clear shell print("\033[H\033[J") print( chalk.white( " ______ __ ______ __ ______ ______ ______ __ __ ", bold=True)) print( chalk.white( "/\\ ___\\ /\\ \\ /\\ == \\ /\\ \\ /\\ ___\\ /\\ ___\\ /\\ __ \\ /\\ \"-.\\ \\ ", bold=True)) print( chalk.white( "\\ \\ \\__ \\ \\ \\ \\____ \\ \\ __/ \\ \\ \\ \\ \\___ \\ \\ \\ \\____ \\ \\ __ \\ \\ \\ \\-. \\ ", bold=True)) print( chalk.white( " \\ \\_____\\ \\ \\_____\\ \\ \\_\\ \\ \\_\\ \\/\\_____\\ \\ \\_____\\ \\ \\_\\ \\_\\ \\ \\_\\\"\\_\\", bold=True)) print( chalk.white( " \\/_____/ \\/_____/ \\/_/ \\/_/ \\/_____/ \\/_____/ \\/_/\\/_/ \\/_/ \\/_/", bold=True)) print( chalk.white( " v1.4 contact[@]digitemis.com\n\n\n", bold=True))
IGNORE = ( '.git', 'letsgo.py', '.gitignore', '.gitmodules', 'README.md', 'bash.bashrc' ) def copy_dir_contents(src, dst, ignore=IGNORE): "Copies all folders and files under src directory to dst" for f in os.listdir(src): if f in ignore: chalk.yellow("Ignoring {0}".format(f)) continue fpath = os.path.join(src, f) dst_path = os.path.join(dst, f) if os.path.isdir(fpath): if not os.path.exists(dst_path): os.mkdir(dst_path) chalk.green("Copying '{0}' and its contents to '{1}'".format(f, dst)) copy_dir_contents(fpath, dst_path, ignore) else: chalk.green("Copying file '{0}' to '{1}'".format(f, dst)) shutil.copy(fpath, dst) if __name__ == '__main__': chalk.white("Copying contents of '{0}' to '{1}'...".format(os.getcwd(), HOME)) copy_dir_contents(os.getcwd(), HOME) chalk.white("Setup complete, best of luck!")
action='store_false', help= 'Do not skip over SCD files that have corresponding OGG files with the same name.' ) args = parser.parse_args() directory = args.directory directory = directory.replace('\\', '/') if directory.endswith('/'): directory = directory[:-1] skip = args.skip for file in glob.glob(f'{sys.argv[1]}/*.scd'): file = file.replace('\\', '/') print('Reading', chalk.white(file), '... ', end='') sys.stdout.flush() if skip: name, ext = file.rsplit('/', 1)[-1].rsplit('.', 1) if os.path.isfile(f'{sys.argv[1]}/{name}.ogg'): print(chalk.yellow('[SKIPPED]')) continue entry, ogg = generate_entry(file) if entry: export_test(file, entry, ogg) pysoundfile_test(file, entry, ogg) print(chalk.green('[SAVED]'))
def verifExploit(self, module, version): print(chalk.white('\t[+] Looking for [', bold=True) + chalk.yellow(module, bold=True) + chalk.white('] exploits depending on version [', bold=True) + chalk.yellow(version, bold=True) + chalk.white(']', bold=True)) for CVE in Config.CVE: if CVE[0] == module and self.verifVersion(version, CVE[1]): self.getCVE(CVE)
IGNORE = ('.git', 'letsgo.py', '.gitignore', '.gitmodules', 'README.md', 'bash.bashrc') def copy_dir_contents(src, dst, ignore=IGNORE): "Copies all folders and files under src directory to dst" for f in os.listdir(src): if f in ignore: chalk.yellow("Ignoring {0}".format(f)) continue fpath = os.path.join(src, f) dst_path = os.path.join(dst, f) if os.path.isdir(fpath): if not os.path.exists(dst_path): os.mkdir(dst_path) chalk.green("Copying '{0}' and its contents to '{1}'".format( f, dst)) copy_dir_contents(fpath, dst_path, ignore) else: chalk.green("Copying file '{0}' to '{1}'".format(f, dst)) shutil.copy(fpath, dst) if __name__ == '__main__': chalk.white("Copying contents of '{0}' to '{1}'...".format( os.getcwd(), HOME)) copy_dir_contents(os.getcwd(), HOME) chalk.white("Setup complete, best of luck!")
def main(): command="" print chalk.blue("Yes sir?") while 1: if command.lower() in stop: break else: global reply reply = "" print chalk.cyan("\nWhat would you like me to do?") command = raw_input('> ') try: ai = apiai.ApiAI(CLIENT_ACCESS_TOKEN_APIAI) requestai = ai.text_request() requestai.lang = 'en' requestai.session_id = "<SESSION ID, UNIQUE FOR EACH USER>" requestai.query = command response = requestai.getresponse() reply0 = json.loads(response.read()) reply1 = reply0['result']['fulfillment']['messages'] reply = reply1[0]['speech'] except : pass if reply in fallback: word_tokens = word_tokenize(command) command_words = [w for w in word_tokens if not w in stop_words] if command not in stop: for i in command_words: #shorten_url if i in ['shorten','short','small','smaller']: flag=0 print chalk.yellow(random.choice(yes)) for i in command_words: try: url = 'http://'+i reply = "\rThe shortened url is {}".format(shortener.short(url)) print chalk.green(reply) flag=1 except : pass if flag==0: reply = "Sorry sir, cannot shorten this url" print chalk.red(reply) reply='' break #expand_url elif i in ['expand','enlarge','big','large']: flag=0 print chalk.yellow(random.choice(yes)) for i in command_words: try: url = i if url_start in url: reply = "The expanded url is {}".format(shortener.expand(url)) else: url = url_start+i reply = "The expanded url is {}".format(shortener.expand(url)) flag=1 print chalk.green(reply) except : pass if flag==0: reply = "Sorry sir, cannot expand this url" print chalk.red(reply) reply = '' break #speedtest elif i in ['server','speed','network','connection','download','upload','ping','speedtest']: print chalk.yellow(random.choice(yes)) reply = "BEST SERVER: " + st.get_best_server()['url'] + "\nDOWNLOAD: " + str(st.download()/(1024*1024)) + " MBPS\nUPLOAD: " + str(st.upload()/(1024*1024)) + " MBPS" print chalk.green(reply) reply = '' break #calendar elif i in ['datetime','date','month','calendar','year','time']: print chalk.yellow(random.choice(yes)) y=dt.now().year m=dt.now().month d=dt.now().day c = calendar.TextCalendar(calendar.SUNDAY) cal = c.formatmonth(y, m) print chalk.blue(cal) hour = dt.now().hour half = ' AM' if hour > 12: hour -= 12 half = ' PM' minute = dt.now().minute if minute < 10: minute = "0"+str(minute) time = str(hour)+":"+ str(minute) + half print chalk.green("NOW : ") reply = str(d)+"/"+str(m)+"/"+str(y)+" - "+ time print chalk.green(reply) reply ='' break #email elif i in ['mail','email','attach','electronic-mail']: print chalk.yellow(random.choice(yes)) fromaddr = raw_input("~Enter Your Email Address: ") pas = getpass.getpass() toaddr = raw_input("~Enter Reciever's Email Address: ") msg = MIMEMultipart() msg['From'] = fromaddr msg['To'] = toaddr msg['Subject'] = raw_input("~Enter the subject of the mail: ") body = raw_input("~Enter the body of the mail: ") part1 = MIMEText(body,'plain') msg.attach(MIMEText(body, 'plain')) choice = raw_input("~Enter 1 to make an attachment: ") if choice == "1": filename = raw_input("~Enter the name of the attachment: ") path_to_file = raw_input("~Enter the path to the attachment: ") attachment = open(path_to_file, "rb") part = MIMEBase('application', 'octet-stream') part.set_payload((attachment).read()) encoders.encode_base64(part) part.add_header('Content-Disposition', "attachment; filename= %s" % filename) msg.attach(part) server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login(fromaddr, pas) text = msg.as_string() server.sendmail(fromaddr, toaddr, text) server.quit() print chalk.green("Mail successfully sent!") reply="" break #weather elif i in ['weather','weathers','condition','temperature','hot','cold']: print chalk.yellow(random.choice(yes)) try: place = command.split(i+" of ")[1] #raw_input('~Enter the name of city: ') except: place = command.split(i)[1] if place == '': place = raw_input('~Enter the name of the city: ') r = requests.get('http://api.openweathermap.org/data/2.5/weather?q='+place+'&APPID=eaa27a7b42b031a60e68312e9a689569') a = r.json() temp = str(int(a['main']['temp']) - 273) print chalk.green("Weather conditions of "+place+" is: " + a['weather'][0]['description'] + "\nTemperature: " + temp + "\nHumidity: " + str(a['main']['humidity']) + "\nPressure : "+str(a['main']['pressure']) + "\nWind : " + str(a['wind']['speed'])) reply = "" break #diary elif i in ['note down','write down','jot down','jot','write','note','diary']: print chalk.yellow(random.choice(yes)) db = sqlite3.connect('diary.db') c = db.cursor() try: c.execute(''' CREATE TABLE note(id INTEGER PRIMARY KEY, d TEXT, t TEXT, entry TEXT) ''') db.commit() except: pass c = db.cursor() day = dt.now().day month = dt.now().month year = dt.now().year dateNote = str(day)+"/"+str(month)+"/"+str(year) hourNote = dt.now().hour half = ' AM' if hourNote > 12: hourNote -= 12 half = ' PM' minuteNote = dt.now().minute if minuteNote < 10: minuteNote = "0"+str(minuteNote) timeNote = str(hourNote)+":"+ str(minuteNote) + half textNote = str(raw_input("What should I note down sir? ")) c.execute(''' INSERT INTO note(d, t, entry) VALUES(?,?,?) ''', (dateNote, timeNote, textNote)) db.commit() print chalk.green('Sucessfully noted down sir!') ch = raw_input('~Enter 1 to view all notes: ') if ch == '1': c.execute('''SELECT * FROM note ORDER BY d,t''') allNotes = c.fetchall() print chalk.yellow("Date \t\tTime \t\tText") for i in allNotes: print chalk.blue(str(i[1])+" \t"+str(i[2])+" \t"+str(i[3])) reply="" break #wallet elif i in ['wallet','transaction','money','balance']: print chalk.yellow(random.choice(yes)) db2 = sqlite3.connect('wallet.db') c = db2.cursor() try: c.execute(''' CREATE TABLE wallet(id INTEGER PRIMARY KEY, d TEXT, details TEXT, type TEXT, amount INTEGER, balance INTEGER) ''') c = db2.cursor() date0 = '05/05/2018' detail0 = 'Open' type0 = 'O' amount = 0 balance = 0 c.execute(''' INSERT INTO wallet(details, d, type, amount, balance) VALUES(?,?,?,?,?) ''', (detail0,date0,type0,amount,balance)) db2.commit() except: pass if command in ['show balance','display balance','money left','balance','wallet','wallet balance']: c.execute("SELECT * FROM wallet ORDER BY id DESC LIMIT 1") result = c.fetchone() balance = result[5] print chalk.green("Current Balance is : " + str(balance)) ch2 = raw_input('Enter 1 to view wallet transactions: ') if ch2 =='1': c.execute('''SELECT * FROM wallet''') allTx = c.fetchall() print chalk.yellow("ID \tDate \t\tDetails \tType \tAmount \tBalance") for i in allTx: print chalk.blue(str(i[0])+" \t"+str(i[1])+" \t"+str(i[2])+" \t\t"+str(i[3])+" \t"+str(i[4])+" \t"+str(i[5])) reply = '' break else: c = db2.cursor() print chalk.white("------------Transaction Details------------") date1 = raw_input('~Enter the date (dd/mm/yyyy) : ') detail1 = raw_input('~Enter the details : ') type1 = raw_input('~Enter C/D for Credit/Debit : ') while type1 not in ['C','D']: print "Wrong input" type1 = raw_input('~Enter C/D for Credit/Debit : ') amount1 = int(raw_input('~Enter the amount : ')) c.execute("SELECT * FROM wallet ORDER BY id DESC LIMIT 1") result = c.fetchone() balance = result[5] if type1 == 'C': balance+=amount1 else: balance-=amount1 c.execute(''' INSERT INTO wallet(details, d, type, amount, balance) VALUES(?,?,?,?,?) ''', (detail1,date1,type1,amount1,balance)) db2.commit() print "-------------------------------------------" ch2 = raw_input('Enter 1 to view wallet transactions: ') if ch2 =='1': c.execute('''SELECT * FROM wallet''') allTx = c.fetchall() print chalk.yellow("ID \tDate \t\tDetails \tType \tAmount \tBalance") for i in allTx: print chalk.blue(str(i[0])+" \t"+str(i[1])+" \t"+str(i[2])+" \t\t"+str(i[3])+" \t"+str(i[4])+" \t"+str(i[5])) reply = '' break #googlesearch elif i in ['google','search','look up','find']: print chalk.yellow(random.choice(yes)) w = command.split(i+" ") word = w[1] try: resp = gs().search(word) allr = resp.results i=1 if len(allr) > 10: allr = allr[:10] for r in allr: print chalk.blue(str(i) + ". " + r.title + " - " + r.url) i+=1 reply="There are " + str(i-1) + " matching results" print chalk.green(reply) reply = '' except: pass print chalk.red(reply) reply = "" if command.lower() in stop: print chalk.blue("I'll not be listening now\n")
def test_format_txt_accepts_unicode(self): actual = chalk.white('abcd' + six.unichr(5000), background='black') expected = six.u('\x1b[37;40mabcd\u1388\x1b[0m') self.assertEqual(actual, expected)
import json import pandas as pd from pycoingecko import CoinGeckoAPI import time from tqdm import tqdm from web3 import Web3 cg = CoinGeckoAPI() #------------------------------------------------------------------------------- # Utils #------------------------------------------------------------------------------- currenttime = lambda: chalk.white(datetime.now().strftime("[%m/%d/%Y %H:%M:%S]")) def info(msg, **kwargs): output = [ currenttime(), chalk.green("INFO"), msg ] output += [ "{}={}".format(chalk.blue(key), val) for key, val in kwargs.items() ] output = " ".join(output) with open(LOG, "a") as f: f.write(output + "\n") print(output) def warn(msg, **kwargs): output = [ currenttime(), chalk.yellow("WARN"), msg ]
def getServer(self, url): if Config.DEBUG: print("[DEBUG] GET : " + Config.SERVER_ROOT + url) r = requests.get(Config.SERVER_ROOT + url, verify=False, proxies=Config.PROXY, headers=Config.HEADERS, allow_redirects=False) if (r.status_code == 301): print(chalk.white('[+] Interesting URL found : ', bold=True) + chalk.red(Config.SERVER_ROOT + url, bold=True))
def getFile(self, file): if Config.DEBUG: print("[DEBUG] GET : " + Config.GLPI_URL + file) r = requests.get(Config.GLPI_URL + file, verify=False, proxies=Config.PROXY, headers=Config.HEADERS) if (r.status_code == 200): print(chalk.white('[+] Interesting file found : ', bold=True) + chalk.red(Config.GLPI_URL + file, bold=True))