Beispiel #1
0
def main(arvg=None):
    try:
        opts, args = getopt.getopt(sys.argv[1:], "vipc:l:u:f:",['version','installcheck','policyfilecheck', 'pubfile=', 'randfile=', 'paramfile='])
    except getopt.GetoptError:
        print "Error: Unrecognized or incomplete option found"
        print ""
        usage()
    except KeyboardInterrupt:
        print '%s' % sys.exc_type
        print 'shutting down'

    file = ""
    user = ""
    list = ""
    subject = ""
    cmd = ""

    for o, v in opts:
        if o in ( "-v", "--version"):
            version()
        if o in ("-i", "--installcheck"):
            checkinstall()
        if o in ("-p", "--policyfilecheck"):
            policycheck()
            sys.exit()
        if o == "-l":
            list = v
        elif o == "-u":
            user = v
        elif o == "-f":
            file = v

    if (list == ""):
        print 'No option provided !'
        usage()
    listlocalPath = '../lists/' + list
    listSELSPath = MAILMAN_LIST_PATH + '/lists/' + list + '/SELS'
    gnupg.options.homedir = listSELSPath

    try:
        input = raw_input("Please select option (1 or 2):\n(1)Create local keyring for list\n(2)Create Mailman keyring for list\n")
        if input =="1":
            local(list)
        elif input =="2":
            create(list)
        else:
            print "Wrong input. Try again\n"

    except KeyboardInterrupt:
        print ''
        print '%s' % sys.exc_type
        print 'shutting down'
        sys.exit()

    return 0
Beispiel #2
0
def askAnonymous(val):
    while cdat_info.ping_checked is False and val not in [True, False]:  # couldn't get a valid value from env or file
        val2 = raw_input(
            "Allow anonymous logging usage to help improve UV-CDAT" +
            "(you can also set the environment variable UVCDAT_ANONYMOUS_LOG to yes or no)? [yes]/no: ")
        if val2.lower() in ['y', 'yes', 'ok', '1', 'true', '']:
            val = True
        elif val2.lower() in ['n', 'no', 'not', '0', 'false']:
            val = False
        if val in [True, False]:  # store result for next time
            try:
                fanom = os.path.join(
                    os.path.expanduser("~"), ".uvcdat", ".anonymouslog")
                if not os.path.exists(os.path.join(
                        os.path.expanduser("~"), ".uvcdat")):
                    os.makedirs(
                        os.path.join(
                            os.path.expanduser("~"),
                            ".uvcdat"))
                data = {"log_anonymously": val,
                        "last_time_checked": time.time(),
                        "last_version_check": version()
                        }
                with open(fanom, "w") as f:
                    json.dump(data, f, indent=2)
            except BaseException:
                pass
    else:
        if cdat_info.ping_checked:
            val = cdat_info.ping
    cdat_info.ping = val
    cdat_info.ping_checked = True
def update_youtube(self):
	"""
	update Youtube-dl
	"""
	table = Gtk.Table()
	v = version()
	msg = Gtk.Label("La version actuelle de youtube-dl installée est : "+v)
	upd = Gtk.Button("Mettre à jour")
	upd.set_size_request(5,5)
	upd.connect("clicked", self.process,"upd")
	buf = Gtk.TextBuffer()
	buf.set_text("En cas d'échec, vous pouvez mettre à jour ou installer youtube-dl via votre terminal :\n \
	- Sous Ubuntu : \n\
	~$ sudo wget https://yt-dl.org/downloads/2013.10.18/youtube-dl -O /usr/local/bin/youtube-dl \n \
	~$ sudo chmod a+x /usr/local/bin/youtube-dl \n\
Puis il suffit d'appuyez sur le bouton mettre à jour pour effectuer la mise à jour de youtube-dl\n\
Pour plus d'informations veuillez visiter ce site web : https://doc.ubuntu-fr.org/youtube-dl")

	text = Gtk.TextView()
	text.set_buffer(buf)
	text.set_editable(False)

	table.attach(msg,0,1,0,1)
	table.attach(upd,0,1,2,3,Gtk.AttachOptions.SHRINK,Gtk.AttachOptions.SHRINK)
	table.attach(text,0,3,3,4)
	
	return table
