Esempio n. 1
0
def main():
	parser = argparse.ArgumentParser(
	description = 'the argparse'
	)

	parser.add_argument('-d', action='store', dest='domain')
	parser.add_argument('-n', action='store', dest='name')
	args = parser.parse_args()

	domain = args.domain
	name = args.name
	if(domain == None):
		printUsage()
		return
	db.getDB()
	if db.isExist(domain, name):
		print 'The domain '+ domain + ' is exist, please use setpw or getpw.'
		return

	nextpw = True
	while(nextpw):
		pw = createpw()
		print pw
		isOK =raw_input('Is it OK?(yes/no):(yes)')
		if isOK == '' or isOK == 'yes':
			nextpw = False
			db.insertpw(domain, name, pw)
			if name==None:
				print domain + ' : ' + pw + ' is inserted.'
			else:
				print domain + "|" + name + ' : ' + pw + " is inseted."
			pyperclip.setcb(pw)
			print 'the password is copyed to clipboard.' 
Esempio n. 2
0
    def find(self, string = ''):
        ids = []
        i = 0
        for cpl in self.db.listContent():
            if string in cpl['user'] or string in cpl['web']:
                print("Couple", i + 1)
                print("User   : {}".format(cpl['user']))
                print("Website: {}".format(cpl['web']))
                ids.append(cpl['id'])
                i += 1

        # if we find at least one entry, generate a password for a user selected one
        if i > 0:
            yn = 0
            try: 
                inp = input("Which couple do you want to generate the password for? (empty for none) ")
                if inp != '':
                    yn = int(inp)
            except Exception as err:
                print("Problem with your input", err)
                return
                    
            if yn > 0 and yn <= len(ids):
                cpl = self.db.find(ids[yn - 1])
                try:
                    pwd = gen_pwd(cpl['user'], cpl['web'], self.masterpwd, private = self.privatekey, withpass = self.withpass, version = cpl['ver'])
                except ValueError:
                    return

                copyto = input("Copy to clipboard? [y/N] ")
                if copyto.lower() == "y" or copyto.lower() == "yes":
                    pyclip.setcb(pwd)
                else:
                    print("Your password is: {}".format(pwd))
Esempio n. 3
0
	def Generator(self):
		name = self.name
		key = self.key
		app = self.app
		byear = self.byear
		year = int(byear[0])
		if year == 1:
			year = '@'
		elif year == 2:
			year = '!'
		else:
			year = self.byear[0]
		self.crypted = name[2].upper() + app[3] + byear[1] + key[1] + app[-2] + name[-2] + byear[2] + app[-0].upper() + key[-3].upper() + year
		print 'Do you want to copy your pass to your clipboard? '
		chs = raw_input('y/n: ')
		if chs == 'y':
			pyperclip.setcb(self.crypted)
			time.sleep(1)
			print 'Pasted to your clipboard!'
			raw_input()
			exit()
		if chs == 'n':
			print 'Your pass is: ', self.crypted
			raw_input()
			exit()
		else:
			print 'Choose a valid choice'
			self.Generator()
Esempio n. 4
0
    def copy_to_clipboard(self, fragname):
        # type: (str) -> bool
        """
        copys the exported atoms to the clipboard including FRAG  FEND commands

        Export example:

        FRAG
        C1   1     1.2000  -0.0230   3.6150
        C2   1     1.2030  -0.0120   2.1060
        C3   1     0.0150  -0.0110   1.3900
        C4   1     0.0150  -0.0010   0.0050
        C5   1     1.2080   0.0080  -0.6880
        C6   1     2.3980   0.0060   0.0090
        C7   1     2.3940  -0.0040   1.3940
        FEND
        """
        import pyperclip
        fragname = fragname.lower()
        clip_text = []
        cell = self._gdb.get_cell(fragname)
        atoms = self._gdb.get_atoms(fragname)
        atoms = self.format_atoms_for_export(cell, atoms, False)
        atoms = '\n'.join(atoms)
        clip_text.append('FRAG')
        clip_text.append('\n' + atoms)
        clip_text.append('\nFEND')
        text = ' '.join(clip_text)
        pyperclip.setcb(text)
        return True
