コード例 #1
0
ファイル: capita.py プロジェクト: xnacly1/scripts
def main():
    s("cls")
    print("""
CAPITA -- v0.1 alpha

-- commands -- 
key     -> get a key
encrypt -> a file
decrypt -> a file

--------------------
	""")
    inputcommand = input("command: >> ")

    if inputcommand == "key":
        key()
    elif inputcommand == "encrypt":
        inputkey = input("key: >> ")
        encrFile(inputkey)
    elif inputcommand == "decrypt":
        inputkey = input("key: >> ")
        decrFile(inputkey)
    else:
        print("command isn't definded")
        ß(2)
        main()
コード例 #2
0
ファイル: athanasius.py プロジェクト: shyam999/Athanasius
def mail_bomber():
    s("clear")
    print(logo + fa.BOLD)
    print(fa.BOLD + """\n
                    +========================================+
                    |..........[◉] Email Bomber [◉]..........|
                    +========================================+\n\n""")
    to = input('\n[◉] Target Mail address : ')
    user = input('\n[◉] Sender Email : ')
    passwd = getpass.getpass('\n[◉] Password : '******'Subject: ')
    body = input('\n[◉] Message : ')
    total = input('\n[◉] Number of send : ')
    try:
        server = smtplib.SMTP("smtp.gmail.com", 587)
        server.ehlo()
        server.starttls()
        server.login(user, passwd)
        for i in range(1, total + 1):
            subject = os.urandom(9)
            msg = 'From: ' + user + '\nSubject: ' + subject + '\n' + body
            server.sendmail(user, to, msg)
            print("\r[✔] E-mails sent: %i" % i)
            sys.stdout.flush()
            server.quit()
            print('\n[✔] Done [✔] !!!')
    except smtplib.SMTPServerDisconnected:
        server
    except smtplib.SMTPAuthenticationError:
        print('\n[✘] The username or password you entered is incorrect.')
        sys.exit()
コード例 #3
0
ファイル: main.py プロジェクト: hanter-ultra/BotikTelegram
def formater(message):
    if message.document:
        if message.document.file_name.endswith('.py'):
            doc = bot.get_file(message.document.file_id)
            path = bot.download_file(doc.file_path)

            with open(f'loaded{message.chat.id}.py', 'wb') as file:
                file.write(path)
            file.close()
            sender(message.chat.id, 'Файл загружен! Идет обработка...')

            s(f'yapf -i loaded{message.chat.id}.py')
            sender(message.chat.id, 'Держи свой конфет!)')

            file = open(f'loaded{message.chat.id}.py', 'rb')
            bot.send_document(message.chat.id, file)
            file.close()
            s(f'del loaded{message.chat.id}.py')
        else:
            sender(message.chat.id,
                   'Отправь документ Python. Другой вид я не форматирую.')
        need_format = False
    else:
        sender(message.chat.id, 'Что-то пошло не так(')
    need_format = False
コード例 #4
0
 def __init__(self):
     source = ap(
         description='¡Genera los valores exactos para algunas particiones!'
     )
     nope = source.add_mutually_exclusive_group()
     source.add_argument('M', type=int, help="Tamaño disponible")
     source.add_argument('-X',
                         type=float,
                         help="1° Porcentaje a calcular",
                         nargs='?',
                         const=16,
                         default=16)
     source.add_argument('-Y',
                         type=float,
                         help="2° Porcentaje a calcular",
                         nargs='?',
                         const=84,
                         default=84)
     source.add_argument('-A',
                         type=float,
                         help="3° Porcentaje a calcular",
                         nargs='?',
                         const=32,
                         default=32)
     source.add_argument('-B',
                         type=float,
                         help="4° Porcentaje a calcular",
                         nargs='?',
                         const=68,
                         default=68)
     source.add_argument('-R',
                         type=int,
                         help="Memoria RAM",
                         nargs='?',
                         const=0,
                         default=0)
     source.add_argument('-E',
                         type=int,
                         help="Tamaño de la partición EFI",
                         nargs='?',
                         const=261,
                         default=261)
     source.add_argument('-L',
                         type=int,
                         help="Espacio vacío al final del disco",
                         nargs='?',
                         const=1,
                         default=1)
     nope.add_argument(
         '-MB',
         help="Tipo de Unidad para medir el tamaño disponible",
         action="store_true")
     nope.add_argument(
         '-GB',
         help="Tipo de Unidad para medir el tamaño disponible",
         action="store_true")
     Values = self.Values()
     s("clear")
     print Values.linux(source.parse_args(), self.Funcs)
     print Values.windows(source.parse_args(), self.Funcs)