Beispiel #4
0
def main():
    # TODO: introduce parameters to:
    #       - define parameters to use and use random input and key.
    #       - allow to setup by params the input and/or the key, and
    #       - operations to do: cipher and/or decipher
    parser = OptionParser()
    parser.add_option('', "--log-level", default="info",
                      help="Set log level: error, warning, info, debug, trace")
    parser.add_option('', "--rounds", type="int", default=10,
                      help="Number of rounds")
    parser.add_option('', "--rows", type="int", default=4,
                      help="Number of rows")
    parser.add_option('', "--columns", type="int", default=4,
                      help="Number of columns")
    parser.add_option('', "--wordsize", type="int", default=8,
                      help="Bit size of the word")
    parser.add_option('', "--kolumns", type="int", default=4,
                      help="Number of columns of the key")
    parser.add_option('', "--key", default="0",
                      help="Key in numeric representation")
    parser.add_option('', "--plainText", default="0",
                      help="Plaintext in numeric representation")
    parser.add_option('', "--only-keyexpansion", action="store_true",
                      default=False,
                      help="No [de]cipher operations. Made to test the PRG "
                      "with the key as seed to generate each round subkeys.")
    parser.add_option('', "--calculate-sbox", default=False,
                      action="store_true",
                      help="Instead of use the given Rijndael tables, do the "
                      "polynomial calculations.")
    # TODO: add options to only [de]cipher
    #       (the will be also need a --cipherText)
    (options, args) = parser.parse_args()
    key = understandInteger(options.key)
    if key is None:
        print("\n\tError: It was not possible to understand the input key "
              "'%s' as a number.\n" % (options.key))
        sys.exit(-1)
    gr = gRijndael(key=key,
                   nRounds=options.rounds,
                   nRows=options.rows,
                   nColumns=options.columns,
                   wordSize=options.wordsize,
                   nKeyColumns=options.kolumns,
                   sboxCalc=options.calculate_sbox,
                   loglevel=_levelFromMeaning(options.log_level))
    if not options.only_keyexpansion:
        plainText = understandInteger(options.plainText)
        if plainText is None:
            print("\n\tError: It was not possible to understand the input "
                  "plain text '%s' as a number.\n" % (options.plainText))
            sys.exit(-2)
        cipherText = gr.cipher(plainText)
        if int(plainText) != gr.decipher(cipherText):
            print("Error")
        else:
            print("Ok")
        print("Release: %s" % (version()))
Beispiel #5
0
def runCheck():
    # Wait for other threads to be done
    checkLock.acquire()
    last_time_checked = 0
    last_version_check = None
    if cdat_info.ping_checked is False:
        val = None
        envanom = os.environ.get("UVCDAT_ANONYMOUS_LOG", None)
        if envanom is not None:
            if envanom.lower() in ['true', 'yes', 'y', 'ok','1']:
                val = True
            elif envanom.lower() in ['false', 'no', 'n', 'not', '0']:
                checkLock.release()
                return False
            else:
                warnings.warn(
                    "UVCDAT logging environment variable UVCDAT_ANONYMOUS_LOG should be set to 'True' or 'False'" +
                    ", you have it set to '%s', will be ignored" %
                    envanom)
        if val is None:  # No env variable looking in .uvcdat
            fanom = os.path.join(
                os.path.expanduser("~"),
                ".uvcdat",
                ".anonymouslog")
            # last time and version we asked for anonymous
            if os.path.exists(fanom):
                try:
                    with open(fanom) as f:
                        data = json.load(f)
                        val = data.get("log_anonymously", None)
                        last_time_checked = data.get("last_time_checked", 0)
                        last_version_check = data.get(
                            "last_version_check", None)
                except BaseException:
                    with open(fanom) as f:
                        for l in f.readlines():
                            sp = l.strip().split()
                            if sp[0].lower().find("cdat_anonymous") > - \
                                    1 and len(sp) > 1:
                                try:
                                    val = eval(sp[1])
                                except BaseException:
                                    pass
        if (last_time_checked==0 or last_version_check is None) and val is False:
            val = None
        elif time.time() - last_time_checked > 2592000 and val is False:  # Approximately 1 month
            val = None
        current = version()
        if val is False and last_version_check is not None and versions_compare(
                current, last_version_check) > 0:  # we have a newer version
            val = None
        checkLock.release()
        return val
    checkLock.release()
Beispiel #6
0
 def endElement(self, name):
     if self.code == None:
         self.code = releaseCode()
     if name == "code":
         self.code.code = self.data
     elif name == "name":
         self.code.name = self.data
     elif name == "version":
         self.code.version = version(self.data)
     elif name == "model":
         self.code.models.append(self.data)
     elif name == "releasecode":
         self.codes.codes.append(self.code)
         self.code = None
     self.data = ""