Esempio n. 5
0
    def run(self):
        command = "init"
        print("Type exit to stop the shell")
        pattern = re.compile("^\s*(\w+)\s*(.*)$")
        while True:
            command = input("> ")
            try:
                cmd = re.findall(pattern, command)
            except Exception as err:
                print("Error: Unable to parse your command")
                print(err)
                continue

            if len(cmd) < 1:
                print("""
Please type a command, or {bold}{red}exit{end} to closethe manager.
Use {bold}{red}help{end} to see how to use the manager.
                    """.format(bold=fmt.BOLD, end=fmt.END, red=fmt.RED))
                continue
            else:
                cmd = cmd[0]

            if cmd[0] == "help" or cmd[0] == "h":
                if len(cmd) > 1:
                    self.showHelp(cmd[1].strip())
                else:
                    self.showHelp()

            elif cmd[0] == "init":
                self.initialize()

            elif cmd[0] == "gen" or cmd[0] == "g":
                self.generate(cmd[1].strip())

            elif cmd[0] == "regen" or cmd[0] == "r":
                self.generate("regen {}".format(cmd[1].strip()))

            elif cmd[0] == "delete" or cmd[0] == "d":
                if len(cmd) > 1:
                    self.delete(cmd[1].strip())
                else:
                    self.delete()

            elif cmd[0] == "list" or cmd[0] == "l":
                self.list()

            elif cmd[0] == "find" or cmd[0] == "f":
                if len(cmd) > 1:
                    self.find(cmd[1].strip())
                else:
                    self.find('')

            elif cmd[0] == "clean" or cmd[0] == "c":
                pyclip.setcb("the password was here")

            elif cmd[0] == "exit" or cmd[0] == "q":
                break
            else:
                print("Not Implemented Yet")
Esempio n. 6
0
    def run(self):
        command = "init"
        print("Type exit to stop the shell")
        pattern = re.compile("^\s*(\w+)\s*(.*)$")
        while True:
            command = input("> ")
            try:
                cmd = re.findall(pattern, command)
            except Exception as err:
                print("Error: Unable to parse your command")
                print(err)
                continue

            if len(cmd) < 1:
                print("""
Please type a command, or {bold}{red}exit{end} to closethe manager.
Use {bold}{red}help{end} to see how to use the manager.
                    """.format(bold=fmt.BOLD, end=fmt.END, red=fmt.RED))
                continue
            else:
                cmd = cmd[0]

            if cmd[0] == "help" or cmd[0] == "h":
                if len(cmd) > 1:
                    self.showHelp(cmd[1].strip())
                else:
                    self.showHelp()

            elif cmd[0] == "init":
                self.initialize()

            elif cmd[0] == "gen" or cmd[0] == "g":
                self.generate(cmd[1].strip())

            elif cmd[0] == "regen" or cmd[0] == "r":
                self.generate("regen {}".format(cmd[1].strip()))

            elif cmd[0] == "delete" or cmd[0] == "d":
                if len(cmd) > 1:
                    self.delete(cmd[1].strip())
                else:
                    self.delete()

            elif cmd[0] == "list" or cmd[0] == "l":
                self.list()

            elif cmd[0] == "find" or cmd[0] == "f":
                if len(cmd) > 1:
                    self.find(cmd[1].strip())
                else:
                    self.find('')

            elif cmd[0] == "clean" or cmd[0] == "c":
                pyclip.setcb("the password was here")

            elif cmd[0] == "exit" or cmd[0] == "q":
                break
            else:
                print("Not Implemented Yet")
Esempio n. 7
0
def showKey(fname):
	print ('Key file found.')
	with open(fname, 'r') as f:
		contents = f.read()
	print ('Key data (copied to your clipboard):')
	print
	print (contents)
	pyperclip.setcb(contents.strip())