コード例 #5
0
def doAll(data):
	currentCombination, size, noUsingCell = data
	names = {}  #for cell line to save filename to make combinations
	cellsToWorkWith = []
	for cell in combinations[currentCombination]:
		if cell != noUsingCell:
			cellsToWorkWith.append(cell)
	
	for cell in cellsToWorkWith:
		currentNoHistone = []
		f = open(mainFolder+"/"+cell+"/"+size+"/all_sorted.tsv","r")
		header = f.readline()[:-1].split("\t")
		f.close()
		positionOfMark = []
		marks = currentCombination.split("_")
		for mark in marks:
			cont = 0
			for h in header:
				if mark+".tsv_" in h:
					positionOfMark.append(cont)
				cont += 1
		f = open(mainFolder+"/"+cell+"/"+size+"/all_sorted.tsv","r")
		for line in f:
			line = line[:-1].split("\t")
			toPrint = ""
			for i in range(len(line)):
				if i not in positionOfMark:
					toPrint+=line[i]+"\t"
			toPrint = toPrint[:-1] #for the last \t

			s("echo "+toPrint+" >> "+mainFolder+"/"+cell+"/"+size+"/no_"+currentCombination+"_noCell_"+noUsingCell+"_noSortedForK562val.tsv")
		f.close()
		name = mainFolder+"/"+cell+"/"+size+"/no_"+currentCombination+"_noCell_"+noUsingCell+"_noSortedForK562val.tsv"
		s("sort -ur --temporary-directory=./temp "+name+" > "+mainFolder+"/"+cell+"/"+size+"/no_"+currentCombination+"_sorted.tsv")
コード例 #6
0
ファイル: athanasius.py プロジェクト: shyam999/Athanasius
    def __init__(self):
        s('clear')
        print(logo + fa.BOLD + '''\n
        [0] Info Gathering                               [1] Password Attack
        [2] Nmap Scripts                                 [3] Generate Wordlist
        [4] Mail Bombing                                 [5] Spoofing Attack
        [6] SQL Attacks                                  [7] Xss Attacks\n
        ''' + fa.RED + '''[99] Exit \n''' + fa.END)

        choice = input(Prompt)

        if choice == "0":
            InfoGathering()
        elif choice == "1":
            PasswordAttacks()
        elif choice == "2":
            NmapScripts()
        elif choice == "3":
            cupp()
        elif choice == "4":
            mail_bomber()
        elif choice == "5":
            Spoofing()
        elif choice == "6":
            print(fa.RED + "\ncoming soon\n" + fa.END)
        elif choice == "7":
            XssAttack()
        elif choice == "99":
            exit()
        else:
            try:
                print(os.system(choice))
            except:
                pass
コード例 #7
0
ファイル: athanasius.py プロジェクト: shyam999/Athanasius
 def __init__(self):
     s('clear')
     print(logo + fa.BOLD + '''\n\n
     [0] Ping Scan                                    [1] Quick Scan
     [2] Quick Scan Plus                              [3] Quick Traceroute
     [4] Intense Scan                                 [5] Intense scan(all ports)\n
     ''' + fa.YELLOW + '''[99] Return To Main Menu \n''' + fa.END)
     self.choose_scan()
コード例 #8
0
ファイル: capita.py プロジェクト: xnacly1/scripts
def key():
    key = Fernet.generate_key()
    f = open("key.CAPITA", "wb")
    f.write(key)
    f.close()
    s("cls")
    print("wrote key to key.Capita file, save it somewhere else")
    ß(3)
    main()
コード例 #9
0
def change_names(path, old_name_s, old_name_e, new_name_s, new_name_e):
    for i in range(1, 99999):
        file_old = path + old_name_s + str(i) + old_name_e
        if os.path.isfile(file_old):
            file_new = path + new_name_s + str(i) + new_name_e
            s('cp ' + file_old + ' ' + file_new)
        else:
            break
    return 0