Beispiel #7
0
def submitPing(source, action, source_version=None):
    if not triedToClean:
        clean_cache()
    try:
        data = None
        if source in ['cdat', 'auto', None]:
            source = cdat_info.SOURCE
        if cdat_info.ping:
            if source not in actions_sent.keys():
                actions_sent[source] = []
            elif action in actions_sent[source]:
                return
            else:
                actions_sent[source].append(action)
            data = {}
            uname = os.uname()
            data['platform'] = uname[0]
            data['platform_version'] = uname[2]
            data['hashed_hostname'] = hashlib.sha1(uname[1]).hexdigest()
            data['source'] = source
            data['cdat_info_version'] = version()
            if source_version is None:
                data['source_version'] = get_version()
            else:
                data['source_version'] = source_version
            data['action'] = action
            data['sleep'] = cdat_info.sleep
            data['pid'] = os.getpid()
            login = pwd.getpwuid(os.geteuid())[0]
            data['hashed_username'] = hashlib.sha1(login).hexdigest()
            data['gmtime'] = time.asctime(time.gmtime())
            data = post_data(data)
    except BaseException:
        pass
    if data is not None:
        cache_data(data)
Beispiel #8
0
from setuptools import setup
from pip.req import parse_requirements
import sys, os
sys.path.append("wutu_compiler/")

install_reqs = list(parse_requirements("requirements.txt", session={}))


def version():
    import version
    return version.get_version()


setup(name="wutu",
        version=version(),
        description="An utility library designed to create JavaScript out of Python code",
        author="Šarūnas Navickas",
        author_email="*****@*****.**",
        url="https://github.com/zaibacu/wutu-compiler",
        license="MIT",
        packages=["wutu_compiler"],
        install_requires=[str(ir.req) for ir in install_reqs],
        tests_require=["pytest"],
        setup_requires=["pytest-runner"])
    def __init__(self):
        """
        Initial Window
        """
        Gtk.Window.__init__(self, title="Youtube-dl PyGtk Gui")
        # Choose Gui Language
        LangueGui()
        self.l_ui = LangueGui.status
        GuiYoutube.l_ui = LangueGui.status
        if self.l_ui =="" : 
            self.l_ui = ui_an
            GuiYoutube.l_ui = ui_an
            
        #self.set_decorated(0) # remove decoration from window
        self.set_resizable(False)
        self.set_size_request(360, 500)
        #self.set_default_size(500, 500)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_icon_from_file("images/icon.png")
        action_group = Gtk.ActionGroup("Mes actions")

        self.add_fichier_menu_actions(action_group)
        self.add_aide_menu_actions(action_group)
        self.pid = 0

        self.ui_file = os.getcwd() + "/gui_menu.xml"
        uimanager = self.create_ui_manager
        uimanager.insert_action_group(action_group)
        menubar = uimanager.get_widget("/MenuBar")

        vbox = Gtk.VBox(False, 2)
        self.add(vbox)
        vbox.pack_start(menubar, False, False, 0)

        notebook = Gtk.Notebook()
        
        table = Gtk.Table(2, 2, True)
        notebook.append_page(table,Gtk.Label(self.l_ui[19]))


        self.label = Gtk.Label()
        self.label.set_text(self.l_ui[0])
        table.attach(self.label, 0, 2, 0, 1)

        self.entree = Gtk.Entry()
        self.entree.set_text(self.l_ui[1])
        table.attach(self.entree, 0, 2, 1, 2)

        label_format = Gtk.Label("Format : ")
        self.combo = Gtk.ComboBoxText()
        self.combo.insert(0, "171", "WEBM [Audio  "+self.l_ui[3]+" "+self.l_ui[5]+"]")
        self.combo.insert(1, "140", "M4A [Audio]")
        self.combo.insert(2, "160", "MP4 ["+self.l_ui[2]+" 144p]")
        self.combo.insert(3, "242", "WEBM ["+self.l_ui[2]+" 240p]")
        self.combo.insert(4, "133", "MP4 ["+self.l_ui[2]+" 240p]")
        self.combo.insert(5, "243", "WEBM ["+self.l_ui[2]+" 360p]")
        self.combo.insert(6, "134", "MP4 ["+self.l_ui[2]+" 360p]")
        self.combo.insert(7, "244", "WEBM ["+self.l_ui[2]+" 480p]")
        self.combo.insert(8, "135", "MP4 ["+self.l_ui[2]+" 480p]")
        self.combo.insert(9, "247", "WEBM ["+self.l_ui[2]+" 720p]")
        self.combo.insert(10, "136", "MP4 ["+self.l_ui[2]+" 720p]")
        self.combo.insert(11, "248", "WEBM ["+self.l_ui[2]+" 1080p]")
        self.combo.insert(12, "137", "MP4 ["+self.l_ui[2]+" 1080p]")
        self.combo.insert(13, "17", "3GP ["+self.l_ui[2]+" 176x144]")
        self.combo.insert(14, "36", "3GP ["+self.l_ui[2]+" 320x240]")
        self.combo.insert(15, "5", "FLV ["+self.l_ui[2]+" 400x240]")
        self.combo.insert(16, "43", "WEBM ["+self.l_ui[2]+" 640x360]")
        self.combo.insert(17, "18", "MP4 ["+self.l_ui[2]+" 640x360]")
        self.combo.insert(18, "22", "MP4 ["+self.l_ui[2]+" 1280x720 "+self.l_ui[4]+" "+self.l_ui[5]+"]")
        table.attach(label_format, 0, 1, 2, 3)
        table.attach(self.combo, 1, 2, 2, 3)

        destination = Gtk.Button(label=self.l_ui[6])
        destination.connect("clicked", self.choix_destination)
        self.label_destination = Gtk.Entry()
        username = getpass.getuser()
        self.label_destination.set_text("/home/"+username)
        table.attach(destination, 0, 1, 3, 4)
        table.attach(self.label_destination, 1, 2, 3, 4)

        self.telecharger = Gtk.Button(label=self.l_ui[7])
        self.telecharger.connect("clicked", self.test_format,"down")

        table.attach(self.telecharger, 0, 1, 4, 5)
        quite = Gtk.Button(label=self.l_ui[8])
        quite.connect("clicked", self.kill)
        table.attach(quite, 1, 2, 4, 5)
        
        vbox.pack_start(notebook,False,False,0)

        self.tbuffer = Gtk.TextBuffer()
        self.tw_out = Gtk.TextView(buffer=self.tbuffer)
        self.tw_out.set_editable(False)
        sw = Gtk.ScrolledWindow()
        vbox.pack_start(sw, True, True, 0)
        sw.add(self.tw_out)
        self.tw_err = Gtk.TextView()
        self.progress = Gtk.ProgressBar()
        vbox.pack_start(self.progress, False, False, 0)
        clear = Gtk.Button(self.l_ui[9])
        clear.connect("clicked", self.clear_log)
        vbox.pack_start(clear,False,False,0)

        self.label_stat = Gtk.Label("Chiheb Nexus | http://www.nexus-coding.blogspot.com")
        label_version = Gtk.Label()
        try:
            txt = version()
            label_version.set_text(self.l_ui[20]+txt)
        except:
            label_version.set_text("youtube-dl n'est pas installé")

        vbox.pack_end(self.label_stat, False, True, 0)
        vbox.pack_end(label_version, False, True, 0)
        notebook.insert_page(auth(self),Gtk.Label("Authentification"),2)
        notebook.insert_page(update_youtube(self),Gtk.Label("Update"),3)
