CAT | Windows
493 viewsThe following bit of code, which requires the win32api, simulates a mouse click using Python under the Windows OS.
import win32api, win32con
def click(x,y):
win32api.SetCursorPos((x,y))
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
click(100, 100) # simulate mouse click at 100px, 100px
Here is some example code to connect to an FTP server and run the commands that follow.
@echo on %windir%\system32\ftp.exe -n -s:"%~f0" server.com goto done user myusername mypassword cd /home/directory/public_html ls -al quit :done pause
The key to this working are the following:
The -n switch allows you to not be prompted for a username upon connection.
The -s:”%~f0″ says to use the rest of the file as the commands to execute
The goto command is not a valid FTP command, so the FTP server ignores it.
So you have the script using the Windows FTP utility to connect to a server and a routine running your commands. You can even extend off of this.
20
Python Print Screen and Save Image in Windows
0 Comments | Posted by Spechal in Python, Windows
So you need to do a “Print Screen” and save the image in the clipboard huh? I had that exact need too. Let me save you a few hours of trouble and tell you that the win32clipboard does not yet have the ability to return the contents of the clipboard when the contents are BITMAP, despite the CF_BITMAP constant.
How do you do it then? I was wondering the same thing. Behold, PIL. PIL, the Python Image Library, saved me from a massive headache.
Here is the code to take a screen shot and save it. You will need the win32api and PIL libraries.
import win32api, win32con, ImageGrab
win32api.keybd_event(win32con.VK_SNAPSHOT, 1)
im = ImageGrab.grabclipboard()
im.save("screenshot.jpg", "JPEG")
Now wasn’t that easy!
Yet another activation bypass crack has been released into the wild and is getting massive attention. This one doesn’t even require a license key at all!
Read more at Gizmodo … http://gizmodo.com/5404781/windows-7-hacked-again-for-keyless-activation