Esempio n. 8
0
def getUnrealTextFromSelection(cut = False):
    pyperclip.setcb("") #make the cb empty
    if cut:
        cutToClipboard()
    else:
        copyToClipboard()
    text = pyperclip.getcb()
    if text == "":
        #print "# m2u debug: could not copy to clipboard"
        return None
    return text
Esempio n. 9
0
def getUnrealTextFromSelection(cut=False):
    pyperclip.setcb("")  #make the cb empty
    if cut:
        cutToClipboard()
    else:
        copyToClipboard()
    text = pyperclip.getcb()
    if text == "":
        #print "# m2u debug: could not copy to clipboard"
        return None
    return text
Esempio n. 10
0
def clip(url,format,w,h):	
	response = unirest.get("https://jmillerdesign-url-screenshot.p.mashape.com/api?url="+urllib.quote(url)+"&format="+format+"&width="+w+"&height="+h+"&delay=5",
	  headers={
		"X-Mashape-Authorization": "7cu8k0bYarwTOOPnOFgJQn9nWwt4tr33"
	  }
	);
	try:
		pyperclip.setcb(response.body['screenshot'])
	except:
		pass
	finally:
		print response.body['message']
Esempio n. 11
0
def _transformObject_old(objName, trans, rot, scale):
    """transform an object with absolute transformations.

    :param objName: name of the object to modify
    :param trans: translation float tuple
    :param rot: rotation float tuple
    :param scale: 3d scale float tuple

    Transforms an object by cutting it from the level,
    replacing parameters and pasting the changed text to the level
    
    """
    rot = _convertRotationToUDK(rot)
    selectByName(objName)

    #keep = pyperclip.getcb() #backup current clipboard TODO: reenable
    pyperclip.setcb("")  #make the cb empty for while loop
    cutToClipboard()  # this will be executed somewhen, we don't know when
    old = pyperclip.getcb()
    if old == "":
        print "# m2u: could not copy to clipboard"
        return
    # we assume that transformation order is alwasy location, rotation, scale!
    locInd = str.find(old, "Location=(")
    assert locInd is not -1, (
        "# m2u: No Location attribute found, there is "
        "currently no solution implemented for that case.")
    # TODO we don't know where to add it in that case, so leave it be for now

    lastInd = locInd  #index of the last translate information found
    nextInd = str.find(old, "Rotation=(", locInd)
    if nextInd is not -1:  #found rotation as next, save the index
        lastInd = nextInd
    nextInd = str.find(old, "DrawScale3D=(", nextInd)
    if nextInd is not -1:  #found scale as next, save the index
        lastInd = nextInd
    #now we remove the transformation block from the text
    endInd = str.find(old, "\n", nextInd) + 1  # end of last statement
    part1 = old[0:locInd]  #the part before the transform stuff
    part2 = old[endInd:]  #the part after the transform stuff
    #create our own transformation block
    locRep = "Location=(X=%f,Y=%f,Z=%f)" % trans
    rotRep = "Rotation=(Pitch=%d,Yaw=%d,Roll=%d)" % rot
    scaleRep = "DrawScale3D=(X=%f,Y=%f,Z=%f)" % scale
    #add them all together as a new object string
    new = part1 + locRep + "\n" + rotRep + "\n" + scaleRep + "\n" + part2
    #print new

    pyperclip.setcb(new)
    pasteFromClipboard()
