Advertisement
Guest User

Untitled

a guest
Feb 15th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.79 KB | None | 0 0
  1.  
  2. #Persistent
  3. #SingleInstance ignore
  4. SetBatchLines, 10ms
  5.  
  6.  
  7. RC4Pass = pitarulla
  8.  
  9.  
  10.  
  11. Menu, tray, NoStandard
  12. Menu, tray, add, FTP asetukset, Asetukset
  13. Menu, tray, add,
  14. Menu, tray, add, Ota kuvankaappaus, kaappaus
  15. Menu, tray, add, Poistu, Exitapp
  16.  
  17. IniRead, server, %A_workingdir%\Asetukset.ini, yhdistys, palvelin
  18. IniRead, portti, %A_workingdir%\Asetukset.ini, yhdistys, portti
  19. IniRead, user, %A_workingdir%\Asetukset.ini, yhdistys, user
  20. IniRead, password, %A_workingdir%\Asetukset.ini, yhdistys, password
  21. IniRead, remotedir, %A_workingdir%\Asetukset.ini, yhdistys, remotedir
  22. Iniread, remotedirectory, %A_workingdir%\Asetukset.ini, yhdistys, remotedirectory
  23.  
  24. RC4Dec := RC4hex2txt(password,RC4Pass)
  25.  
  26. gui, add, text,,Palvelin
  27. gui, add, edit,w160 vserver, %server%
  28. gui, add, text,, Portti
  29. gui, add, edit, w20 h20 limit2 vportti, %portti%
  30. gui, add, text,, Käyttäjä
  31. gui, add, edit,w160 vuser, %user%
  32. gui, add, text,, Salasana
  33. gui, add, edit,w160 +password vpassword, %RC4Dec%
  34. gui, add, text,, Etäkansio
  35. gui, add, edit, vremotedir w160, %remotedir%
  36. gui, add, text,, Julkinen Osoite
  37. gui, add, edit, vremotedirectory w250, %remotedirectory%
  38. gui, add, button, gTallenna, Tallenna
  39.  
  40. gui 2: add, edit, w200 vnewurl,
  41. Return
  42. #PrintScreen::
  43. kaappaus:
  44. nyt = %A_now%
  45. newFileName := nyt ".jpg"
  46. CaptureScreen(0, False, newFileName, 100)
  47. local = %nyt%.jpg
  48. remotefile = %nyt%.jpg
  49.  
  50. ifnotexist %local%
  51. {
  52. Msgbox , Local puuttuu soita poliisit
  53. exitapp
  54. }
  55. FtpOpen(server,port,user,password)
  56. FtpSetCurrentDirectory("/"remotedir)
  57. FtpPutFile(local,remotefile)
  58. FtpClose()
  59. clipboard = %remotedirectory%%remotefile%
  60.  
  61. filedelete, %A_workingdir%\%nyt%.jpg
  62. return
  63.  
  64.  
  65.  
  66.  
  67. Asetukset:
  68.  
  69. Gui, show
  70. Return
  71.  
  72. ExitApp:
  73. Exitapp
  74. Return
  75.  
  76. Tallenna:
  77. Gui, submit
  78. passu := RC4txt2hex(password,RC4Pass)
  79. IniWrite, %server%, %A_workingdir%\Asetukset.ini, yhdistys, palvelin
  80. IniWrite, %portti%, %A_workingdir%\Asetukset.ini, yhdistys, portti
  81. IniWrite, %user%, %A_workingdir%\Asetukset.ini, yhdistys, user
  82. IniWrite, %passu%, %A_workingdir%\Asetukset.ini, yhdistys, password
  83. IniWrite, %remotedir%, %A_workingdir%\Asetukset.ini, yhdistys, remotedir
  84. IniWrite, %remotedirectory%, %A_workingdir%\Asetukset.ini, yhdistys, remotedirectory
  85. Msgbox, Asetukset tallennettu.
  86. Return
  87.  
  88.  
  89.  
  90. ;________________________FUNKTIOT________________________________
  91. CaptureScreen(aRect = 0, bCursor = False, sFile = "", nQuality = "")
  92. {
  93. If !aRect
  94. {
  95. SysGet, nL, 76
  96. SysGet, nT, 77
  97. SysGet, nW, 78
  98. SysGet, nH, 79
  99. }
  100. Else If aRect = 1
  101. WinGetPos, nL, nT, nW, nH, A
  102. Else If aRect = 2
  103. {
  104. WinGet, hWnd, ID, A
  105. VarSetCapacity(rt, 16, 0)
  106. DllCall("GetClientRect" , "Uint", hWnd, "Uint", &rt)
  107. DllCall("ClientToScreen", "Uint", hWnd, "Uint", &rt)
  108. nL := NumGet(rt, 0, "int")
  109. nT := NumGet(rt, 4, "int")
  110. nW := NumGet(rt, 8)
  111. nH := NumGet(rt,12)
  112. }
  113. Else If aRect = 3
  114. {
  115. VarSetCapacity(mi, 40, 0)
  116. DllCall("GetCursorPos", "int64P", pt)
  117. DllCall("GetMonitorInfo", "Uint", DllCall("MonitorFromPoint", "int64", pt, "Uint", 2), "Uint", NumPut(40,mi)-4)
  118. nL := NumGet(mi, 4, "int")
  119. nT := NumGet(mi, 8, "int")
  120. nW := NumGet(mi,12, "int") - nL
  121. nH := NumGet(mi,16, "int") - nT
  122. }
  123. Else
  124. {
  125. StringSplit, rt, aRect, `,, %A_Space%%A_Tab%
  126. nL := rt1
  127. nT := rt2
  128. nW := rt3 - rt1
  129. nH := rt4 - rt2
  130. znW := rt5
  131. znH := rt6
  132. }
  133.  
  134. mDC := DllCall("CreateCompatibleDC", "Uint", 0)
  135. hBM := CreateDIBSection(mDC, nW, nH)
  136. oBM := DllCall("SelectObject", "Uint", mDC, "Uint", hBM)
  137. hDC := DllCall("GetDC", "Uint", 0)
  138. DllCall("BitBlt", "Uint", mDC, "int", 0, "int", 0, "int", nW, "int", nH, "Uint", hDC, "int", nL, "int", nT, "Uint", 0x40000000 | 0x00CC0020)
  139. DllCall("ReleaseDC", "Uint", 0, "Uint", hDC)
  140. If bCursor
  141. CaptureCursor(mDC, nL, nT)
  142. DllCall("SelectObject", "Uint", mDC, "Uint", oBM)
  143. DllCall("DeleteDC", "Uint", mDC)
  144. If znW && znH
  145. hBM := Zoomer(hBM, nW, nH, znW, znH)
  146. If sFile = 0
  147. SetClipboardData(hBM)
  148. Else Convert(hBM, sFile, nQuality), DllCall("DeleteObject", "Uint", hBM)
  149. }
  150.  
  151. CaptureCursor(hDC, nL, nT)
  152. {
  153. VarSetCapacity(mi, 20, 0)
  154. mi := Chr(20)
  155. DllCall("GetCursorInfo", "Uint", &mi)
  156. bShow := NumGet(mi, 4)
  157. hCursor := NumGet(mi, 8)
  158. xCursor := NumGet(mi,12)
  159. yCursor := NumGet(mi,16)
  160.  
  161. VarSetCapacity(ni, 20, 0)
  162. DllCall("GetIconInfo", "Uint", hCursor, "Uint", &ni)
  163. xHotspot := NumGet(ni, 4)
  164. yHotspot := NumGet(ni, 8)
  165. hBMMask := NumGet(ni,12)
  166. hBMColor := NumGet(ni,16)
  167.  
  168. If bShow
  169. DllCall("DrawIcon", "Uint", hDC, "int", xCursor - xHotspot - nL, "int", yCursor - yHotspot - nT, "Uint", hCursor)
  170. If hBMMask
  171. DllCall("DeleteObject", "Uint", hBMMask)
  172. If hBMColor
  173. DllCall("DeleteObject", "Uint", hBMColor)
  174. }
  175.  
  176. Zoomer(hBM, nW, nH, znW, znH)
  177. {
  178. mDC1 := DllCall("CreateCompatibleDC", "Uint", 0)
  179. mDC2 := DllCall("CreateCompatibleDC", "Uint", 0)
  180. zhBM := CreateDIBSection(mDC2, znW, znH)
  181. oBM1 := DllCall("SelectObject", "Uint", mDC1, "Uint", hBM)
  182. oBM2 := DllCall("SelectObject", "Uint", mDC2, "Uint", zhBM)
  183. DllCall("SetStretchBltMode", "Uint", mDC2, "int", 4)
  184. DllCall("StretchBlt", "Uint", mDC2, "int", 0, "int", 0, "int", znW, "int", znH, "Uint", mDC1, "int", 0, "int", 0, "int", nW, "int", nH, "Uint", 0x00CC0020)
  185. DllCall("SelectObject", "Uint", mDC1, "Uint", oBM1)
  186. DllCall("SelectObject", "Uint", mDC2, "Uint", oBM2)
  187. DllCall("DeleteDC", "Uint", mDC1)
  188. DllCall("DeleteDC", "Uint", mDC2)
  189. DllCall("DeleteObject", "Uint", hBM)
  190. Return zhBM
  191. }
  192.  
  193. Convert(sFileFr = "", sFileTo = "", nQuality = "")
  194. {
  195. If sFileTo =
  196. sFileTo := A_ScriptDir . "\screen.bmp"
  197. SplitPath, sFileTo, , sDirTo, sExtTo, sNameTo
  198.  
  199. If Not hGdiPlus := DllCall("LoadLibrary", "str", "gdiplus.dll")
  200. Return sFileFr+0 ? SaveHBITMAPToFile(sFileFr, sDirTo . "\" . sNameTo . ".bmp") : ""
  201. VarSetCapacity(si, 16, 0), si := Chr(1)
  202. DllCall("gdiplus\GdiplusStartup", "UintP", pToken, "Uint", &si, "Uint", 0)
  203.  
  204. If !sFileFr
  205. {
  206. DllCall("OpenClipboard", "Uint", 0)
  207. If DllCall("IsClipboardFormatAvailable", "Uint", 2) && (hBM:=DllCall("GetClipboardData", "Uint", 2))
  208. DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "Uint", hBM, "Uint", 0, "UintP", pImage)
  209. DllCall("CloseClipboard")
  210. }
  211. Else If sFileFr Is Integer
  212. DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "Uint", sFileFr, "Uint", 0, "UintP", pImage)
  213. Else DllCall("gdiplus\GdipLoadImageFromFile", "Uint", Unicode4Ansi(wFileFr,sFileFr), "UintP", pImage)
  214.  
  215. DllCall("gdiplus\GdipGetImageEncodersSize", "UintP", nCount, "UintP", nSize)
  216. VarSetCapacity(ci,nSize,0)
  217. DllCall("gdiplus\GdipGetImageEncoders", "Uint", nCount, "Uint", nSize, "Uint", &ci)
  218. Loop, % nCount
  219. If InStr(Ansi4Unicode(NumGet(ci,76*(A_Index-1)+44)), "." . sExtTo)
  220. {
  221. pCodec := &ci+76*(A_Index-1)
  222. Break
  223. }
  224. If InStr(".JPG.JPEG.JPE.JFIF", "." . sExtTo) && nQuality<>"" && pImage && pCodec
  225. {
  226. DllCall("gdiplus\GdipGetEncoderParameterListSize", "Uint", pImage, "Uint", pCodec, "UintP", nSize)
  227. VarSetCapacity(pi,nSize,0)
  228. DllCall("gdiplus\GdipGetEncoderParameterList", "Uint", pImage, "Uint", pCodec, "Uint", nSize, "Uint", &pi)
  229. Loop, % NumGet(pi)
  230. If NumGet(pi,28*(A_Index-1)+20)=1 && NumGet(pi,28*(A_Index-1)+24)=6
  231. {
  232. pParam := &pi+28*(A_Index-1)
  233. NumPut(nQuality,NumGet(NumPut(4,NumPut(1,pParam+0)+20)))
  234. Break
  235. }
  236. }
  237.  
  238. If pImage
  239. pCodec ? DllCall("gdiplus\GdipSaveImageToFile", "Uint", pImage, "Uint", Unicode4Ansi(wFileTo,sFileTo), "Uint", pCodec, "Uint", pParam) : DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", "Uint", pImage, "UintP", hBitmap, "Uint", 0) . SetClipboardData(hBitmap), DllCall("gdiplus\GdipDisposeImage", "Uint", pImage)
  240.  
  241. DllCall("gdiplus\GdiplusShutdown" , "Uint", pToken)
  242. DllCall("FreeLibrary", "Uint", hGdiPlus)
  243. }
  244.  
  245. CreateDIBSection(hDC, nW, nH, bpp = 32, ByRef pBits = "")
  246. {
  247. NumPut(VarSetCapacity(bi, 40, 0), bi)
  248. NumPut(nW, bi, 4)
  249. NumPut(nH, bi, 8)
  250. NumPut(bpp, NumPut(1, bi, 12, "UShort"), 0, "Ushort")
  251. NumPut(0, bi,16)
  252. Return DllCall("gdi32\CreateDIBSection", "Uint", hDC, "Uint", &bi, "Uint", 0, "UintP", pBits, "Uint", 0, "Uint", 0)
  253. }
  254.  
  255. SaveHBITMAPToFile(hBitmap, sFile)
  256. {
  257. DllCall("GetObject", "Uint", hBitmap, "int", VarSetCapacity(oi,84,0), "Uint", &oi)
  258. hFile:= DllCall("CreateFile", "Uint", &sFile, "Uint", 0x40000000, "Uint", 0, "Uint", 0, "Uint", 2, "Uint", 0, "Uint", 0)
  259. DllCall("WriteFile", "Uint", hFile, "int64P", 0x4D42|14+40+NumGet(oi,44)<<16, "Uint", 6, "UintP", 0, "Uint", 0)
  260. DllCall("WriteFile", "Uint", hFile, "int64P", 54<<32, "Uint", 8, "UintP", 0, "Uint", 0)
  261. DllCall("WriteFile", "Uint", hFile, "Uint", &oi+24, "Uint", 40, "UintP", 0, "Uint", 0)
  262. DllCall("WriteFile", "Uint", hFile, "Uint", NumGet(oi,20), "Uint", NumGet(oi,44), "UintP", 0, "Uint", 0)
  263. DllCall("CloseHandle", "Uint", hFile)
  264. }
  265.  
  266. SetClipboardData(hBitmap)
  267. {
  268. DllCall("GetObject", "Uint", hBitmap, "int", VarSetCapacity(oi,84,0), "Uint", &oi)
  269. hDIB := DllCall("GlobalAlloc", "Uint", 2, "Uint", 40+NumGet(oi,44))
  270. pDIB := DllCall("GlobalLock", "Uint", hDIB)
  271. DllCall("RtlMoveMemory", "Uint", pDIB, "Uint", &oi+24, "Uint", 40)
  272. DllCall("RtlMoveMemory", "Uint", pDIB+40, "Uint", NumGet(oi,20), "Uint", NumGet(oi,44))
  273. DllCall("GlobalUnlock", "Uint", hDIB)
  274. DllCall("DeleteObject", "Uint", hBitmap)
  275. DllCall("OpenClipboard", "Uint", 0)
  276. DllCall("EmptyClipboard")
  277. DllCall("SetClipboardData", "Uint", 8, "Uint", hDIB)
  278. DllCall("CloseClipboard")
  279. }
  280.  
  281. Unicode4Ansi(ByRef wString, sString)
  282. {
  283. nSize := DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &sString, "int", -1, "Uint", 0, "int", 0)
  284. VarSetCapacity(wString, nSize * 2)
  285. DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &sString, "int", -1, "Uint", &wString, "int", nSize)
  286. Return &wString
  287. }
  288.  
  289. Ansi4Unicode(pString)
  290. {
  291. nSize := DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "Uint", pString, "int", -1, "Uint", 0, "int", 0, "Uint", 0, "Uint", 0)
  292. VarSetCapacity(sString, nSize)
  293. DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "Uint", pString, "int", -1, "str", sString, "int", nSize, "Uint", 0, "Uint", 0)
  294. Return sString
  295. }
  296.  
  297.  
  298.  
  299.  
  300.  
  301. FtpOpen(Server, Port=21, Username=0, Password=0 ,Proxy="", ProxyBypass="") {
  302. IfEqual, Username, 0, SetEnv, Username, anonymous
  303. IfEqual, Password, 0, SetEnv, Password, anonymous
  304.  
  305. If (Proxy != "")
  306. AccessType=3
  307. Else
  308. AccessType=1
  309. ;#define INTERNET_OPEN_TYPE_PRECONFIG 0 // use registry configuration
  310. ;#define INTERNET_OPEN_TYPE_DIRECT 1 // direct to net
  311. ;#define INTERNET_OPEN_TYPE_PROXY 3 // via named proxy
  312. ;#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4 // prevent using java/script/INS
  313.  
  314. global ic_hInternet, io_hInternet, hModule
  315. hModule := DllCall("LoadLibrary", "str", "wininet.dll")
  316.  
  317. io_hInternet := DllCall("wininet\InternetOpenA"
  318. , "str", A_ScriptName ;lpszAgent
  319. , "UInt", AccessType
  320. , "str", Proxy
  321. , "str", ProxyBypass
  322. , "UInt", 0) ;dwFlags
  323.  
  324. If (ErrorLevel != 0 or io_hInternet = 0) {
  325. FtpClose()
  326. return 0
  327. }
  328.  
  329. ic_hInternet := DllCall("wininet\InternetConnectA"
  330. , "uint", io_hInternet
  331. , "str", Server
  332. , "uint", Port
  333. , "str", Username
  334. , "str", Password
  335. , "uint" , 1 ;dwService (INTERNET_SERVICE_FTP = 1)
  336. , "uint", 0 ;dwFlags
  337. , "uint", 0) ;dwContext
  338.  
  339. If (ErrorLevel != 0 or ic_hInternet = 0)
  340. return 0
  341. else
  342. return 1
  343. }
  344.  
  345. FtpClose() {
  346. global ic_hInternet, io_hInternet, hModule
  347. DllCall("wininet\InternetCloseHandle", "UInt", ic_hInternet)
  348. DllCall("wininet\InternetCloseHandle", "UInt", io_hInternet)
  349. DllCall("FreeLibrary", "UInt", hModule)
  350. }
  351.  
  352. FtpSetCurrentDirectory(DirName) {
  353. global ic_hInternet
  354. r := DllCall("wininet\FtpSetCurrentDirectoryA", "uint", ic_hInternet, "str", DirName)
  355. If (ErrorLevel != 0 or r = 0)
  356. return 0
  357. else
  358. return 1
  359. }
  360.  
  361. FtpPutFile(LocalFile, NewRemoteFile="", Flags=0) {
  362. ;Flags:
  363. ;FTP_TRANSFER_TYPE_UNKNOWN = 0 (Defaults to FTP_TRANSFER_TYPE_BINARY)
  364. ;FTP_TRANSFER_TYPE_ASCII = 1
  365. ;FTP_TRANSFER_TYPE_BINARY = 2
  366. If NewRemoteFile=
  367. NewRemoteFile := LocalFile
  368. global ic_hInternet
  369. r := DllCall("wininet\FtpPutFileA"
  370. , "uint", ic_hInternet
  371. , "str", LocalFile
  372. , "str", NewRemoteFile
  373. , "uint", Flags
  374. , "uint", 0) ;dwContext
  375. If (ErrorLevel != 0 or r = 0)
  376. return 0
  377. else
  378. return 1
  379. }
  380.  
  381.  
  382. RC4txt2hex(Data,Pass) {
  383. Format := A_FormatInteger
  384. SetFormat Integer, Hex
  385. b := 0, j := 0
  386. VarSetCapacity(Result,StrLen(Data)*2)
  387. Loop 256
  388. a := A_Index - 1
  389. ,Key%a% := Asc(SubStr(Pass, Mod(a,StrLen(Pass))+1, 1))
  390. ,sBox%a% := a
  391. Loop 256
  392. a := A_Index - 1
  393. ,b := b + sBox%a% + Key%a% & 255
  394. ,sBox%a% := (sBox%b%+0, sBox%b% := sBox%a%) ; SWAP(a,b)
  395. Loop Parse, Data
  396. i := A_Index & 255
  397. ,j := sBox%i% + j & 255
  398. ,k := sBox%i% + sBox%j% & 255
  399. ,sBox%i% := (sBox%j%+0, sBox%j% := sBox%i%) ; SWAP(i,j)
  400. ,Result .= SubStr(Asc(A_LoopField)^sBox%k%, -1, 2)
  401. StringReplace Result, Result, x, 0, All
  402. SetFormat Integer, %Format%
  403. Return Result
  404. }
  405.  
  406. RC4hex2txt(Data,Pass) {
  407. b := 0, j := 0, x := "0x"
  408. VarSetCapacity(Result,StrLen(Data)//2)
  409. Loop 256
  410. a := A_Index - 1
  411. ,Key%a% := Asc(SubStr(Pass, Mod(a,StrLen(Pass))+1, 1))
  412. ,sBox%a% := a
  413. Loop 256
  414. a := A_Index - 1
  415. ,b := b + sBox%a% + Key%a% & 255
  416. ,sBox%a% := (sBox%b%+0, sBox%b% := sBox%a%) ; SWAP(a,b)
  417. Loop % StrLen(Data)//2
  418. i := A_Index & 255
  419. ,j := sBox%i% + j & 255
  420. ,k := sBox%i% + sBox%j% & 255
  421. ,sBox%i% := (sBox%j%+0, sBox%j% := sBox%i%) ; SWAP(i,j)
  422. ,Result .= Chr((x . SubStr(Data,2*A_Index-1,2)) ^ sBox%k%)
  423. Return Result
  424. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement