def main(): op = opt("Usage: %prog [flags] [values]") op.add_option("-l", "--lenght", dest="len", default=16, type="int", help="Set password's lenght.") op.add_option("-b", "--bannedchars", dest="bnd", default="", help="Set what characters you don't want to have in your password.") op.add_option("-d", "--disablespaces",action="store_false",dest="spaces", default=True,help="Use this flag if you do not want spaces in your secure password.") op.add_option("-s", "--store", action="store_true", dest="store", default=False, help="Store your passwore in a file.") op.add_option("-n", "--storefilename", dest="sname", default="spass{}.txt".format(getDate()), help="Defina a file name.") op.add_option("-p", "--donotprint", dest="print", action="store_false", default=True, help="Use this flag if you don't want to print your result.") op.add_option("-c", "--copy",action="store_true", dest="copy", default=True,help="Copy in password in the clipboard.") op.add_option("-x", "--dontcopy", action="store_false", dest="copy", help="Use this flag to avoid copying the password in the clipboard.") op.add_option("-t", "--testPassword", action="store_true", dest="test", help="Use this flag to test how secure is a password.") op.add_option("-w", "--passwordtotest", default=0,dest="passw", type="string",help="Define the password to test.") (o, argv) = op.parse_args() if o.test: if not o.passw: print("You didn't define the password to test.") exit() else: testresult = testPassword(o.passw) print("You got {} points.".format(testresult)) spass = getsPass(o.len, bannedchars=o.bnd, spaces=o.spaces) if o.print: print("Your new password: {}".format(spass)) if o.copy: copy(spass) if o.store: try: with codecs.open(o.sname, "w", encoding="utf-8") as f: f.write(spass) except Exception as e: print(e)
def main(): op = opt("Usage: %prog [flags] [values]") op.add_option("-j", "--json", dest="json", help="Set json file.", default="undefined") op.add_option("-H", "--hash", dest="hash", help="Define the hash to brake.", default="undefined") op.add_option("-p", "--dontprint", dest="prnt", help="Do not show output.", action="store_false", default=True) op.add_option("-s", "--save", dest="save", help="Use this flag to save your results.", action="store_true", default=False) op.add_option("-l", "--logname", dest="log", help="Set log name.", default=getDate()) op.add_option("-f", "--inputfile", dest="hashes", help="Set a file with hashes to search.", default="undefined") (o, argv) = op.parse_args() if o.json == "undefined" or (o.hash == "undefined" and o.hashes == "undefined"): print("Values undefined:\nJson file: {}\nHash: {}".format( o.json, o.hash)) exit() if o.hashes == "undefined": hshes = [] else: hshes = loadFile(o.hashes, True) if o.hash != "undefined": hshes.append(o.hash) out, lst = searchHash(hashes=hshes, rd=o.json, prnt=o.prnt) if o.prnt: print(out) if o.save: try: with open(o.log, "w") as log: log.write("\n".join(lst)) except Exception as e: if o.prnt: print(e) if o.prnt: print("Done!")
def main(): op = opt("Usage: %prog [flags] [values]") op.add_option( "-d", "--dir", default=".", dest="directory", help="Set the directory where the json file is going to be generated.") op.add_option("-c", "--category", default="cards", dest="cat", help="Set the category of the files.") op.add_option( "-f", "--format", default="png", dest="format", help= "Set the files that are going to be stored in this category. exp: -f png,jpeg,txt" ) op.add_option( "-j", "--json_file", default="log.json", dest="name", help= "Set the filename of the json file, if it exists and you dont use -r/--rewrite it is going to add information to the existent file." ) op.add_option("-r", "--rewrite", action="store_true", default=False, dest="rewrite", help="rewrite files with the same name.") (o, argv) = op.parse_args() cwd = getcwd() chdir(o.directory) files = listdir() content = {} if o.name in files: if not o.rewrite: with open(o.name, "r", encoding="utf-8") as f: content = loads(f.read()) if not o.cat in content: content[o.cat] = [] formats = o.format.split(",") print(formats) for file in files: file = "..\\assets\\big" + file frmt = file.split(".")[-1].lower() if frmt in formats: print("[+]{}".format(file)) content[o.cat].append(file) with open(o.name, "w", encoding="utf-8") as f: f.write(dumps(content, indent=4))
def test_dest_parameter_should_map_opt_to_property(): from optparse import make_option as opt @tasks.task @tasks.cmdopts([opt('-f', '--force', dest='force')]) def t1(options): assert options.force == '1' @tasks.task @tasks.cmdopts([opt('-f', '--force', dest='foo_force')]) def t2(options): assert options.foo_force == '1' environment = _set_environment(t1=t1, t2=t2) tasks._process_commands("t1 -f 1".split()) tasks._process_commands("t2 -f 1".split()) assert t1.called assert t2.called
def main(): op = opt("Usage: %prog [flags] [values]") op.add_option("-u", "--url", dest="url", default="none", help="Set the phishing url") op.add_option("-r", "--range", dest="range", type="int", default=1000, help="Set a total of fake credentials that are going to be sent.") (o, argv) = op.parse_args() if o.url == "none": print("[-]The url wasnt set.") har = Harasser(o.url) har.harass(o.range)
def main(): op = opt("Usage: %prog [flags] [values]") op.add_option("-t", "--target", dest="ip", default="uff", help="Set the target.") op.add_option("-p", '--ports', dest="ports", default="", help="Add specific ports: --ports 21,24,80") op.add_option("-n", "--min", dest="min", default=1, help="Set the minimum port for the range.") op.add_option("-x", "--max", dest="max", default=24, help="Set the maximum port for the range.") op.add_option("-r", "--norange", action="store_true", default=False, dest="norange", help="Do not use the range.") (o, argv) = op.parse_args() if o.ip == "uff": print("Set an Ip...") return -1 try: o.min = int(o.min) o.max = int(o.max) + 1 except: print("Wrong range.") return -1 o.ports = o.ports.split(",") portlist = [] for port in o.ports: try: portlist.append(int(port)) except: print("[-]{} is not a port.".format(port)) pass if o.norange: o.min = 0 o.max = 0 portlist += list(range(o.min, o.max)) for port in portlist: connect(o.ip, port)
def main(): with open("toki-english.json", "r") as f: content = loads(f.read()) op = opt("Usage: %prog [flags] [values]") op.add_option("-w", "--word", dest="word", default="", help="Select the word that you want to modify.") op.add_option("-v", "--values", dest="values", default="", help="Select the translations and separate them by commas.") op.add_option("-d", "--delete", dest="delete", action="store_true", default=False, help="Delete a word.") (o, argv) = op.parse_args() if o.word == "": print("You didn't define a word.") return 0 else: o.word = o.word.lower() if o.delete: try: del content[o.word] except KeyError: print("{} is not in the dictionary.".format(o.word)) return 0 else: if o.values != "": o.values = o.values.split(",") else: print("You didn't define values to add.") return 0 if o.word not in content: content[o.word] = [] for value in o.values: content[o.word].append(value) with open("toki-english.json", "w") as f: f.write(dumps(content, indent=4))
def main(): op = opt("Usage: %prog [flags] [values]") op.add_option("-t", "--target", dest="ip", default="127.0.0.1", help="Set target.") op.add_option("-p", "--print", dest="prnt", action="store_false", default=True, help="If you active this, the program will not print stuff.") op.add_option("-o", "--timeout", dest="timeout", default=5, type="int", help="Set time out. ") (o, argv) = op.parse_args() exploit(o.ip, o.prnt, o.timeout)
def main(): op = opt("Usage: %prog [flags] [values]") op.add_option("-u", "--user", dest="user", help="Set the user name of the FTP server.") op.add_option("-p", "--password", dest="passw", help="Set the password of the FTP server.") op.add_option( "-d", "--directory", dest="dir", default=".", help= "Set the local directory where are the files that you want to send.") op.add_option("-c", "--cwd", dest="cwd", default="/web/tarotgratis.best/public_html", help="Set the directory of the FTP server.") op.add_option("-s", "--server", dest="server", default="147.135.84.40", help="Set the FTP server.") (o, argv) = op.parse_args() chdir(o.dir) client = FTP(o.server) print("[+]Login into {}".format(o.server)) client.login(o.user, o.passw) client.cwd(o.cwd) cf = 0 print("[+]sending files") for file in listdir(): if isfile(file): send(file, client) cf += 1 print("[+]Total sent files in this directory: {}".format(cf))
def main(): print("[!]This program requires Netcat installed in your computer.") o = opt("Usage: %prog [flags] [values]") o.add_option("-t", "--target", dest="ip", help="Set target's ip.", default="127.0.0.1") o.add_option("-p", "--dontprint", action="store_false", dest="prnt", default=True, help="If you use this, signs will not be printed.") o.add_option("-d", "--dontdisconnect", action="store_false", dest="disc", default=True, help="Active this to stay connected to the ftp server.") (op, argv) = o.parse_args() exploit(op.ip, op.disc, op.prnt)
def main(): op = opt("Usage: %prog [flags] [values]") op.add_option("-i", "--inputFile", dest="inp", help="Set input file.") op.add_option("-o", "--outputFile", dest="out", help="Set the name of the output file.", default="{}.json".format(getDate())) (o, argv) = op.parse_args() words = loadList(o.inp) if words == -1: exit() jcontent = {"hashes": {}} #jcontent = json content for word in words: hash = md5(word.encode()).hexdigest() jcontent["hashes"][hash] = word try: with codecs.open(o.out, "w", encoding="utf-8") as jfile: jfile.write(dumps(jcontent, indent=4)) except Exception as e: print(e) exit() else: print("Done!")
import sys import clik import fondz import logging from optparse import make_option as opt version = '0.0.1' description = "create automated archival descriptions of digital content" app = clik.App('fondz', version=version, description=description) @app(usage="COLLECTION_NAME COLLECTION_DIR BAG1 [BAG2 ...]", opts=(opt('-o', '--overwrite', dest='overwrite', action='store_true', help='use an existing directory for the fondz project', default=False))) def create(args, opts, console): """ Create a new fondz project. Pass in a name for your collection, a directory to use for your fondz project, and the path(s) to one or more bag directories. % fondz create "Carl Sagan Collection" /vol/fondz/sagan /vol/bags/bag1 /vol/bags/bag2 """ if len(args) < 3: console.error( "You must supply a fondz directory path and at least one bag.")
def _writer(first_pass_data, output): with open(output, "w") as fh: for line in first_pass_data: fh.write(line) def _parser(input_file): with open(input_file, "r") as pass_analysis: first_pass_data = pass_analysis.readlines() return first_pass_data def _check_params(options): global _grayscale_pattern if options.out is None: options.out = options.input_file if options.gray_scale is None or _grayscale_pattern.match(options.gray_scale) is None: quit("ERROR:Grayscale seem to be of wrong format!") if __name__ == "__main__": prsr = opt() prsr.add_option("-i", "--input", dest="input_file", metavar="FILE", help="Input pass.analaysis to patch") prsr.add_option("-g", "--grayScale", dest="gray_scale", metavar="STRING", help="WITHIN QUOTATION: New grayscale to patch with EXAMPLE: \"\'grayscale_values\': [230.0, 206.0, 193.0, 177.0, 164.0, 151.0, 136.0, 126.0, 114.0, 103.0, 93.0, 83.0, 74.0, 65.0, 56.0, 49.0, 43.0, 35.0, 29.0, 25.0, 21.0, 19.0, 16.0]\"") prsr.add_option("-o", "--output", dest="out", metavar="FILE", help="Output file, overwrites old by default") options, args = prsr.parse_args() _check_params(options) patch(options.input_file, options.gray_scale, options.out)
""" Stops the thread. May be called from the REPL, for example. Also logs the given output string (if any) and saves the agent to file (iff PERSIST). """ self.running = False self.model.log(output_str) print(output_str) if __name__ == '__main__': """ This is the main drive for the intutive agent application. The agent thread (or another, depending on cmd line args) runs concurrently with the graph output. """ # Parse cmd line options opts = opt() opts.add_option('--bmark', action='store_true', dest='bmark', help='Run a benchmark session in the current context.') opts.add_option('--l1_train', action='store_true', dest='l1_train', help='Train layer one classifiers from current data sets.') opts.add_option('--nograph', action='store_true', dest='nograph', help='Runs without the graph display.') (options, args) = opts.parse_args() # Instantiate the agent (Note: agent shape is derived from input data)
state = WANT_ANY group_chan_type = chan_type or group_chan_type if channel_acc: finish_channel() ship() return exit_code if __name__ == '__main__': parser = OptionParser("""%prog [OPTIONS] PLUGINPATH [PLUGIN_CONFIG] Test a plugin by sending input and observing its output. """, [opt(None, "--py", action="store_true", help="If true, leave control to python, else start I/O repl"), opt(None, "--selftest", action="store_true", help="Run a basic selftest."), opt(None, "--test", action="store_true", help="Treat stdin as Input/ExpectedOutput pairings"), opt('-v', "--verbose", action="store_true", default=False, help="Print out additional info.") ]) parser.add_option('-D', action="append", dest="env", default=[], help="An environment variable assignment to pass along to the harness") parser.add_option('--id', dest='id', default='plugin', help="Supply the ID of the plugin; useful for servers.") parser.add_option("--couchdb", default="http://localhost:5984/", dest="couchdb", help="CouchDB holding configuration") amqpoptions = OptionGroup(parser, "AMQP connection parameters")
import os import sys from optparse import OptionParser as opt import numpy as np import pandas as pd import scanomatic.dataProcessing.norm as som_norm #Set the options that need to be set prsr = opt() prsr.add_option("-l", "--list", dest="list", metavar="FILE", help="List of dates to be analyzed. Format: DDMMYY") prsr.add_option("-i", "--input-path", dest="path", metavar="PATH", help="Path to projects") prsr.add_option("-g", "--random", dest="random", metavar="BOOL", default=True, help="Generate random position? [Default:%default]") prsr.add_option("-o", "--output-path", dest="out_path", metavar="PATH", help="output path") prsr.add_option("-r", "--row", dest="row", type="int", metavar="Int", help="Row") prsr.add_option("-c", "--col", dest="col", type="int", metavar="Int", help="Col") prsr.add_option("-p", "--plt", dest="plt", type="int", metavar="Int", help="Plate") prsr.add_option("-s", "--scan_no", dest="scan_no", metavar="Int", help="Scanner") # Get options (options, args) = prsr.parse_args() if options.random == "False": options.random = False def extract_curves(options, scan_dates): OUTPUT = [] for scan_date in scan_dates: scan_date = scan_date.rstrip() scan = "_scanner" + str(options.scan_no) project = os.path.join(options.path,(scan_date + scan), (scan_date + scan), "analysis", "curves_smooth.npy")
try: banner = sock.recv(1024).decode() print("Banner: {}\n".format(banner)) except: continue else: vbanners.append(banner.strip()) sock.close() return vbanners print("Se ha terminado el análisis de puertos.") if __name__ == '__main__': banner() op = opt("Uso: %prog [banderas] [valores]") op.add_option("-i", "--ip", dest="ip", default="none", help="Declarar la ip que se desea analizar.") op.add_option("-p", "--port", dest="port", default=-1, type="int", help="Añadir un puerto a la lista de puertos a analizar.") op.add_option("-m", "--min", dest="minimo", default=1,
from cipr.commands.cfg import CiprCfg class _Env(object): pass def _args(opts): env = _Env() env.base_dir = path.dirname(path.dirname(path.abspath(__file__))) env.skel_dir = path.join(env.base_dir, 'skel') env.code_dir = path.join(env.base_dir, 'code') env.project_directory = opts.project_directory env.package_dir = os.getenv('CIPR_PACKAGES', None) or path.join(env.project_directory, '.cipr/packages') env.dist_dir = path.join(env.project_directory, 'dist', 'Payload') env.build_dir = path.join(env.project_directory, 'build') return dict( env = env, ciprcfg = CiprCfg(path.join(env.project_directory, '.ciprcfg')) ) command = clik.App('cipr', version='0.8', description='Corona SDK package manager.', console_opts=True, conf_enabled=False, opts= opt('-d', '--project', dest='project_directory', default=path.abspath(os.getcwd()), help='Project directory' ), args_callback=_args )
from optparse import make_option as opt version = '0.0.1' description = "create automated archival descriptions of digital content" app = clik.App( 'fondz', version=version, description=description ) @app(usage="COLLECTION_NAME COLLECTION_DIR BAG1 [BAG2 ...]", opts=( opt('-o', '--overwrite', dest='overwrite', action='store_true', help='use an existing directory for the fondz project', default=False))) def create(args, opts, console): """ Create a new fondz project. Pass in a name for your collection, a directory to use for your fondz project, and the path(s) to one or more bag directories. % fondz create "Carl Sagan Collection" /vol/fondz/sagan /vol/bags/bag1 /vol/bags/bag2 """ if len(args) < 3: console.error("You must supply a fondz directory path and at least one bag.")
else: print 'Abort? Okaay.' #=================================================================================================== # Server Commands # ----------------------- # # The next commands deal directly with jobs on the server, and can be run from anywhere. # #=================================================================================================== #=================================================================================================== # server_list_jobs #=================================================================================================== re_option = opt('--re', help='pattern is a regular expression', default=False, action='store_true') list_jobs_opts = [ re_option, opt('-i', '--interactive', help='interactively remove or start them', default=False, action='store_true'), ] @app(alias='sv.ls', usage='<pattern> [options]', opts=list_jobs_opts) def server_list_jobs(args, global_config, opts, authenticate=False): ''' Lists the jobs whose name match a given pattern. :param bool authenticate: Flag used to notify Jenkins that authentication information must be requested to user. ''' import fnmatch if len(args) < 1:
def main(args=[]): op = opt("Usage: %prog [flags] [values]") op.add_option( "-k", "--keywords", dest="keywords", default=" ", type="string", help= "Introduce a list of keywords separeted by commas. exp: -k hello,world,1985 == ['hello', 'world', '1985']" ) op.add_option("-d", "--keywordsfile", dest="keywordsfile", default=0, type="string", help="Select a file with a list of keywords.") op.add_option( "-c", "--kwfile_codec", dest="codec", default="utf-8", help="Select a codec for your keyword file. (default is utf-8)") op.add_option("-o", "--dictionaryName", dest="filename", default="{}.txt".format(getDate()), help="Select a name for the output file.") op.add_option( "-n", "--min", dest="min", default=1, type="int", help= "Define the minimum number of combinations for each iteration. (predefined as 1)" ) op.add_option( "-m", "--max", dest="max", default=5, type="int", help= "Define the maximum number of combinations for each iteration. (predefined as 5)" ) op.add_option("-t", "--total", dest="total", default=-1, type="int", help="Break the password generator after X iterations.") op.add_option("-u", "--upper", dest="upper", default=False, action="store_true", help="Create extra passwords in upper case. [PASSWORD]") op.add_option("-l", "--lower", dest="lower", default=False, action="store_true", help="Create extra passwords in lower case. [password]") op.add_option( "-T", "--Title", dest="title", default=False, action="store_true", help="Create extra passwords starting with a capital letter. [Password]" ) op.add_option("-a", "--alphanumeric", dest="alpha", default=False, action="store_true", help="Create extra passwords in alpha numeric. [p455w0rd]") op.add_option( "-M", "--maxLen", dest="maxlen", default=-1, type="int", help= "Set the maximum length of the passwords. [-1 for not defined max len]" ) op.add_option( "-N", "--minLen", dest="minlen", default=-1, type="int", help= "Set the minumum length of the passwords. [-1 for not defined min len]" ) op.add_option( "-H", "--hash", dest="hash", default="NoNe", type="string", help="Append the hash of your password next to your password.") op.add_option("-L", "--listhashes", dest="listhashes", default=False, action="store_true", help="List all the hashes compatible with this script.") op.add_option("-p", "--print", dest="print", default=False, action="store_true", help="Print each iteration in the console.") (o, args) = op.parse_args() keywords = [] taco = PasswordGenerator(o.upper, o.lower, o.title, o.alpha, o.minlen, o.maxlen, o.hash, o.total) if o.listhashes: print("\n\n Hashes: \n\n") for hsh in taco.hashes: print(" > {}".format(hsh)) return 1 if o.keywordsfile != 0: result = readKWF(o.keywordsfile, o.codec) if result == -1: print("There was a problem opening the file.") return -1 keywords += result if o.keywords != " ": o.keywords = o.keywords.split(",") keywords += o.keywords if len(keywords) == 0: print("You must define some keywords...") return -2 print("Calculating ammount of passwords...") total_passwords = taco.calpass(len(keywords), o.min, o.max) print("Approximate ammount of passwords to generate: {}".format( total_passwords)) print("Starting to generate passwords at {}...".format(time("%H:%M:%S"))) for iterations in range(o.min, o.max + 1): if iterations == int(total_passwords * 0.25): print("\n25% DONE!\n") elif iterations == int(total_passwords * 0.50): print("\n50% DONE!\n") elif iterations == int(total_passwords * 0.75): print("\n75% DONE!\n") if taco.stop: print("We reached the limit!") break taco.generatePWords(keywords, iterations, o.print) if iterations + 1 == total_passwords: print("\n100% DONE!!!!!!!!!\n") print("Finishing at {}...".format(time("%H:%M:%S"))) print("Total ammout of passwords: {}".format(len(taco.passwordsList))) permuted_words = "\n".join(taco.passwordsList) with copen(o.filename, "w", o.codec) as writeOutput: if o.hash != "NoNe": writeOutput.write("# -*- Hash dictionary file: {}\n".format( o.hash)) writeOutput.write(permuted_words)
def main(): op = opt("Usage: %prog [flgas] [values]") op.add_option("-d", "--dns", dest="dns", default=0, help="Set the dns that you are investigating.") op.add_option("-s", "--save", action="store_true", dest="saveLog", default=False, help="Save all the information in a file.") op.add_option( "-f", "--filename", dest="fileName", default="{}.txt".format(getDate()), help="Set a the name of the file where the log is gonna be saved.") op.add_option("-n", "--doNotPrint", action="store_true", dest="doNotPrint", default=False, help="Use this flag if you don't want to print the output.") op.add_option("-0", "--dMX", dest="mx", action="store_false", default=True, help="Do not query MX records. (Mail Exchange)") op.add_option("-1", "--dA", dest="a", action="store_false", default=True, help="Do not query A records. (IPV4)") op.add_option("-2", "--dAAAA", dest="aaaa", action="store_false", default=True, help="Do not query AAAA records (IPV6)") op.add_option("-3", "--dNS", dest="ns", action="store_false", default=True, help="Do not query NS records (Name Service)") op.add_option("-4", "--dTXT", dest="txt", action="store_false", default=True, help="Do not query TXT records (Text records)") op.add_option( "-o", "--otherrecord", dest="otherrecord", default=0, help= "Set other records that you want to search. --otherrecord one,two,three..." ) (o, args) = op.parse_args() if not o.dns: if not o.doNotPrint: print("You didn't defined a dns.") exit() if o.dns[:4].lower() == "www.": o.dns = o.dns[5:] commands = { "MX": [o.mx], "A": [o.a], "AAAA": [o.aaaa], "NS": [o.ns], "TXT": [o.txt] } if o.otherrecord: o.otherrecord = o.otherrecord.split(",") for record in o.otherrecord: record = record.upper() commands[record] = [True] if o.saveLog: log = open(o.fileName, "w") for cmd in commands: text = "" try: if commands[cmd][0]: commands[cmd].append(resolver.query(o.dns, cmd)) else: continue except: text = "DNS response do not contain {}.".format(cmd) else: text = "{} query solved!".format(cmd) finally: if o.saveLog: log.write(text + "\n") if not o.doNotPrint: print(text) if not o.doNotPrint: print("\n" + "+" * 80 + "\n") for cmd in commands: if not commands[cmd][0]: continue responsetext = " DNS RESPONSE FOR {}:".format(cmd) if not o.doNotPrint: print("\n" + "-" * 80 + "\n") print(responsetext) if o.saveLog: log.write("\n" + "-" * 80 + "\n") log.write(responsetext + "\n") for info in commands[cmd][1]: infoText = "\n {}\n".format(info) if not o.doNotPrint: print(infoText) if o.saveLog: log.write("\n {}\n".format(info) + "\n") if o.saveLog: log.close()
msg = 'downloads directory does not exist, creating' log.info(msg) console.v(msg) os.mkdir(path) return {'downloads': path} downloader = clik.App('downloader', version='1.0', description='Manages downloads in a local directory.', console_opts=True, conf_enabled=True, conf_defaults={'downloader': {'path': DOWNLOADS_PATH}}, log_enabled=True, opts=opt('-d', '--downloads-dir', dest='downloads_directory', default=None, help=('Directory where downloads are stored ' '[default: '+DOWNLOADS_PATH+']')), args_callback=downloads_dir) @downloader(alias='ls') def list(downloads, console): """List the contents of the downloads directory.""" filenames = os.listdir(downloads) console.n('%i files in downloads' % len(filenames)) for filename in filenames: console.q(filename) return 0 @downloader(alias='rm', usage='[file1 [file2 [...]]] [options]')
def main(args=[]): op = opt("Usage: %prog [flags] [values]") op.add_option( "-d", "--dns", dest="dns", default=0, help="Set a DNS, or a DNS list (-d [dns] / -d dns1,dns2,dns3)") op.add_option("-s", "--save", action="store_true", dest="save", default=False, help="Save all the gathered info in a file.") op.add_option("-f", "--filename", dest="filename", default="{}.txt".format(getDate()), help="Set the file's name.") op.add_option( "-o", "--only", dest="only", default="all", help= "If you want to check just a few records, you should use --only record1,record2,record3" ) op.add_option( "-n", "--not", dest="no", default="", help= "If you don't want to check some records, you should use --not notThisrecord1,notThisrecord2" ) op.add_option( "-p", "--doNotPrint", action="store_false", dest="print", default=True, help= "Use this flag if you don't want to print the output in the console.") op.add_option( "-l", "--listRecords", action="store_true", dest="listRecords", help="Display a list with all DNS records and their functions.") op.add_option( "-u", "--dontcheckup", action="store_false", dest="checkup", default=True, help="Don't check if the DNS is up, this will speed up the program.") op.add_option("-w", "--whoislog", action="store_true", dest="whois", default=False, help="Get information from a whois query.") op.add_option("-v", "--whoislcmdlist", action="store_true", dest="whoiscmd", default=False, help="Display all whois commands.") op.add_option( "-c", "--whoiscommands", dest="onlywhois", default="all", help= "Select just a few whois commands, so the script don't print out every single one." ) op.add_option("-m", "--whoisnotcommands", dest="notwhois", default="", help="Avoid getting the output of some whois commands.") (o, args) = op.parse_args() print("\n\n\n") if not o.dns and not o.listRecords: print("You didn't define a DNS...") exit() if o.save: log = open(o.filename, "w") bnner = banner(p=False) log.write("{}\n".format(bnner)) o.only = o.only.upper() o.no = o.no.upper() only = o.only.split(",") no = o.no.split(",") if only[0] != "ALL": recordList = only else: recordList = loadRecords() o.dns = o.dns.lower() dnslist = o.dns.split(",") for dns in dnslist: if o.checkup or o.whois: try: whoislog = whois(dns) except: text = "\n\n** {} is not up.\n\n".format(dns) dnslist.remove(dns) continue else: text = "\n\n** {} is up.\n\n".format(dns) if o.whois: o.onlywhois = o.onlywhois.lower() wcmd = o.onlywhois.split(",") #wcmd = whois commands o.notwhois = o.notwhois.lower() nwcmd = o.notwhois.split(",") #nwcmd = not whois commands if wcmd[0] == "all": whoislist = list(whoislog) else: whoislist = wcmd for info in whoislist: if info in nwcmd: continue wtext = " * {}:\n -{}".format(info, whoislog[info]) if o.print: print(wtext) if o.save: log.write("{}\n".format(wtext)) finally: if o.print: print(text) if o.save: log.write("{}\n".format(text)) if dns[:4] == "www.": dnslist[dnslist.index(dns)] = dns[4:] dns = dns[4:] if o.listRecords: text = "" for record in recordList: if record in no: continue text += "{} - {}\n".format(record, RECORDS[record]) print(text) if o.save: log.write("\n{}".format(text)) if o.whoiscmd: text = "\n\n\n- Whois Commands:\n" for cmd in WHOISCMD: text += " **{}\n".format(cmd) if o.print: print(text) if o.save: log.write(text) else: anscount = 0 for dns in dnslist: text = "\n\n**** Starting analysis on {}\n\n".format(dns) if o.print: print(text) if o.save: log.write("\n{}\n".format(text)) for record in recordList: if record in no: continue try: query = resolver.query(dns, record) except: text = "-" * 40 text += "\n {} did not answared.".format(record) else: text = getText(query, record) anscount += 1 if o.print: print(text) if o.save: log.write(text + "\n") text = "\n\n\n|||| {} records answared.".format(anscount) if anscount == 0: if recordList == ["", ""]: text += "\n -Maybe you should add some records to the list." else: text += "\n - Check your internet connection." text += "\n - Check if the DNS is up." elif anscount == len(recordList): text += "\n - Nice, every single records answared!!!!!" if o.print: print(text) if o.save: log.write(text + "\n") if o.save: log.close()
def main(): op = opt("Usage: %prog [flgas] [values]") op.add_option( "-p", "--dontprint", action="store_false", dest="print", default=True, help="Use this flag if you want to print what the program is doing.") op.add_option("-P", "--printAlgorithms", action="store_true", dest="sa", default=False, help="Use this flag to show all the algorithms available.") op.add_option( "-c", "--create", action="store_true", dest="create", default=False, help="Use this flag if you want to create a Rainbow dictionary.") op.add_option( "-s", "--search", action="store_true", dest="search", default=False, help= "Use this flag if you want to search a hash in a Rainbow dictionary.") op.add_option( "-i", "--inputFile", dest="input", default="undefined", help= "Set input file, it must contain a list with the words that you want to put in your RD. (if you are using --create)" ) op.add_option( "-a", "--algorithm", dest="algorithm", default="md5", help= "Set what algortihm is goint to be used to create the RDs(md5 by default) (if you are using --create)" ) op.add_option( "-o", "--outputFile", dest="output", default="{}.json".format(getDate()), help= "Set output file, it will contain your RD. (if you are using --create)" ) op.add_option( "-r", "--rainbowDic", dest="rd", default="undefined", help= "Set the RD that you want to search in. (if you are using --search)") op.add_option( "-H", "--hash", dest="hash", default="undefined", help= "Define a single hash that you want to search. (if you are using --search)" ) op.add_option( "-d", "--hashlist", dest="hashlist", default="undefined", help="Set a list of hashes to search. (if you are using --search)") op.add_option("-l", "--log", action="store_true", dest="log", default=False, help="Save a found hashes log. (if you are using --search)") op.add_option( "-n", "--logname", dest="logname", default="{}.txt".format(getDate()), help="Put a name to your log. (if you are using --search and --log)") (o, argv) = op.parse_args() if o.sa: printAlgs() #handle errors ↓ if o.create and o.search: print("You can't use --create and --search.") exit() elif not o.create and not o.search: print("You have to use --create or --search.") exit() if o.create and o.input == "undefined": print("Input file: {}\nOutput file: {}".format(o.input, o.output)) exit() if o.search and (o.rd == "undefined" or (o.hash == "undefined" and o.hashlist == "undefined")): print("RD: {}\nHash: {}\nHash list: {}".format(o.rd, o.hash, o.hashlist)) exit() if o.algorithm not in ALGORITHMS: print("{} not found in algorithm list.".format(o.algorithm)) printAlgs() exit() #handle error ↑ er = EvilRainbow(o.print) if o.create: er.create(o.input, o.output, o.algorithm) else: if o.hashlist == "undefined": hashes = [o.hash] else: hashes = loadFile(o.hashlist, split=True) hashes.append(o.hash) er.search(hashes, o.rd, o.log, o.logname) if o.print: print("Done!")
def main(args): op = opt("Usage: %prog [options] [values]") op.add_option("-H", "--hash", dest="hash", default="", type="string", help="Set the hash that you want to break.") op.add_option("-d", "--dictionary", dest="dfile", default="", type="string", help="Set the file that contains all the hashes.") op.add_option( "-f", "--hashfunction", dest="function", default="unknown", type="string", help="Set the hash function name that you are attacking. [exp: md5]") op.add_option( "-k", "--continueanyway", dest="cont", default=False, action="store_true", help= "Continue attacking the hash even tho if it is not the same hash function." ) op.add_option("-c", "--copyValue", dest="copy", default=False, action="store_true", help="If the hash value is found, copy it.") (o, args) = op.parse_args() if o.hash == "": print("You must define a hash...") return -1 if o.dfile == "": print("You must define a dictionary file.") return -2 else: content = loadContent(o.dfile, o.function, o.cont) if content == -1: print("The file do not exist.") return -3 elif content == -2: print("The file is not a hash dictionary.") return -4 elif content == -3: print("The hash function do not coincide.") if not o.cont: return -5 print("Starting to search hash...") if o.hash in content: print("The Hash value was found!!!!") print("Hash: {}".format(o.hash)) print("Value: {}".format(content[o.hash])) if o.copy: copy(content[o.hash]) else: print("The hash was not found in the file :(")
import clik from os import path import os from optparse import make_option as opt from cipr.commands.cfg import CiprCfg from cipr.commands import env def _args(opts): env.project_directory = opts.project_directory return dict( env = env, ciprcfg = CiprCfg(path.join(env.project_directory, '.ciprcfg')) ) command = clik.App('cipr', version='0.8', description='Corona SDK package manager.', console_opts=True, conf_enabled=False, opts= opt('-d', '--project', dest='project_directory', default=path.abspath(os.getcwd()), help='Project directory' ), args_callback=_args )