Esempio n. 12
0
def _transformObject_old(objName, trans, rot, scale):
    """transform an object with absolute transformations.

    :param objName: name of the object to modify
    :param trans: translation float tuple
    :param rot: rotation float tuple
    :param scale: 3d scale float tuple

    Transforms an object by cutting it from the level,
    replacing parameters and pasting the changed text to the level
    
    """
    rot = _convertRotationToUDK(rot)
    selectByName(objName)
    
    #keep = pyperclip.getcb() #backup current clipboard TODO: reenable
    pyperclip.setcb("") #make the cb empty for while loop
    cutToClipboard() # this will be executed somewhen, we don't know when
    old = pyperclip.getcb()
    if old == "":
        print "# m2u: could not copy to clipboard"
        return
    # we assume that transformation order is alwasy location, rotation, scale!
    locInd = str.find(old,"Location=(")
    assert locInd is not -1, ("# m2u: No Location attribute found, there is "
                            "currently no solution implemented for that case.")
    # TODO we don't know where to add it in that case, so leave it be for now
    
    lastInd = locInd #index of the last translate information found
    nextInd = str.find(old,"Rotation=(",locInd)
    if nextInd is not -1: #found rotation as next, save the index
        lastInd = nextInd
    nextInd = str.find(old,"DrawScale3D=(",nextInd)
    if nextInd is not -1: #found scale as next, save the index
        lastInd = nextInd
    #now we remove the transformation block from the text   
    endInd = str.find(old,"\n",nextInd) + 1 # end of last statement
    part1 = old[0:locInd] #the part before the transform stuff
    part2 = old[endInd:] #the part after the transform stuff
    #create our own transformation block
    locRep = "Location=(X=%f,Y=%f,Z=%f)" % trans
    rotRep = "Rotation=(Pitch=%d,Yaw=%d,Roll=%d)" % rot
    scaleRep = "DrawScale3D=(X=%f,Y=%f,Z=%f)" % scale
    #add them all together as a new object string
    new = part1 + locRep + "\n" + rotRep + "\n" + scaleRep + "\n" + part2
    #print new
    
    pyperclip.setcb(new)
    pasteFromClipboard()
Esempio n. 13
0
	def get_url(self):
		bitly = BitlyHandle(BITLY_ACCESS_TOKEN)
		long_url = self.long_url.get()
		short_url = bitly.get_short_url(long_url)

		pyperclip.setcb(short_url)

		url_window = Toplevel()
		url_window.title("Short URL")

		url_label = Label(url_window, text="Short URL:")
		url_label.grid(padx=5, pady=5)

		url_text = Entry(url_window)
		url_text.insert(END, pyperclip.getcb())
		url_text.grid(pady=5)
Esempio n. 14
0
	def Crypt(self, app, name, byear, key):
		year = int(byear[0])
		if year == 1:
			year = '@'
		elif year == 2:
			year = '!'
		else:
			year = self.byear[0]
		self.crypted = name[2].upper() + app[3] + byear[1] + key[1] + app[-2] + name[-2] + byear[2] + app[-0].upper() + key[-3].upper() + year
		self.result = tkMessageBox.askyesno('Info', 'Do you want to copy your pass to clipboard?')
		if self.result == True:
			pyperclip.setcb(self.crypted)
			tkMessageBox.showinfo('Warning', 'Program will close')
			exit()
		else:
			tkMessageBox.showinfo('Info', 'Your password is: ' + self.crypted)
			exit()
Esempio n. 15
0
def print_selection_bounds(image, drawable, halfsize=False):
    pdb = gimpfu.gimp.pdb
    sel_bounds = pdb.gimp_selection_bounds

    exists, x, y, x2, y2 = sel_bounds(image)

    if not exists:
        pdb.gimp_message('No selection found')
    else:
        w, h = x2 - x, y2 - y

        if halfsize:
            msg = '{%d, %d, %d, %d}' % (x / 2, y / 2, w / 2, h / 2)
        else:
            msg = '{%d, %d, %d, %d}' % (x, y, w, h)

        pdb.gimp_message(msg)
        pyperclip.setcb(msg)
Esempio n. 16
0
def print_selection_bounds(image, drawable, halfsize=False):
    pdb = gimpfu.gimp.pdb
    sel_bounds = pdb.gimp_selection_bounds

    exists, x, y, x2, y2 = sel_bounds(image)

    if not exists:
         pdb.gimp_message('No selection found')
    else:
        w, h = x2-x, y2-y

        if halfsize:
            msg = '{%d, %d, %d, %d}' % (x/2, y/2, w/2, h/2)
        else:
            msg = '{%d, %d, %d, %d}' % (x, y, w, h)

        pdb.gimp_message(msg)
        pyperclip.setcb(msg)