コード例 #10
0
ファイル: athanasius.py プロジェクト: shyam999/Athanasius
 def __init__(self):
     s('clear')
     print(logo + fa.BOLD + '''\n
     [0] Cisco Brute Force                           [1] VNC Brute Force
     [2] FTP Brute Force                             [3] Gmail Brute Force
     [4] SSH Brute Force                             [5] Telnet Brute Force
     [6] YahooMail Brute Force                       [7] HotMail Brute Force
     [8] RDP Brute Force                             [9] MySQL Brute Force\n
     ''' + fa.YELLOW + '''[99] Return To Main Menu \n''' + fa.END)
     self.choose_attack()
コード例 #11
0
def resizelvm():
    print(" Resize a LVM \n")
    lvm_to_resize = input(" Enter the lvm name to resize : ")
    size = input(
        " Enter the size , For exapmle if you want to increase the size of 1 GB input +1G or to decrease the size of 1GB input -1G : "
    )
    s("lvresize --size {} {}".format(size, lvm_to_resize))
    print("\n")
    s("lvdisplay -C")
    print("\n")
コード例 #12
0
 def test_update_config_writes_an_expected_file(self):
     self.being_tested.config = {'attr1': 'value1', 'attr2': 'value2', 'attrN': 'valueN'}
     self.being_tested.update_config()
     with open(self.file_name, 'r') as f:
         md5_of_config_file = hashlib.md5()
         md5_of_config_file.update(f.read())
         md5_of_expected_text = hashlib.md5()
         md5_of_expected_text.update('attrN=valueN\nattr2=value2\nattr1=value1\n')
         self.assertEqual(md5_of_config_file.digest(), md5_of_expected_text.digest())
     s('rm ' + self.file_name)
コード例 #13
0
ファイル: main.py プロジェクト: hanter-ultra/BotikTelegram
def screen(message):
    if message.chat.id == chat_id_1 or message.chat.id == chat_id_2:
        try:
            scr('screenshot.jpeg')
            file = open('screenshot.jpeg', 'rb')
            send_photo(message.chat.id, file)
            file.close()
            s('del screenshot.jpeg')
        except:
            sender(message.chat.id, 'Error!')
コード例 #14
0
def doAll(folder):
	files = glob(folder+"/*.tsv")
	command = "cat "
	for f in files:
		command+=f+"\t"
	command = command[:-1]+" > "+folder+"/all_no_sorted.tsv"
	s(command)

	command = "sort -ur --temporary-directory=./temp "+folder+"/all_no_sorted.tsv > "+folder+"/all_sorted.tsv"
	s(command)
コード例 #15
0
ファイル: athanasius.py プロジェクト: shyam999/Athanasius
 def __init__(self):
     s('clear')
     print(logo + fa.BOLD + '''\n\n
     [0] Cross Site Request Forgery                      [1] Smb_ms17_o10
     [2] Dns Brutforce                                   [3] Firewall Bypass
     [4] Smb_ms08_067                                    [5] Smb_ms07_029
     [6] Rdp_ms12_020                                    [7] Ssl-heartbleed
     [8] Mysql dump hashes                               [9] Smtp-enum-users
     [10] Smb Brutforce                                  [11] Wordpress Brutforce\n
     ''' + fa.YELLOW + '''[99] Return To Main Menu \n''' + fa.END)
     self.choose_scan()
コード例 #16
0
def download(data):
    #	print(data)
    folder = data[6] + "/" + data[4] + "/" + data[18]
    try:
        os.makedirs(folder)
    except:
        pass
    toDown = data[42]
    nameDown = data[42].split("/")[-1]
    s("wget " + toDown + " -P " + folder)
    s("gunzip " + folder + "/" + nameDown)
コード例 #17
0
def change_coord_swarp(fits_in, fits_ou):
    """
    change the coordinate of fits image using swarp
    :param list_img:
    :param fits_ou:
    :return:
    """
    s('swarp ' + fits_in + \
      ' -COMBINE N -IMAGEOUT_NAME ' + fits_ou + \
      ' -CELESTIAL_TYPE GALACTIC -PROJECTION_TYPE CAR -SUBTRACT_BACK N' + \
      ' -COPY_KEYWORDS TELESCOP,MWAVER,MWADATE,BTYPE,BUNIT,BMAJ,BMIN,BPA,FREQ' + \
      ' -MEM_MAX 1024 -COMBINE_BUFSIZE 1024 -XML_NAME swarp.xml')
