Skip to content

Commit

Permalink
v0.1
Browse files Browse the repository at this point in the history
First commit.
  • Loading branch information
codefitz committed Sep 22, 2020
1 parent 4348f2f commit 30ea638
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

*.pyc
*.toc
build/pasta/base_library.zip
build/pasta/pasta.exe.manifest
build/pasta/PKG-00.pkg
build/pasta/PYZ-00.pyz
build/pasta/warn-pasta.txt
build/pasta/xref-pasta.html
*.exe
test.py
pasta.spec
Binary file added 2bf244f3161541a1a0a0949e5f0a0b18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 4c91b4ec95d542dab9234bc67db414c7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,58 @@
# Pasta
A small app for one way pasting text in desktop environments where copy and paste is disabled from client to server.

| Version |
| - |
| 0.1 |

[[TOC]]

## Summary

A small app for working with remote environments (such as Citrix) where copy and paste functionality has been disabled.

Pasta uses modules like pyautogui and keyboard to read the text in your clipboard and will re-type the text wherever you place the mouse pointer (even inside of a virtual environment).

Because this is not true copy and paste functionality, there may be bugs - particularly on non-QWERTY keyboards. Use at your own discretion.

## OS Support

| OS | Support |
| - | -
| **Windows** | Yes |
| **Linux** | Maybe? |
| **Mac** | No |

## How to Use

1. Copy the block of text you need

![25746d229aa12bd0e564baf4a84191fd.png](:/4c91b4ec95d542dab9234bc67db414c7)

3. Run the executable "pasta.exe"
4. Have your Notepad/Text app open on the target desktop

![74504af49ab7995705350aa91f8bca9d.png](:/2bf244f3161541a1a0a0949e5f0a0b18)

5. Click the "Ready" button
6. During the 3 second countdown, hover over your target window
7. Marvel at how quickly you typed that document!

![0b24d3d5c5973d435c76f67c6e390aa0.png](:/f1956e3209c5413ba13db32ccc0581f4)

# FAQ

### Can this copy rich text format or pictures?

No, this is using modules that are only capable of using keyboard functionality - text only.

### Will it work on a MacBook?

Not yet.

### Does this connect to the internet?

No. It only handles text that is already available on the client system that the user could already type by hand. There are no API calls or anything like that.

### This is a hacker tool!

Only if you consider logging into a Citrix desktop as an authorised user and painstakingly typing out lots of text or code manually - to be a hacker activity.
Binary file added f1956e3209c5413ba13db32ccc0581f4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
104 changes: 104 additions & 0 deletions pasta.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Pasta - One Way Super-Paste
#
# Author: Wes Moskal-Fitzpatrick
#
# Created to get around frustration of working with remote desktop
# configurations (usually Citrix) where copy and paste is disabled.
#
# Pasta uses pyautogui and keyboard to re-type text stored in the
# clipboard as you would with your human digits, only thousands of
# times faster.
#
# Change History
# --------------
# 2020-09-22 : 0.1 : WMF : Created. Ignore the comments.
#

import tkinter
import time
import pyautogui
import win32api
import keyboard

def countDown():
'''start countdown seconds'''
#clock.config(bg='yellow')
for k in range(3, -1, -1):
clock["text"] = k
time.sleep(1)
root.update() # Tk needs this after sleep()
# clock.config(bg='red')
clock["text"] = "Done"

root = tkinter.Tk()
root.geometry("200x100")
root.title('Pasta')
root.attributes("-topmost", True)

def submitFunction():
global clipboard
button.place_forget()
countDown()
# Click into window
x, y = pyautogui.position()
pyautogui.click(x, y)
# Special Characters
#clipboard = clipboard.replace("#", "\#")
# Paste / Type

#print(clipboard)
#pyautogui.typewrite(clipboard)
#print(pyautogui._pyautogui_win.keyboardMapping['@'])
#print()
#pyautogui.platformModule.keyboardMapping['#'] = 478
#print(pyautogui._pyautogui_win.keyboardMapping['~'])

#default_layout = win32api.GetKeyboardLayout()
#print (default_layout)
#print (hex(default_layout))

#win32api.LoadKeyboardLayout('00000409',1) # to switch to US english
#print (win32api.GetKeyboardLayout())
#win32api.LoadKeyboardLayout(default_layout,1) # switch back
#print (win32api.GetKeyboardLayout())

#pyautogui.typewrite("###")
keyboard.write(clipboard)
ready.set(1)
#root.destroy()

# label_font = ('helvetica', 40)
# clock = tkinter.Label(font=label_font)

clipboard = root.clipboard_get()

clock = tkinter.Label()
clock.place(relx=.5, rely=.7, anchor="c")

ready = tkinter.IntVar()
info = tkinter.Label(text="Click 'Ready' and select the window to paste to...", wraplength=150, justify="left")
info.place(relx=.1, rely=.1)
button = tkinter.Button(root, text="Ready", command=submitFunction)
button.place(relx=.5, rely=.7, anchor="c")

root.wait_variable(ready)

# root.mainloop()

#--------

#B1 = tkinter.Button(root, text ="circle", cursor="circle")
#B2 = tkinter.Button(root, text ="plus", cursor="plus")
#B1.pack()
#B2.pack()
#root.mainloop()

#--------

#var = tkinter.IntVar()
#button = tkinter.Button(root, text="Ready", command=lambda: var.set(1))
#button.place(relx=.5, rely=.8, anchor="c")

#print("Ready to paste...")
#button.wait_variable(var)
#print("Paste Now.")

0 comments on commit 30ea638

Please sign in to comment.