Esempio n. 17
0
def main():
	parser = argparse.ArgumentParser(
	description = 'the argparse'
	)

	parser.add_argument('-a', action='store_true', default=False, dest='get_all')
	parser.add_argument('-d', action='store', dest='domain')
	parser.add_argument('-n', action='store', dest='name')

	args = parser.parse_args()

	db.getDB()
	if args.get_all:
		pw_table = db.getpw()
		if pw_table == None:
			print "The database is empty."
			return
		for pw in pw_table:
			if pw[NAME] == None:
				print pw[DOMAIN] + " :  " + pw[PASSWORD]
			else:
				print pw[DOMAIN] + "|" + pw[NAME] + " :  " + pw[PASSWORD]
	elif args.name !=None and args.domain!= None:
		pw = db.getpw(args.domain, args.name)
		if pw == None:
			print "Not Found!Please try getpw -a"
			return
		pyperclip.setcb(pw[PASSWORD])
		print pw[DOMAIN] + "|" + pw[NAME] + " :  " + pw[PASSWORD]
	elif args.domain != None:
		pw_table = db.getpw(args.domain)
		if pw_table == []:
			print "Not Found!Please try getpw -a"
			return
		for pw in pw_table:
			if pw[NAME] == None:
				print pw[DOMAIN] + " :  " + pw[PASSWORD]
			else:
				print pw[DOMAIN] + "|" + pw[NAME] + " :  " + pw[PASSWORD]
			pyperclip.setcb(pw[PASSWORD])
	else: printUsage()
Esempio n. 18
0
    def find(self, string=''):
        ids = []
        i = 0
        for cpl in self.db.listContent():
            if string in cpl['user'] or string in cpl['web']:
                print("Couple", i + 1)
                print("User   : {}".format(cpl['user']))
                print("Website: {}".format(cpl['web']))
                ids.append(cpl['id'])
                i += 1

        # if we find at least one entry, generate a password for a user selected one
        if i > 0:
            yn = 0
            try:
                inp = input(
                    "Which couple do you want to generate the password for? (empty for none) "
                )
                if inp != '':
                    yn = int(inp)
            except Exception as err:
                print("Problem with your input", err)
                return

            if yn > 0 and yn <= len(ids):
                cpl = self.db.find(ids[yn - 1])
                try:
                    pwd = gen_pwd(cpl['user'],
                                  cpl['web'],
                                  self.masterpwd,
                                  private=self.privatekey,
                                  withpass=self.withpass,
                                  version=cpl['ver'])
                except ValueError:
                    return

                copyto = input("Copy to clipboard? [y/N] ")
                if copyto.lower() == "y" or copyto.lower() == "yes":
                    pyclip.setcb(pwd)
                else:
                    print("Your password is: {}".format(pwd))
Esempio n. 19
0
from pbkdf2 import crypt

password_length = 16

base_phrase = getpass.getpass("Enter base phrase: ")

sanity_check = hashlib.sha256()
sanity_check.update(base_phrase)

print sum([ord(x) for x in sanity_check.digest()])

valid_characters = 'abcdefghijklmnopqrstuvwxyz0123456789.~!@#$%^&*()_+'

while (True):
    door_id = raw_input("Enter door id: ")
    if (door_id == ''):
        break

    key = crypt(door_id, base_phrase, 1000)
    key_data = hashlib.sha256()
    key_data.update(key)

    password = ''.join([
        valid_characters[ord(x) % len(valid_characters)]
        for x in key_data.digest()
    ][:password_length])
    pyperclip.setcb(password)
    print pyperclip.getcb()

os.system('clear')
Esempio n. 20
0
# You can use this under a BSD license
# based on the original web page by Nic Wolff http://angel.net/~nic/passwd.current.html ,
# which was public domain at the time of derivation

# replicate what the bookmarklets do, using python, so can run from console

import sys
import os
import sha
import base64
import getpass
import pyperclip

if len(sys.argv) == 2:
    domain = sys.argv[1]
else:
    domain = raw_input("Please enter domain: ")