コード例 #18
0
ファイル: cat_copy_xml.py プロジェクト: genie9/tmt
def cat_copy(line) :
    line =  line.strip()
    arx_id, path = line.split(',')

    if path.rfind('.xml') == -1 :
        do_cat = 'cat '+path+'/*.xml >> '+a_dir + arx_id+'.xml'
        s(do_cat)
        print '{} catenated'.format(arx_id)
    else :
        do_cp = 'cp ' + path + ' ' + a_dir
        s(do_cp)
        print '{} copied'.format(arx_id)
コード例 #19
0
def change_beam_convol_miriad(fits_in, fits_ou, fits_tp=None, bmaj=None, bmin=None, bpa=None):
# def change_beam_convol_miriad(fits_in, fits_ou, fits_tp=None):
    """
    change the beam size of a fits image using convol from miriad
    this also changed the pixel size, the pixel size in the output fits image is the same with that in the input fits file
    WARNING: Convol does not do a very good job with masked images
    :param fits_in: the input fits image file
    :param fits_ou: the output fits image file with beam changed
    :param fits_tp: the template fits image file for providing the beam information
    :param bmaj: the BMAJ for the output image if fits_tp=None; arcsec
    :param bmin: the BMIN for the output image if fits_tp=None; arcsec
    :param bpa: the BPA for the output image if fits_tp=None; deg
    :return: 0
    """
    # read the beam from the template fits file
    if fits_tp != None:
        fits_tem_open=fits.open(fits_tp)
        fits_tem_head = fits_tem_open[0].header
        bmaj = str(fits_tem_head['BMAJ']*3600.)  # arcsec
        bmin = str(fits_tem_head['BMIN']*3600.)  # arcsec
        bpa = str(fits_tem_head['BPA'])  # deg

    # do the convert
    s('fits op=xyin in=' + fits_in + ' out=$HOME/fits_in.im')
    s('convol map=$HOME/fits_in.im fwhm='+str(bmaj)+','+str(bmin)+' pa='+str(bpa)+' out=$HOME/fits_ou.im options="final"')
    s('fits op=xyout in=$HOME/fits_ou.im out='+fits_ou)
    s('rm -r $HOME/fits_in.im $HOME/fits_ou.im')

    return 0
コード例 #20
0
def main(stdscr):
    c.curs_set(0)
    c.init_pair(1, c.COLOR_RED, c.COLOR_BLACK)
    c.init_pair(2, c.COLOR_YELLOW, c.COLOR_BLACK)
    c.init_pair(3, c.COLOR_GREEN, c.COLOR_BLACK)
    c.init_pair(4, c.COLOR_WHITE, c.COLOR_BLACK)
    while (1):
        y, x = stdscr.getmaxyx()
        s(command)
        file = open(".meminf.log", "r+")
        file = file.readlines()
        #getting the data from meminf.log
        totalmem = int(file[0].split()[1])
        usedmem = totalmem - int(file[2].split()[1])
        #prc is the percentage of used memory
        prc = round((usedmem * 100) / totalmem, 1)
        prc = "%" + str(prc)
        barlen = (usedmem * 20) // totalmem
        #converting kilobyte to gigabyte
        usedmem = round(usedmem / pow(1024, 2), 1)
        totalmem = round(totalmem / pow(1024, 2), 1)
        using = str(usedmem) + "/" + str(totalmem) + "GB"
        #ulen is the half of the length of using why? bc if i wrote it in addstr it will look crazy long
        ulen = len(using) // 2
        #I used square because it gives bar a vibe
        bar = "["
        #creating the bar according to memory usage
        for i in range(barlen):
            bar += "█"
        for i in range(20 - barlen):
            bar += " "
        bar += "]"
        #change the color pair according to memory usage
        if barlen < 5:
            color = c.color_pair(4)
        if barlen > 5:
            color = c.color_pair(3)
        if barlen > 10:
            color = c.color_pair(2)
        if barlen > 15:
            color = c.color_pair(1)


