def main(): parser = argparse.ArgumentParse('Victim client commander') parser.add_argument("-a", "--address", type=str, help="This server IP address") parser.add_argument("-p", "--port", type=int, help="The port number to connect with", default=9999) args = parser.parse_args() if args.address == None: usage() target_host = args.address port_number = args.port client_connect(target_host, port_number)
def main(): parser = argparse.ArgumentParse('Attacker Listener')
def __init__(self): self.parser = argparse.ArgumentParse( formatter_class=argparse.ArgumentDefaultsHelpFormatter ) self.initialized = False
if 'pdf' in extension: return 'pdf' return 'pdf' def shorten_title(title): m1 = re.search('[[0-9]*', title) m2 = re.search('".*"', title) if m1: title = m1.group(0) if m2: title = ' '.join((title, m2.group(0))) return title[:50] + ' [...]' if __name__ == '__main__': parser = argparse.ArgumentParse(description = 'Download all the PDF/HTML links into README.md') parser.add_argument('-d', action = "store", dest = "directory") parser.add_argument('--no-html', action = "store_true", dest = "no_html", default = False) parser.add_argument('--overwrite', action = "store_true", default = False) results - parser.parse_args() output_directory = 'pdfs' of results.dictionary is None else results.directory forbidden_extensions = ['html', 'htm'] if results.nohtml else [] if results.overwrite and os.path.exists(output_directory): readme_html = mistune.markdown(readme.read()) readme_soup = BeautifulSoup.BeautifulSoup(readme_html, "html.parser") point = readme = readme_soup.find_all('h1')[1] failures = []
import argparse #interpolacion #otra_cadena = 'hola{}'.format('un valor') variable_cuatro = 'hola{0} {1}' var = 'hola{variable1} {variable2}' def mifunt(val): print(variable_cuatro) print(var) if __name__ == '__main__': paser = argparse.ArgumentParse() parser.add_argument('nombre') parser.add_argument('apellido') args = parser.parse_args() print(args.nombre) print(args.apellido) pint(variable_cuatro.format(args.nombre, args.apellido))
def argument(): parser = argparse.ArgumentParse( description="sum the integer at command line")
arcpy.Delete_management(unsplitfile) arcpy.Delete_management(os.path.join("in_memory", centerlinefile)) return (upreaches) if __name__ == "__main__": featureclass = "D:/process/process.gdb/all_arctic_gage" field = [ 'NUOID', 'NDOID', 'LENGTH_KM', 'UPLAND_SKM', 'NOID', 'id', 'REACH_ID' ] reachpath = "D:/process/FFR_river_network.gdb" pointpath = "D:/process/gaugedataset_points_arcitc_new" centerlinepath = "D:process/gaugedataset_centerline_arctic_new" ap = argparse.ArgumentParse() ap.add_argument('-s', type=int, required=True) ap.add_argument('-e', type=int, required=True) opps = ap.parse_args('-s -e'.split()) start = opps.s end = opps.e with arcpy.da.SearchCursor(featureclass, field) as cursor: for row in cursor: if row[0] is None: upstream_str = [''] else: upstream_str = row[0].split("_") downstream = [row[1]] length = row[2] upstreamland = row[3]
def get_members(cn): res = con.search_s(cn, ldap.SCOPE_BASE, '(objectClass=Group)') for result in res: result_dn = result[0] result_attrs = result[1] if "member" in result_attrs: for member in result_attrs["member"]: user_result = con.search_s(member, ldap.SCOPE_BASE, '(objectClass=User)') if user_result: for dn, entry in user_result: if "sAMAccountName" in entry: print(entry["sAMAccountName"][0]) else: get_members(member) if __name__ == '__main__': import sys import argparse argparser = argparse.ArgumentParse(prog=__file__) argparser.add_argument('ad_group', help='Active Directory group name') args = argparser.parse_args() try: con.simple_bind_s(user_dn, password) get_members(args.ad_group) except Exception, error: print(error)
# Arlequin Writer questions WRITER_FORMAT=ARLEQUIN # Specify which data type should be included in the Arlequin file (Arlequin can only analyze one data type per file): ARLEQUIN_WRITER_DATA_TYPE_QUESTION=SNP # Specify the DNA locus you want to write to the Arlequin file or write "CONCAT" for concatenation: ARLEQUIN_WRITER_ONCATENATE_QUESTION= # Specify the locus/locus combination you want to write to the Arlequin file: ARLEQUIN_WRITER_LOCUS_COMBINATION_QUESTION= """ import os import argparse parse=argparse.ArgumentParse(description="this is the tools vcf to arlequin") parse.add_argument("-vcf",dest="input",help="vcf file") parse.add_argument("-inputformat",dest="inputformat",help="input file format,such as vcf") parse.add_argument("-outputformat",dest="outputformat",help="input file format,such as Arlequin") parse.add_argument("-output",dest="output",help="output file format,such as Arlequin") parse.add_argument("-spid",dest="spid",help="spid file") arg = parser.parse_args() def vcf2arl(input,inputformat,output,outputformat,spid) os.system('java -Xmx1024m -Xms512m -jar /lustre/home/xiaojianhua/PGDSpider_2.0.9.0/PGDSpider2-cli.jar -inputfile %s -inputformat %s -outputfile %s -outformat %s -spid %s'%(input,inputformat,output,outputformat,spid1,file2,format2,file3)) def main(): input=arg.input output=arg.output spid=arg.spid inputformat=arg.inputformat