masterpassword = getpass.getpass("Please enter master password for " + domain + ": ")

mysha =  sha.new(masterpassword + ":" + domain ).digest()

b64 = base64.b64encode(mysha)
pw = b64[:16]
#print "Password for " + domain + " is " + pw

print "Password has been copied to your clipboard"

pyperclip.setcb(pw)

Esempio n. 21
0
		    position=1  # line does not exists go back to line 1
		    config.set("General", "lastmsg", line)	    
		    updatesettings(True)
		linecache.clearcache();
"""		
#end of loop

try:
	material=line.split("|");
	beforesep=material[0]
	aftersep=material[1]
except:
	beforesep=os.path.basename(Currentfile) + " line:" + str(position);
	aftersep=line
	
# its time to show the popup	
sendmessage(beforesep ,aftersep);

if changepos :
	textfilepos=textfilepos+1
	if textfilepos >=len(files):
				    textfilepos=0
	Currentfile= files[textfilepos];
	updatesettings(False)
else:
	pyperclip.setcb(aftersep)




Esempio n. 22
0
def pasteFromObjectInfoList(objInfoList):
    ntext = udkComposer.unrTextFromObjects(objInfoList)
    pyperclip.setcb(ntext)
    pasteFromClipboard()
Esempio n. 23
0
def pasteFromObjectInfoList(objInfoList):
    ntext = udkComposer.unrTextFromObjects(objInfoList)
    pyperclip.setcb(ntext)
    pasteFromClipboard()
Esempio n. 24
0
def pop():
    """ Pops the stack. """
    clipboard = load_cb()
    if len(clipboard) > 0:
        pyperclip.setcb(clipboard.pop())
    save_cb(clipboard)
Esempio n. 25
0
def copyToClipBoard(what):
	pyperclip.setcb(what)
Esempio n. 26
0
    def generate(self, options=None):
        """
        Generates a password, the options are command (new or regen), the user and website.
        If only two options are given then assume that it's a "new" command.
        """
        if not self.isInitialized:
            print("The manager is not initialized, use the help command to see how to do it.")
            return

        options = options.split()

        if len(options) < 2:
            print("Too few options, please provide a user and a website.")
            return
        elif options[0] == "new" and len(options) == 3:
            cmd = "new"
            options = options[1:]
        elif options[0] == "regen" and len(options) == 3:
            cmd = "regen"
            options = options[1:]
        elif len(options) > 2:
            print("Too many options, please provide a user and a website.")
            return
        else:
            cmd = "new"

        h = sha.new()
        h.update("{}@{}".format(options[0].strip(),options[1].strip()).encode('utf-8'))
        cpl = self.db.find(h.hexdigest())

        if cmd == "new" or cpl == None:

            #if the user asks for a password and we have the couple in our possesion, retrieve the version
            if cpl is not None:
                v = cpl['ver']
            else:
                v = -1

            try:
                pwd = gen_pwd(options[0].strip(), options[1].strip(), self.masterpwd, private=self.privatekey, withpass=self.withpass, version = v)
            except ValueError:
                return

            copyto = input("Copy to clipboard? [y/N] ")
            if copyto.lower() == "y" or copyto.lower() == "yes":
                pyclip.setcb(pwd)
            else:
                print("Your password is: {}".format(pwd))

            self.db.storeInDB(options[0],options[1])
                
        elif cmd == "regen":

            yn = input("Do you want to regenerate the password for the couple {} {}? [Y/n] ".format(cpl['user'],cpl['web']))

            if yn == "" or yn.lower() == "y" or yn.lower() == "yes":
                v = cpl['ver'] + 1
                try:
                    pwd = gen_pwd(options[0].strip(), options[1].strip(), self.masterpwd, private=self.privatekey, withpass=self.withpass, version = v)
                except ValueError:
                    return

                copyto = input("Copy to clipboard? [y/N] ")
                if copyto.lower() == "y" or copyto.lower() == "yes":
                    pyclip.setcb(pwd)
                else:
                    print("Your password is: {}".format(pwd))

                self.db.storeInDB(options[0],options[1], version = v)
        else :
            print("Unknown option")
Esempio n. 27
0
def insertTable(_no, _name, _tel, _etc):
    pyperclip.setcb("abcdedadf")
    spam = pyperclip.getcb()
Esempio n. 28
0
def copy_to_clipboard(some_string):
    if type(some_string) != str:
        return
    pyperclip.setcb(some_string)
Esempio n. 29
0
			    config.set("General", "lastmsg", line)
			    updatesettings(True)
		else:
		    # update current file position
		    position=1  # line does not exists go back to line 1
		    config.set("General", "lastmsg", line)	    
		    updatesettings(True)
		linecache.clearcache();
"""
#end of loop