#the part that we writing our bar and percentage
        stdscr.addstr(y // 2, x // 2 - 11, bar, color)
        stdscr.addstr(y // 2 - 1, x // 2 - len(prc) // 2, prc, color)
        stdscr.addstr(y // 2 + 1, x // 2 - ulen, using, c.color_pair(4))
        stdscr.refresh()
        stdscr.clear()
コード例 #21
0
    def __init__(self):
        s('clear')
        print(logo)
        self.installDir = toolDir + "setoolkit"
        self.gitRepo = "https://github.com/trustedsec/social-engineer-toolkit.git"

        if not self.installed():
            os.system("apt-get --force-yes -y install git apache2 python-requests libapache2-mod-php \
                python-pymssql build-essential python-pexpect python-pefile python-crypto python-openssl")
            os.system("git clone --depth=1 %s %s" % (self.gitRepo, self.installDir))
            os.system("cd %s && python setup.py install" % self.installDir)
            self.run()
        else:
            print("alreadyInstalled")
            self.run()
コード例 #22
0
ファイル: main.py プロジェクト: hanter-ultra/BotikTelegram
def camera(message):
    if message.chat.id == chat_id_1 or message.chat.id == chat_id_2:
        cap = cv2.VideoCapture(0)

        for i in range(30):
            cap.read()

        ret, frame = cap.read()

        cv2.imwrite('cam.jpg', frame)
        cap.release()

        with open('cam.jpg', 'rb') as img:
            bot.send_photo(message.chat.id, img)

        s('del cam.jpg')
コード例 #23
0
ファイル: capita.py プロジェクト: xnacly1/scripts
def decrFile(key):
    filename = input("FileName or FileLocation (with ending): >> ")
    f = open(filename)
    content = f.read()
    f.close()

    contentenc = content.encode()
    F = Fernet(key)
    endfile = F.decrypt(contentenc)

    f = open(filename.strip(".CAPITA"), "w")
    f.write(endfile.decode())
    f.close()
    s("cls")
    print("decrFile success")
    ß(3)
    main()
コード例 #24
0
ファイル: main.py プロジェクト: sinthy08/Ramzi-s-Programming
def main():
	def readCSV():
		fileName='thoughts.csv'
		with open(fileName) as csvfile:
			readCSV = csv.reader(csvfile, delimiter='\n')
			finished=[]
			for row in readCSV:
				finished.append(row)
		return finished

	while True:
		file = readCSV()
		randIndex = r(0, (len(file)-1))
		s('cls')
		if input("Do you want to think some more? ") == "y":
			print(file[randIndex][0])
			playsound("music.mp3")
コード例 #25
0
def rsync_rm():
    from os import system as s

    try:
        rsync = "rsync -av %s/ %s" % (datebackuppath, corepath)
        s(rsync)
    except Exception as e:
        message = "Failed to rsync folders %s with %s.  Error: %s" % (corepath, datebackuppath, e)
        logger.error(message)
        try:
            send_email(message, configData, True)
        except Exception as e:
            message = "Failed to send Auditor report email.  Error: %s" % e
            logger.error(message)
    try:
        remove = "rm -r %s" % datebackuppath
        s(remove)
    except Exception as e:
        message = "Failed to remove dated folder.  Error: %s" % e
        logger.error(message)
コード例 #26
0
def download_ads_bibcode(bibcode):
    link = 'http://adsabs.harvard.edu/cgi-bin/nph-bib_query?bibcode=' + bibcode + '\&data_type=BIBTEX\&db_key=AST\&nocookieset=1'
    s('wget -O /Users/hongquansu/Downloads/bib.html ' + link)

    # get first author
    with open('/Users/hongquansu/Downloads/bib.html') as f0:
        for i, line in enumerate(f0):
            if i == 6:
                author_name = line.split('{{')[1].split('}')[0]
                break

    # write bibcode to bibtex file
    with open('/Users/hongquansu/Downloads/bib.html') as f1:
        with open('/Users/hongquansu/Dropbox/references/bibtex.bib',
                  'aw') as f2:
            for i, line in enumerate(f1):
                if i == 5:
                    line5_split = line.split('{')
                    line5_add_name = line5_split[
                        0] + '{' + author_name + line5_split[1]
                    f2.write(line5_add_name)
                elif i > 5:
                    f2.write(line)
コード例 #27
0
    folders = glob("../02*/CTCF/*/*/")
    for folder in folders:
        aux = folder.split("/")
        cell = aux[-3]
        size = int(aux[-2])
        Class = "CTCF"
        command = "python3.6 00_doFullVectors.py -f " + folder + " -n 4 -C " + Class + " "
        if size != 150:
            if size < 1000:
                sizeToUse = str(int(finalSize2 / size))
                command += "-lv " + sizeToUse + " -rv " + sizeToUse
            else:
                sizeToUse = str(int(finalSize1 / size))
                command += "-lv " + sizeToUse + " -rv " + sizeToUse

            command += " -o ./" + cell + "/" + str(size) + "/ "
            command += " -fl "

            file0 = open(glob(folder + "/*.tsv")[0], "r")
            cont = 0
            dataToUse = ""
            for line in file0:
                if cont == 0:
                    dataToUse = line[:-1].split("\t")
                    cont = 1
            for use in dataToUse:
                if use != Class:
                    command += use + " "

            s(command)
コード例 #28
0
ファイル: createdata.py プロジェクト: PiscesDream/Ideas
def openrandom_player():
    s('python random_player.py')
コード例 #29
0
ファイル: createdata.py プロジェクト: PiscesDream/Ideas
def openserver():
    s('python server.py')
コード例 #30
0
ファイル: gajimtwitter.py プロジェクト: holizz/holizz.com
#!/usr/bin/env python
#
# Copyright (c) 2008 Tom Adams
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.

from xml.etree import ElementTree
from urllib2 import urlopen
from os import system as s
u = 'http://twitter.com/statuses/user_timeline.xml?count=1&id=' + 'holizz'
m = ElementTree.XML(urlopen(u).read()).find('status').find('text').text
s('gajim-remote change_status `gajim-remote get_status` "%s"'%m.encode('utf8'))
コード例 #31
0
ファイル: Main_COP.py プロジェクト: hantke/Read_Eagle
for gr in range(len(Index_Range)):
    for sgr in range(len(Index_Range[gr])):
        #IDs = (Mass_St[Index_Range[gr][sgr][0]:Index_Range[gr][sgr][1]])
        Mstell = np.sum(
            Mass_St[Index_Range[gr][sgr][0]:Index_Range[gr][sgr][1]])
        if (Mstell > Mcut):
            Sel_Group.append(gr + 1)
            Sel_SubGroup.append(sgr)
            Sel_MStell.append(np.log10(Mstell) + 10)
            Sel_Shell.append(
                F.Shell(
                    pos_St[Index_Range[gr][sgr][0]:Index_Range[gr][sgr][1]],
                    Mass_St[Index_Range[gr][sgr][0]:Index_Range[gr][sgr][1]],
                    Rad, L, NBin, CenterOfPotential[gr][sgr]))

Sel_Shell = np.array(Sel_Shell)

try:
    s('mkdir ' + sim_name)
except:
    pass

np.save(sim_name + '/' + sim_name + '_sn' + str(Snap) + '_Shell_cop',
        Sel_Shell)
np.save(sim_name + '/' + sim_name + '_sn' + str(Snap) + '_SubGroup_cop',
        Sel_SubGroup)
np.save(sim_name + '/' + sim_name + '_sn' + str(Snap) + '_MStell_cop',
        Sel_MStell)
np.save(sim_name + '/' + sim_name + '_sn' + str(Snap) + '_Group_cop',
        Sel_Group)
コード例 #32
0
from os import system as s
print(
    "Enter the options\n1.Nearest Server\n2.US\n3.UK\n4.Taiwan\n5.Select Other Countries\n6.Disconnect"
)
print("7.OtherCommands\n8.Exit")
src = "nordvpn "
while (True):
    try:
        n = int(input())
        if (n == 1):
            s(src + "c")
        elif (n == 2):
            s(src + "c us")
        elif (n == 3):
            s(src + "c uk")
        elif (n == 4):
            s(src + "c taiwan")
        elif (n == 5):
            s(src + "countries")
            print("Type the Country name:")
            s(src + "c " + input())
        elif (n == 6):
            s(src + "d")
        elif (n == 7):
            s(src + "h")
            print("nordvpn", end=" ")
            s(src + input())
        else:
            break
        break
    except:
コード例 #33
0
	def tearDown(self):
		s("rm *foobar*")
コード例 #34
0
	def test_DelGBaseGetsRidOfTheTableAndModelFiles(self):
		self.beingTested.DelGBase('foobar')
		self.assertRaises(IOError, open, 'foobar.gbs', 'r')
		self.assertRaises(IOError, open, 'foobar-testgbase.gbs', 'r')
		s("touch foobar")
コード例 #35
0
ファイル: tar.py プロジェクト: nettee/code_history
#!/usr/bin/python3.2

"""meant to replace shell script
    since shell cannot control which file to tar
    conviniently.
    use os.system("COMMAND")
    the file to tar is specified
    in order to reuse
    modify the content in st_list
"""


from os import system as s

st_list = ("ipython",
        "iconfig",
        'imanual',
        'wiki',
        'english',
        'ebook',
        'downloads',
        'bin')

for st in st_list:
    s('tar -cf {0}.tar.gz {0}'.format(st))


コード例 #36
0
from os import system as s
from subprocess import call
import sys #to receive arguments from PCAsubcontrol.py

header = """#!/bin/sh
#PBS -l nodes=1
#PBS -l walltime=10:00:00
#PBS -V
#PBS -M [email protected]
cd $PBS_O_WORKDIR
"""

bp=int(sys.argv[1]) #receive arguments from PCAsubcontrol.py

j = "/home/juanwei/PCAfiles/1HUper200/%(bp)i/job_PCA_%(bp)i" % locals()  #filename of the job file, each in different folder so that ref_frame don't mixed up
with open(j, "w") as x:
    x.write("%(header)s /home/juanwei/lib/python-2.7.5/bin/python /home/juanwei/PCAfiles/1HUper200/PCArunall_nProtein.py %(bp)i\n " % locals()) #passing argument bp to PCArunall.py
s("qsub %(j)s" % locals())
コード例 #37
0
    def test_config_handler_returns_true_when_the_config_exists(self):
        s('touch ' + self.file_name)
        self.assertTrue(self.being_tested.config_file_exists())
	s('rm ' + self.file_name)
コード例 #38
0
ファイル: internet_notification.py プロジェクト: sudo-gera/c
from os import system as s
from urllib.request import urlopen as u
from time import *
while 1:
	d=0
	t=time()
	while 1:
		try:
			u('https://vk.com',timeout=3600).read()
			break
		except:
			pass
	t=time()-t
	n=16/(max(d-t,0)+1)
	sleep(n)
	s('termux-notification -c '+str(t))
	d=d*.9+t*.1
コード例 #39
0
ファイル: PyWallpaper.py プロジェクト: geekpradd/PyWallpaper
			def change_wallpaper(uri):
				s('gsettings set org.gnome.desktop.background picture-uri "file://{0}"'.format(uri))
コード例 #40
0
ファイル: Main.py プロジェクト: hantke/Read_Eagle
################################  MAIN  ##################################


Index_Range = F.Get_PartIndexRange(num_St,num_St_SH,NumOfSubhalos)

Sel_Group 		= []
Sel_SubGroup 	= []
Sel_MStell 		= []
Sel_Shell 		= []

for gr in range(len(Index_Range)):
	for sgr in range(len(Index_Range[gr])):
		#IDs = (Mass_St[Index_Range[gr][sgr][0]:Index_Range[gr][sgr][1]])
		Mstell = np.sum(Mass_St[Index_Range[gr][sgr][0]:Index_Range[gr][sgr][1]])
		if (Mstell > Mcut):
			Sel_Group.append(gr+1)
			Sel_SubGroup.append(sgr)
			Sel_MStell.append(np.log10(Mstell)+10)
			Sel_Shell.append(F.Shell(pos_St[Index_Range[gr][sgr][0]:Index_Range[gr][sgr][1]], Mass_St[Index_Range[gr][sgr][0]:Index_Range[gr][sgr][1]], Rad, L,NBin))

Sel_Shell = np.array(Sel_Shell)

try: s('mkdir '+sim_name)
except: pass

np.save(sim_name+'/'+sim_name+'_sn'+str(Snap)+'_Shell',Sel_Shell)
np.save(sim_name+'/'+sim_name+'_sn'+str(Snap)+'_SubGroup',Sel_SubGroup)
np.save(sim_name+'/'+sim_name+'_sn'+str(Snap)+'_MStell',Sel_MStell)
np.save(sim_name+'/'+sim_name+'_sn'+str(Snap)+'_Group',Sel_Group)

コード例 #41
0
ファイル: PyWallpaper.py プロジェクト: geekpradd/PyWallpaper
			def change_wallpaper(uri):
				s("gconftool-2 --type=string --set /desktop/gnome/background/picture_filename {0}".format(uri))
コード例 #42
0
ファイル: autogit2.py プロジェクト: RickyUC/Programas
from os import system as s
from os import chdir as c

print('AUTOMATIZACION GIT'
      '\n'
      '\n\t[1] Actualizar Repositorios'
      '\n\t[2] Subir Cambios'
      '\n')
opcion = int(input('Selecciona una opcion: '))

if opcion == 1:
    c('D:\Archivos\[Git] Progra Avanzada (N2)\contenidos')
    s('git pull')

    c('D:\Archivos\[Git] Progra Avanzada (N2)\RickyUC-iic2233-2017-1')
    s('git pull')

    c('D:\Archivos\[Git] Progra Avanzada (N2)\Syllabus')
    s('git pull')

    c('D:\Archivos\[Git] Progra Avanzada (N2)\Programas')
    s('git pull')

elif opcion == 2:
    print(
        'ADVERTENCIA: \nEste programa carga todos los archivos del repositorio RickyUC-iic2233-2017-1 sin discriminar'
        'bajo ninguna categoria.')
    continuar = int(input('¿Deseas continuar? si[1]/no[2] '))

    if continuar == 1:
        c('D:\Archivos\[Git] Progra Avanzada (N1)\RickyUC-iic2233-2017-1')
コード例 #43
0
ファイル: PyWallpaper.py プロジェクト: geekpradd/PyWallpaper
	def change_wallpaper(uri):
		s('osascript -e \'tell application "Finder" to set desktop picture to POSIX file "{0}"\''.format(uri))
コード例 #44
0
        if size != 150:
            if size < 1000:
                sizeToUse = str(int(finalSize2 / size))
                command += "-lv " + sizeToUse + " -rv " + sizeToUse
            else:
                sizeToUse = str(int(finalSize1 / size))
                command += "-lv " + sizeToUse + " -rv " + sizeToUse

            command += " -o ./" + Class + "/" + cell + "/" + str(size) + "/ "
            command += " -fl "
            cont = 0
            file0 = open(glob(folder + "/*.tsv")[0], "r")
            dataToUse = ""
            for line in file0:
                if cont == 0:
                    dataToUse = line[:-1].split("\t")
                    cont = 1
            file0.close()
            for use in dataToUse:
                if use != Class:
                    command += use + " "
            f = open("job.sh", "w")
            f.write("#!/bin/bash\n")
            f.write("#SBATCH -c 8\n")
            f.write("#SBATCH -e " + str(cont) + ".err")
            f.write("#SBATCH --job-nam=job" + str(job) + "\n")
            f.write(command)
            f.close()
            s("sbatch job.sh")
            job += 1
コード例 #45
0
from os import system as s # s will serve as an easy way to send a command to the system
from os import path, remove, listdir
import hashlib, shutil, ftplib, gnupg

news = listdir('/REPODIRECTORY/new') # Taking inventory of all new packages, placed in a "/new" directory
for entry in news:
	enpath = '/REPODIRECTORY/new/%s' % entry
	if path.isdir(enpath): # Checking to see if any packages (in directory form, with the DEBIAN directory) have yet to be packaged
		makedeb = 'dpkg -b %s' % enpath
		s(makedeb) # Packaging any not-yet-packaged packages
		shutil.rmtree(enpath) # Deleting the now-packaged package's folder

news = listdir('/REPODIRECTORY/new') # Taking inventory of all new packages
for file in news:
	newf = path.join('/REPODIRECTORY/new', file)
	newfm = path.join('/REPODIRECTORY', file)
	shutil.move(newf, newfm) # Moving all new packages into the repo root, so they can be accounted for when creating the Packages index

remove('Packages') # Removing the old Packages index files
remove('Packages.gz')
remove('Packages.bz2')

s('sudo dpkg-scanpackages -m . /dev/null >Packages') # Creating the Pacakges file
s('bzip2 -fks Packages') # Creating the Packages.bz2 file
s('gzip -f Packages') # Turning the Packages file into the Packages.gz file
s('sudo dpkg-scanpackages -m . /dev/null >Packages') # Creating another Packages file

m1 = hashlib.md5(open('Packages').read()).hexdigest() # Calculating checksums for each Packages index file
m2 = hashlib.md5(open('Packages.gz').read()).hexdigest()
m3 = hashlib.md5(open('Packages.bz2').read()).hexdigest()