Beispiel #10
0
from setuptools import setup
from pip.req import parse_requirements
import sys, os
sys.path.append("wutu/")
sys.path.append("wutu/compiler/")

install_reqs = list(parse_requirements("requirements.txt", session={}))


def version():
    import version
    return version.get_version()


setup(name="wutu",
      version=version(),
      description="A minimalistic python-angular framework",
      author="Šarūnas Navickas",
      author_email="*****@*****.**",
      url="https://github.com/zaibacu/wutu",
      license="MIT",
      packages=["wutu", "wutu.compiler"],
      install_requires=[str(ir.req) for ir in install_reqs],
      test_suite="nose.collector",
      tests_require=["nose"])
Beispiel #11
0
            password_dec = input()
            print("-" * 100)
            os.chdir(input_loc)
            dir = os.listdir(input_loc)
            for item in dir:
                if item == input_name:
                    try:
                        do_dec(input_name, input_loc, password_dec)
                        print("-" * 100)
                        print("Decryption Completed.")
                        print("-" * 100)
                        break
                    except ValueError:
                        print("Wrong Password.")

    elif pressed == 'V' or pressed == 'v':
        version()
    elif pressed == 'R' or pressed == 'r':
        release()
    elif pressed == 'D' or pressed == 'd':
        dev_details()
    elif pressed == 'X' or pressed == 'x':
        print("-" * 100)
        print("Closing....")
        print("-" * 100)
        break
    else:
        print("-" * 100)
        print("Enter the right keyword.")
        print("-" * 100)
Beispiel #12
0
url = "http://pygame.org/ftp/pygame-1.9.1.win32-py2.6.msi"

file_name = url.split('/')[-1]
u = urllib2.urlopen(url)
f = open(file_name, 'wb')
meta = u.info()
file_size = int(meta.getheaders("Content-Length")[0])
print "Downloading: %s Bytes: %s" % (file_name, file_size)
time.sleep(5)

file_size_dl = 0
block_sz = 8192
while True:
    buffer = u.read(block_sz)
    if not buffer:
        break

    file_size_dl += len(buffer)
    f.write(buffer)
    status = r"%10d  [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)
    status = status + chr(8)*(len(status)+1)
    print status, 

f.close()

version()
version2()
version3()
version4()