try:
    material = line.split("|")
    beforesep = material[0]
    aftersep = material[1]
except:
    beforesep = os.path.basename(Currentfile) + " line:" + str(position)
    aftersep = line

# its time to show the popup
sendmessage(beforesep, aftersep)

if changepos:
    textfilepos = textfilepos + 1
    if textfilepos >= len(files):
        textfilepos = 0
    Currentfile = files[textfilepos]
    updatesettings(False)
else:
    pyperclip.setcb(aftersep)
# Version 1.0 was proudly created by Xinmei Wang (May).

import pyperclip

def cal(r, g, b):
    return r << 16 | g << 8 | b

def rgb(r,g,b,c):  
    c = cal(r,g,b)
    return hex(c)

print("Hello Designer. Welcome to Python \'RGB -> Hexadecimal Value Converter\'")
input_r = int(raw_input("input the integer value of R: "))
input_g = int(raw_input("input the integer value of G: "))
input_b = int(raw_input("input the integer value of B: "))

d = str(rgb(input_r, input_g, input_b, 0))


pyperclip.setcb('#'+d[2:])
clipboard_content = pyperclip.getcb()
print 'the Hexadecimal Value of inputted RGB color is in your clipboard'
print clipboard_content


Esempio n. 31
0
    print('Comment: (type .. to finish)\n')
    scores['Comments'] = ''
    for i in comments:
        print('{}. {}'.format(i, comments[i]))
    while True:
        comment_num = raw_input('')
        if comment_num in comments.keys():
            scores['Comments'] += comments[comment_num] + '\n'
        if comment_num == '..':
            break
    print('Additional comment (type .. to finish):\n')
    for line in iter(raw_input, sentinel):
        text += '\n' + line # do things here
    scores['Comments'] += text

    sys.stdout.flush()
    feedback = ['Design\n {}/{}\n'.format(scores['Design'], stats['Design']),
        'Files read and write properly. Skills works as expected\n {}/{}\n'.format(scores['File I/O'], stats['File I/O']),
        'Functions called correctly and parameters passed correctly\n {}/{}\n'.format(scores['Functions'], stats['Functions']),
        'Code is written legibly (formatting, comments, etc)\n {}/{}\n'.format(scores['Formatting'], stats['Formatting']),
        'Program compiles correctly\n {}/{}\n'.format(scores['Compile'], stats['Compile']),
        'Output is as indicated\n {}/{}\n'.format(scores['Output'], stats['Output']),
        'Additional comments\n {}\n'.format(scores['Comments']),
        'Total\n {}/{}\n'.format(total, total_vals)]
    # copy text to clipboard
    pyperclip.setcb(''.join(feedback))

    # local echo of results
    print "*" * 40 + '\n'
    print ''.join(feedback)
    print "*" * 40 + '\n'
Esempio n. 32
0
def copyToClipboard(letter):
    pyperclip.setcb(letter)
    print "The cover letter has been appended to the system clipboard. Enjoy!"
Esempio n. 33
0
    subprocess.Popen(['notify-send', title, message])
    return

def get_interface_ip(ifname):
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    return socket.inet_ntoa(fcntl.ioctl(s.fileno(), 0x8915, struct.pack('256s',
                                ifname[:15]))[20:24])

link = p.protocol + '://'
if p.get_ip_from is 'properties':
	link += p.ip
elif p.get_ip_from is 'system':
	link += get_interface_ip(p.interface)

if p.enable_port:
	link += ':' + str(p.port)

link += '/public/' + sys.argv[3]

if len(sys.argv) is 4:
	if sys.argv[1] == 'copy':
		call(["cp", sys.argv[2] + '/' + sys.argv[3], p.public_dir])
	elif sys.argv[1] == 'move':
		call(["mv", sys.argv[2] + '/' + sys.argv[3], p.public_dir])
else:
	exit()

pyperclip.setcb(link.replace(' ', '%20'))

if p.notify:
	sendmessage(link)
Esempio n. 34
0
def copy_emoji():
  pyperclip.setcb(get_emoji())
Esempio n. 35
0
import hashlib
import getpass
import pyperclip
from pbkdf2 import crypt

password_length = 16

base_phrase = getpass.getpass("Enter base phrase: ")

sanity_check = hashlib.sha256()
sanity_check.update(base_phrase)

print sum([ord(x) for x in sanity_check.digest()])

valid_characters = 'abcdefghijklmnopqrstuvwxyz0123456789.~!@#$%^&*()_+'

while (True):
    door_id = raw_input("Enter door id: ")
    if (door_id == ''):
        break

    key = crypt(door_id, base_phrase, 1000)
    key_data = hashlib.sha256()
    key_data.update(key)

    password = ''.join([valid_characters[ord(x) % len(valid_characters)] for x in key_data.digest()][:password_length])
    pyperclip.setcb(password)
    print pyperclip.getcb()

os.system('clear')
Esempio n. 36
0
    def generate(self, options=None):
        """
        Generates a password, the options are command (new or regen), the user and website.
        If only two options are given then assume that it's a "new" command.
        """
        if not self.isInitialized:
            print(
                "The manager is not initialized, use the help command to see how to do it."
            )
            return

        options = options.split()

        if len(options) < 2:
            print("Too few options, please provide a user and a website.")
            return
        elif options[0] == "new" and len(options) == 3:
            cmd = "new"
            options = options[1:]
        elif options[0] == "regen" and len(options) == 3:
            cmd = "regen"
            options = options[1:]
        elif len(options) > 2:
            print("Too many options, please provide a user and a website.")
            return
        else:
            cmd = "new"

        h = sha.new()
        h.update("{}@{}".format(options[0].strip(),
                                options[1].strip()).encode('utf-8'))
        cpl = self.db.find(h.hexdigest())

        if cmd == "new" or cpl == None:

            #if the user asks for a password and we have the couple in our possesion, retrieve the version
            if cpl is not None:
                v = cpl['ver']
            else:
                v = -1

            try:
                pwd = gen_pwd(options[0].strip(),
                              options[1].strip(),
                              self.masterpwd,
                              private=self.privatekey,
                              withpass=self.withpass,
                              version=v)
            except ValueError:
                return

            copyto = input("Copy to clipboard? [y/N] ")
            if copyto.lower() == "y" or copyto.lower() == "yes":
                pyclip.setcb(pwd)
            else:
                print("Your password is: {}".format(pwd))

            self.db.storeInDB(options[0], options[1])

        elif cmd == "regen":

            yn = input(
                "Do you want to regenerate the password for the couple {} {}? [Y/n] "
                .format(cpl['user'], cpl['web']))

            if yn == "" or yn.lower() == "y" or yn.lower() == "yes":
                v = cpl['ver'] + 1
                try:
                    pwd = gen_pwd(options[0].strip(),
                                  options[1].strip(),
                                  self.masterpwd,
                                  private=self.privatekey,
                                  withpass=self.withpass,
                                  version=v)
                except ValueError:
                    return

                copyto = input("Copy to clipboard? [y/N] ")
                if copyto.lower() == "y" or copyto.lower() == "yes":
                    pyclip.setcb(pwd)
                else:
                    print("Your password is: {}".format(pwd))

                self.db.storeInDB(options[0], options[1], version=v)
        else:
            print("Unknown option")