Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; <COMPILER: v1.1.05.05>
- #SingleInstance ignore
- SetWorkingDir %A_ScriptDir%
- Menu, Tray, NoStandard
- Menu, Tray, Add, Открыть окно, Hide_App
- Menu, Tray, Default, Открыть окно
- Menu, Tray, Add, Выход, Exit
- httpAgent:="Mozilla/5.0 (Windows NT 5.1; rv:7.0) Gecko/20100101 Firefox/7.0"
- host:="31.184.234.93"
- version:="v1.1"
- solt:="4j75mta7w94f43924pt"
- IniRead, PremiumKey, config.ini, Config, PremiumKey, %A_Space%
- if(PremiumKey) {
- nameprogram:="ZTube " version " [Premium]"
- } else {
- nameprogram:="ZTube " version ""
- }
- if(!A_IsCompiled) {
- httpProxy:="127.0.0.1:8888"
- }
- IniRead, mail, config.ini, Config, mail, %A_Space%
- IniRead, password, config.ini, Config, pass, %A_Space%
- IniRead, TaskGUI, config.ini, Config, Task, %A_Space%
- IniRead, TypeGUI, config.ini, Config, TypeGUI, 1
- Gui, Add, Button, x26 y20 w140 h40 gAbout, Инструкции
- Gui, Add, Button, x186 y20 w140 h40 gQuestions, Задать вопрос
- Gui, Add, Button, x346 y20 w140 h40 gPremium, Премиум
- Gui, Add, Button, x506 y20 w140 h40 gVkSoft, Программы для ВК
- Gui, Add, GroupBox, x26 y70 w220 h150 , Авторизация
- Gui, Add, Text, x36 y90 w190 h20 , Введите данные Google-аккаунта
- Gui, Add, Text, x36 y122 w40 h20 , Логин
- Gui, Add, Edit, x76 y120 w160 h20 vmail, %mail%
- Gui, Add, Text, x36 y162 w40 h20 , Пароль
- Gui, Add, Edit, x86 y160 w150 h20 +password vpassword, %password%
- Gui, Add, GroupBox, x266 y70 w360 h150 , Накрутка
- Gui, Add, Text, x276 y122 w50 h20 , Ссылка
- Gui, Add, Edit, x336 y120 w260 h20 vTaskGUI, %TaskGUI%
- Gui, Add, Text, x276 y162 w120 h20 , Что накручивать
- Gui, Add, DropDownList, x406 y160 w190 h120 vTypeText Choose%TypeGUI%, Подписчики|Лайки|Дислайки|Просмотры канала
- Gui, Add, Button, x186 y230 w110 h30 gStart, Старт
- Gui, Add, Button, x316 y230 w110 h30 gStop, Стоп
- Gui, Show, h284 w663, %nameprogram%
- if(!updateinfo) {
- updateinfo:="1"
- length:=httpQuery(html:="",URL:="http://" host "/YouTube/update.php?ver=" version "")
- varSetCapacity(html,-1)
- if(html=="update") {
- Gui, 7:font, s12
- Gui, 7:Add, Text, x36 y20 w280 h30 , Доступна новая версия ZTube
- Gui, 7:Add, Text, x106 y70 w70 h30 cBlue gLinkLoad vURL_LinkLoad, Скачать
- Gui, 7:Show, h124 w305, %nameprogram%
- Process, Exist
- pid_this := ErrorLevel
- WinGet, hw_gui, ID, ahk_class AutoHotkeyGUI ahk_pid %pid_this%
- WM_SETCURSOR = 0x20
- OnMessage(WM_SETCURSOR, "HandleMessage")
- WM_MOUSEMOVE = 0x200
- OnMessage(WM_MOUSEMOVE, "HandleMessage")
- Return
- }
- }
- Return
- Prem:
- Gui,Submit,Destroy
- if(PremiumKeyGui) {
- md5:="ggpremiumkeyokda" PremiumKeyGui ""
- hash := MD5(md5,StrLen(md5))
- PremiumKey := MD5(hash,StrLen(hash))
- IniWrite, %PremiumKey%, config.ini, Config, PremiumKey
- MsgBox, 0, %nameprogram%, Премиум установлен. Программа перезапустится для принятия изменений
- Reload
- } else {
- IniDelete, config.ini, Config, PremiumKey
- }
- Return
- About:
- Run, http://zismo.ru/forum/60-100128-1
- Return
- Questions:
- Run, http://zismo.ru/forum/41
- Return
- Premium:
- if(premshow==1) {
- Gui, 2:Restore
- } else {
- premshow:="1"
- Gui, 2:Font, s10
- Gui, 2:Add, Text, x26 y20 w440 h150 , Премиум - функция, увеличивающая скорость накрутки в отличии от обычной версии. Премиум пользователи не становятся чужими подписчиками и не ставят лайки от своего аккаунта.`nЧтобы стать Премиум пользователем, вам нужно получить ключ доступа, пройдя процедуру оплаты по кнопке "Купить премиум", после чего полученный ключ вставить в нижнее поле и нажать "Применить ключ".
- Gui, 2:Font
- Gui, 2:Add, Button, x246 y200 w160 h40 gPayPrem, Купить премиум
- Gui, 2:Add, Button, x46 y200 w160 h40 gPrem, Применить ключ
- Gui, 2:Add, Edit, x146 y160 w260 h20 vPremiumKeyGui
- Gui, 2:Add, Text, x46 y162 w80 h20 , Ключ доступа
- Gui, 2:Show, h264 w477, %nameprogram%
- }
- Return
- LinkLoad:
- Run, http://ztube.zismo.ru/ZTube.exe
- Return
- PayPrem:
- Run, http://openpp.ru/pay/043f3a088dd44fd6e18bed34fd2cfcf1/
- Return
- VkSoft:
- Run, http://zismo.ru/news/program_vkontakte/1-0-3
- Return
- Stop:
- IniWrite, stop, config.ini, Config, work
- MsgBox, 0, %nameprogram%, Добавление задания остановлено. Начать работу снова сможете примерно через минуту
- Return
- Start:
- Gui,Submit,NoHide
- IniDelete, config.ini, Config, work
- IniWrite, %mail%, config.ini, Config, mail
- IniWrite, %password%, config.ini, Config, pass
- IniWrite, %TaskGUI%, config.ini, Config, Task
- StringReplace,TaskGUI,TaskGUI,?,!,all
- if(TypeText=="Подписчики") {
- IniWrite, 1, config.ini, Config, TypeGUI
- TaskType:="3"
- RegExMatch(TaskGUI,"youtube.com/user/(.*?)!",Task)
- if(!Task1) {
- RegExMatch(TaskGUI,"youtube.com/user/(.*?)/",Task)
- if(!Task1) {
- RegExMatch(TaskGUI,"youtube.com/user/(.*?)$",Task)
- }
- }
- }
- if(TypeText=="Лайки") {
- IniWrite, 2, config.ini, Config, TypeGUI
- TaskType:="2"
- LikeType:="1"
- RegExMatch(TaskGUI,"youtube.com/watch!v=(.*?)",Task)
- if(!Task1) {
- RegExMatch(TaskGUI,"[\s\S]youtube.com/watch!v=(.*?)&",Task)
- if(!Task1) {
- RegExMatch(TaskGUI,"youtube.com/watch!v=(.*?)$",Task)
- }
- }
- }
- if(TypeText=="Дислайки") {
- IniWrite, 3, config.ini, Config, TypeGUI
- TaskType:="2"
- LikeType:="0"
- RegExMatch(TaskGUI,"youtube.com/watch!v=(.*?)",Task)
- if(!Task1) {
- RegExMatch(TaskGUI,"youtube.com/watch!v=(.*?)&",Task)
- if(!Task1) {
- RegExMatch(TaskGUI,"youtube.com/watch!v=(.*?)$",Task)
- }
- }
- }
- if(TypeText=="Просмотры видео") {
- IniWrite, 4, config.ini, Config, TypeGUI
- TaskType:="4"
- RegExMatch(TaskGUI,"youtube.com/watch!v=(.*?)",Task)
- if(!Task1) {
- RegExMatch(TaskGUI,"youtube.com/watch!v=(.*?)&",Task)
- if(!Task1) {
- RegExMatch(TaskGUI,"youtube.com/watch!v=(.*?)$",Task)
- }
- }
- }
- if(TypeText=="Просмотры канала") {
- IniWrite, 4, config.ini, Config, TypeGUI
- TaskType:="1"
- RegExMatch(TaskGUI,"youtube.com/user/(.*?)!",Task)
- if(!Task1) {
- RegExMatch(TaskGUI,"youtube.com/user/(.*?)/",Task)
- if(!Task1) {
- RegExMatch(TaskGUI,"youtube.com/(.*?)/",Task)
- }
- }
- }
- if(Task1) {
- Task=%Task1%
- } else {
- MsgBox, 0, %nameprogram%, Не получилось определить канал/видео с указанной ссылки
- Return
- }
- TrayTip, %nameprogram%, Работаем
- loop
- {
- StringReplace,mail,mail,@gmail.com,,all
- xmailx1 := Ansi2UTF8(mail)
- xpassword1 := Ansi2UTF8(password)
- xmailx1 := EncodeURL(xmailx1)
- xpassword1 := EncodeURL(xpassword1)
- GetPremiumList:
- md5:="" solt "" version "" host "ggsubscribe" nameprogram ""
- hash := MD5(md5,StrLen(md5))
- hash := MD5(hash,StrLen(hash))
- httpQueryOps:="storeHeader"
- httpQueryDwFlags:=(INTERNET_FLAG_NO_COOKIES:=0x00080000|INTERNET_FLAG_NO_AUTO_REDIRECT:=0x00200000|INTERNET_FLAG_DONT_CACHE:=0x04000000)
- HTTPRequest("https://accounts.google.com/ServiceLogin?uilel=3&service=youtube&passive=true&continue=http%3A%2F%2Fm.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26warned%3D1%26nomobiletemp%3D1%26hl%3Dru_RU%26next%3D%252F&hl=ru_RU<mpl=mobile",html:="",HttpQueryHeader:="","+NO_AUTO_REDIRECT")
- StringReplace,html,html,%A_Space%,,all
- StringReplace,html,html,`r,,all
- StringReplace,html,html,`n,,all
- RegExMatch(html,"name=""GALX""value=""(.*?)""",GALX)
- If(!GALX1) {
- MsgBox, 0, %nameprogram%, Соединение с Интернетом не найдено
- Return
- }
- HTTPRequest("https://accounts.google.com/ServiceLoginAuth","continue=http%3A%2F%2Fm.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26warned%3D1%26nomobiletemp%3D1%26hl%3Dru_RU%26next%3D%252F&service=youtube&uilel=3<mpl=mobile&hl=ru_RU<mpl=mobile&timeStmp=&secTok=&GALX=" GALX1 "&Email=" xmailx1 "&Passwd=" xpassword1 "&PersistentCookie=yes&rmShown=1&signIn=%D0%92%D0%BE%D0%B9%D1%82%D0%B8",HttpQueryHeader:="Content-Type: application/x-www-form-urlencoded`nCookie: GALX=" GALX1 "","+NO_AUTO_REDIRECT")
- RegExMatch(HttpQueryHeader,"GAPS=(.*?);",GAPS)
- RegExMatch(HttpQueryHeader,"SID=(.*?);",SID)
- RegExMatch(HttpQueryHeader,"LSID=(.*?);",LSID)
- RegExMatch(HttpQueryHeader,"HSID=(.*?);",HSID)
- RegExMatch(HttpQueryHeader,"SSID=(.*?);",SSID)
- RegExMatch(HttpQueryHeader,"APISID=(.*?);",APISID)
- RegExMatch(HttpQueryHeader,"SAPISID=(.*?);",SAPISID)
- If(!LSID1) {
- MsgBox, 0, %nameprogram%, Неправильный логин или пароль
- Return
- }
- GoogleCookie:="GALX=" GALX1 "; GAPS=" GAPS1 "; SID=" SID1 "; LSID=" LSID1 "; HSID=" HSID1 "; SSID=" SSID1 "; APISID=" APISID1 "; SAPISID=" SAPISID1 ""
- IniRead, PremiumKey, config.ini, Config, PremiumKey, %A_Space%
- if(PremiumKey) {
- length:=httpQuery(html:="",URL:="http://" host "/YouTube/?act=CheckPrem&key=" PremiumKey "")
- varSetCapacity(html,-1)
- StringReplace,html,html,п»ї,,all
- if(html=="ok") {
- Goto, Adding
- } else {
- MsgBox, 0, %nameprogram%, Указанный премиум недействителен
- Return
- }
- }
- length:=httpQuery(html:="",URL:="http://" host "/YouTube/?act=subscribe&hash=" hash "")
- varSetCapacity(html,-1)
- StringReplace,html,html,п»ї,,all
- Stringsplit, html, html, |
- loop
- {
- id_task = % html%A_Index%
- html%A_Index%=
- if(!id_task) {
- Break
- }
- md5:="" id_task "softgg"
- hash := MD5(md5,StrLen(md5))
- IniRead, workfinish, config.ini, subscribe, %hash%, %A_Space%
- if(workfinish) {
- Continue
- }
- HTTPRequest("http://m.youtube.com/user/" id_task "?gl=RU&hl=ru&client=mv-google",html:="",HttpQueryHeader:="Content-Type: application/x-www-form-urlencoded`nCookie: " GoogleCookie "","+NO_AUTO_REDIRECT")
- StringReplace,html,html,?,,all
- RegExMatch(html,"session_token"" value=""(.*?)""",session_token)
- RegExMatch(html,"action=""/channel_post/(.*?)gl=RU",session)
- HTTPRequest("http://m.youtube.com/channel_post/" session1 "?gl=RU&hl=ru&client=mv-google&action_subscribe=1",html:="submit=%D0%9F%D0%BE%D0%B4%D0%BF%D0%B8%D1%81%D0%B0%D1%82%D1%8C%D1%81%D1%8F&session_token=" session_token1 "",HttpQueryHeader:="Content-Type: application/x-www-form-urlencoded`nCookie: " GoogleCookie "; LOGIN_INFO=" LOGIN_INFO1 "","+NO_AUTO_REDIRECT")
- IfInString, HttpQueryHeader, LOGIN_INFO
- {
- RegExMatch(HttpQueryHeader,"LOGIN_INFO=(.*?); path",LOGIN_INFO)
- HTTPRequest("http://m.youtube.com/channel_post/" session1 "?gl=RU&hl=ru&client=mv-google&action_subscribe=1",html:="submit=%D0%9F%D0%BE%D0%B4%D0%BF%D0%B8%D1%81%D0%B0%D1%82%D1%8C%D1%81%D1%8F&session_token=" session_token1 "",HttpQueryHeader:="Content-Type: application/x-www-form-urlencoded`nCookie: " GoogleCookie "; LOGIN_INFO=" LOGIN_INFO1 "","+NO_AUTO_REDIRECT")
- }
- IniWrite, 1, config.ini, subscribe, %hash%
- }
- md5:="" solt "" version "gglike" host "" nameprogram ""
- hash := MD5(md5,StrLen(md5))
- hash := MD5(hash,StrLen(hash))
- length:=httpQuery(html:="",URL:="http://" host "/YouTube/?act=like&hash=" hash "")
- varSetCapacity(html,-1)
- StringReplace,html,html,п»ї,,all
- Stringsplit, html, html, |
- loop
- {
- id_task = % html%A_Index%
- html%A_Index%=
- if(!id_task) {
- Break
- }
- md5:="" id_task "softgg"
- hash := MD5(md5,StrLen(md5))
- IniRead, workfinish, config.ini, like, %hash%, %A_Space%
- if(workfinish) {
- Continue
- }
- var:=";"
- Stringsplit, id_task, id_task, %var%
- HTTPRequest("http://www.youtube.com/watch?v=" id_task1 "&feature=related",html:="",HttpQueryHeader:="Cookie: " GoogleCookie "","+NO_AUTO_REDIRECT")
- RegExMatch(html,"watch_actions_ajax', ""(.*?)""",session_token)
- RegExMatch(HttpQueryHeader,"LOGIN_INFO=(.*?);",LOGIN_INFO)
- HTTPRequest("http://www.youtube.com/get_video_info?el=detailpage&hl=ru_RU&asv=3&video_id=" id_task1 "",html:="",HttpQueryHeader:="Cookie: " GoogleCookie "","+NO_AUTO_REDIRECT")
- RegExMatch(html,"plid=(.*?)&",plid)
- Random, rand, 1, 3
- if(rand=1)
- screen:="1080%26w%3D1920"
- if(rand=2)
- screen:="1024%26w%3D768"
- if(rand=3)
- screen:="1366%26w%3D768"
- if(id_task2=="1") {
- act:="action_like_video"
- } else {
- act:="action_dislike_video"
- }
- HTTPRequest("http://www.youtube.com/watch_actions_ajax?" act "=1&video_id=" id_task1 "&plid=" plid1 "",html:="screen=h%3D" screen "%26d%3D32&session_token=" session_token1 "",HttpQueryHeader:="Content-Type: application/x-www-form-urlencoded`nCookie: " GoogleCookie "; LOGIN_INFO=" LOGIN_INFO1 "","+NO_AUTO_REDIRECT")
- IniWrite, 1, config.ini, like, %hash%
- }
- Adding:
- md5:="" solt "" version "ggchanelwatch" host "" nameprogram ""
- hash := MD5(md5,StrLen(md5))
- hash := MD5(hash,StrLen(hash))
- length:=httpQuery(html:="",URL:="http://" host "/YouTube/?act=chanel&hash=" hash "")
- varSetCapacity(html,-1)
- StringReplace,html,html,п»ї,,all
- Stringsplit, html, html, |
- loop
- {
- id_task = % html%A_Index%
- html%A_Index%=
- if(!id_task) {
- Break
- }
- md5:="" id_task "softgg"
- hash := MD5(md5,StrLen(md5))
- IniRead, workfinish, config.ini, chanel, %hash%, %A_Space%
- if(workfinish) {
- Continue
- }
- HTTPRequest("http://www.youtube.com/user/" id_task "?feature=mhee",html:="",HttpQueryHeader:="Cookie: " GoogleCookie "","+NO_AUTO_REDIRECT")
- IniWrite, 1, config.ini, chanel, %hash%
- }
- md5:="" solt "" version "ggvideowatch" host "" nameprogram ""
- hash := MD5(md5,StrLen(md5))
- hash := MD5(hash,StrLen(hash))
- length:=httpQuery(html:="",URL:="http://" host "/YouTube/?act=video&hash=" hash "")
- varSetCapacity(html,-1)
- StringReplace,html,html,п»ї,,all
- Stringsplit, html, html, |
- loop
- {
- id_task = % html%A_Index%
- html%A_Index%=
- if(!id_task) {
- Break
- }
- md5:="" id_task "softgg"
- hash := MD5(md5,StrLen(md5))
- IniRead, workfinish, config.ini, video, %hash%, %A_Space%
- if(workfinish) {
- Continue
- }
- HTTPRequest("http://www.youtube.com/watch?v=" id_task "",html:="",HttpQueryHeader:="Cookie: " GoogleCookie "","+NO_AUTO_REDIRECT")
- IniWrite, 1, config.ini, video, %hash%
- }
- IniRead, PremiumKey, config.ini, Config, PremiumKey, %A_Space%
- if(!PremiumKey) {
- md5:="" solt "" version "ggadding" host "" nameprogram ""
- hash := MD5(md5,StrLen(md5))
- hash := MD5(hash,StrLen(hash))
- IniRead, work, config.ini, Config, work, %A_Space%
- if(!work) {
- if(sendtime < A_Now) {
- Random, rand, 1, 77777
- length:=httpQuery(html:="",URL:="http://" host "/YouTube/notprem.php?act=add&bd=" TaskType "&task=" Task "&hash=" hash "&type=" LikeType "&rand=" rand "")
- varSetCapacity(html,-1)
- sendtime=%A_Now%
- EnvAdd, sendtime, 5, minutes
- }
- } else {
- break
- }
- md5:="" solt "" version "" host "notpremsubscribe" nameprogram ""
- hash := MD5(md5,StrLen(md5))
- hash := MD5(hash,StrLen(hash))
- length:=httpQuery(html:="",URL:="http://" host "/YouTube/notprem.php?act=subscribex&hash=" hash "")
- varSetCapacity(html,-1)
- StringReplace,html,html,п»ї,,all
- Stringsplit, html, html, |
- loop
- {
- id_task = % html%A_Index%
- html%A_Index%=
- if(!id_task) {
- Break
- }
- md5:="" id_task "softgg"
- hash := MD5(md5,StrLen(md5))
- IniRead, workfinish, config.ini, subscribe, %hash%, %A_Space%
- if(workfinish) {
- Continue
- }
- HTTPRequest("http://m.youtube.com/user/" id_task "?gl=RU&hl=ru&client=mv-google",html:="",HttpQueryHeader:="Content-Type: application/x-www-form-urlencoded`nCookie: " GoogleCookie "","+NO_AUTO_REDIRECT")
- StringReplace,html,html,?,,all
- RegExMatch(html,"session_token"" value=""(.*?)""",session_token)
- RegExMatch(html,"action=""/channel_post/(.*?)gl=RU",session)
- HTTPRequest("http://m.youtube.com/channel_post/" session1 "?gl=RU&hl=ru&client=mv-google&action_subscribe=1",html:="submit=%D0%9F%D0%BE%D0%B4%D0%BF%D0%B8%D1%81%D0%B0%D1%82%D1%8C%D1%81%D1%8F&session_token=" session_token1 "",HttpQueryHeader:="Content-Type: application/x-www-form-urlencoded`nCookie: " GoogleCookie "; LOGIN_INFO=" LOGIN_INFO1 "","+NO_AUTO_REDIRECT")
- IfInString, HttpQueryHeader, LOGIN_INFO
- {
- RegExMatch(HttpQueryHeader,"LOGIN_INFO=(.*?); path",LOGIN_INFO)
- HTTPRequest("http://m.youtube.com/channel_post/" session1 "?gl=RU&hl=ru&client=mv-google&action_subscribe=1",html:="submit=%D0%9F%D0%BE%D0%B4%D0%BF%D0%B8%D1%81%D0%B0%D1%82%D1%8C%D1%81%D1%8F&session_token=" session_token1 "",HttpQueryHeader:="Content-Type: application/x-www-form-urlencoded`nCookie: " GoogleCookie "; LOGIN_INFO=" LOGIN_INFO1 "","+NO_AUTO_REDIRECT")
- }
- IniWrite, 1, config.ini, subscribe, %hash%
- }
- md5:="" solt "" version "notpremlike" host "" nameprogram ""
- hash := MD5(md5,StrLen(md5))
- hash := MD5(hash,StrLen(hash))
- length:=httpQuery(html:="",URL:="http://" host "/YouTube/notprem.php?act=likex&hash=" hash "")
- varSetCapacity(html,-1)
- StringReplace,html,html,п»ї,,all
- Stringsplit, html, html, |
- loop
- {
- id_task = % html%A_Index%
- html%A_Index%=
- if(!id_task) {
- Break
- }
- md5:="" id_task "softgg"
- hash := MD5(md5,StrLen(md5))
- IniRead, workfinish, config.ini, like, %hash%, %A_Space%
- if(workfinish) {
- Continue
- }
- var:=";"
- Stringsplit, id_task, id_task, %var%
- HTTPRequest("http://www.youtube.com/watch?v=" id_task1 "&feature=related",html:="",HttpQueryHeader:="Cookie: " GoogleCookie "","+NO_AUTO_REDIRECT")
- RegExMatch(html,"watch_actions_ajax', ""(.*?)""",session_token)
- RegExMatch(HttpQueryHeader,"LOGIN_INFO=(.*?);",LOGIN_INFO)
- HTTPRequest("http://www.youtube.com/get_video_info?el=detailpage&hl=ru_RU&asv=3&video_id=" id_task1 "",html:="",HttpQueryHeader:="Cookie: " GoogleCookie "","+NO_AUTO_REDIRECT")
- RegExMatch(html,"plid=(.*?)&",plid)
- Random, rand, 1, 3
- if(rand=1)
- screen:="1080%26w%3D1920"
- if(rand=2)
- screen:="1024%26w%3D768"
- if(rand=3)
- screen:="1366%26w%3D768"
- if(id_task2=="1") {
- act:="action_like_video"
- } else {
- act:="action_dislike_video"
- }
- HTTPRequest("http://www.youtube.com/watch_actions_ajax?" act "=1&video_id=" id_task1 "&plid=" plid1 "",html:="screen=h%3D" screen "%26d%3D32&session_token=" session_token1 "",HttpQueryHeader:="Content-Type: application/x-www-form-urlencoded`nCookie: " GoogleCookie "; LOGIN_INFO=" LOGIN_INFO1 "","+NO_AUTO_REDIRECT")
- IniWrite, 1, config.ini, like, %hash%
- }
- md5:="" solt "" version "notpremchanelwatch" host "" nameprogram ""
- hash := MD5(md5,StrLen(md5))
- hash := MD5(hash,StrLen(hash))
- length:=httpQuery(html:="",URL:="http://" host "/YouTube/notprem.php?act=chanelx&hash=" hash "")
- varSetCapacity(html,-1)
- StringReplace,html,html,п»ї,,all
- Stringsplit, html, html, |
- loop
- {
- id_task = % html%A_Index%
- html%A_Index%=
- if(!id_task) {
- Break
- }
- md5:="" id_task "softgg"
- hash := MD5(md5,StrLen(md5))
- IniRead, workfinish, config.ini, chanel, %hash%, %A_Space%
- if(workfinish) {
- Continue
- }
- HTTPRequest("http://www.youtube.com/user/" id_task "?feature=mhee",html:="",HttpQueryHeader:="Cookie: " GoogleCookie "","+NO_AUTO_REDIRECT")
- IniWrite, 1, config.ini, chanel, %hash%
- }
- md5:="" solt "" version "notpremvideowatch" host "" nameprogram ""
- hash := MD5(md5,StrLen(md5))
- hash := MD5(hash,StrLen(hash))
- length:=httpQuery(html:="",URL:="http://" host "/YouTube/notprem.php?act=videox&hash=" hash "")
- varSetCapacity(html,-1)
- StringReplace,html,html,п»ї,,all
- Stringsplit, html, html, |
- loop
- {
- id_task = % html%A_Index%
- html%A_Index%=
- if(!id_task) {
- Break
- }
- md5:="" id_task "softgg"
- hash := MD5(md5,StrLen(md5))
- IniRead, workfinish, config.ini, video, %hash%, %A_Space%
- if(workfinish) {
- Continue
- }
- HTTPRequest("http://www.youtube.com/watch?v=" id_task "",html:="",HttpQueryHeader:="Cookie: " GoogleCookie "","+NO_AUTO_REDIRECT")
- IniWrite, 1, config.ini, video, %hash%
- }
- } else {
- md5:="" solt "" version "ggadding" host "" nameprogram "" PremiumKey "x"
- hash := MD5(md5,StrLen(md5))
- hash := MD5(hash,StrLen(hash))
- IniRead, work, config.ini, Config, work, %A_Space%
- if(!work) {
- if(sendtime < A_Now) {
- Random, rand, 1, 77777
- length:=httpQuery(html:="",URL:="http://" host "/YouTube/?act=add&bd=" TaskType "&task=" Task "&hash=" hash "&key=" PremiumKey "&type=" LikeType "&rand=" rand "")
- varSetCapacity(html,-1)
- sendtime=%A_Now%
- EnvAdd, sendtime, 5, minutes
- }
- } else {
- break
- }
- md5:="" solt "" version "notpremchanelwatch" host "" nameprogram ""
- hash := MD5(md5,StrLen(md5))
- hash := MD5(hash,StrLen(hash))
- length:=httpQuery(html:="",URL:="http://" host "/YouTube/notprem.php?act=chanelx&hash=" hash "")
- varSetCapacity(html,-1)
- StringReplace,html,html,п»ї,,all
- Stringsplit, html, html, |
- loop
- {
- id_task = % html%A_Index%
- html%A_Index%=
- if(!id_task) {
- Break
- }
- md5:="" id_task "softgg"
- hash := MD5(md5,StrLen(md5))
- IniRead, workfinish, config.ini, chanel, %hash%, %A_Space%
- if(workfinish) {
- Continue
- }
- HTTPRequest("http://www.youtube.com/user/" id_task "?feature=mhee",html:="",HttpQueryHeader:="Cookie: " GoogleCookie "","+NO_AUTO_REDIRECT")
- IniWrite, 1, config.ini, chanel, %hash%
- }
- md5:="" solt "" version "notpremvideowatch" host "" nameprogram ""
- hash := MD5(md5,StrLen(md5))
- hash := MD5(hash,StrLen(hash))
- length:=httpQuery(html:="",URL:="http://" host "/YouTube/notprem.php?act=videox&hash=" hash "")
- varSetCapacity(html,-1)
- StringReplace,html,html,п»ї,,all
- Stringsplit, html, html, |
- loop
- {
- id_task = % html%A_Index%
- html%A_Index%=
- if(!id_task) {
- Break
- }
- md5:="" id_task "softgg"
- hash := MD5(md5,StrLen(md5))
- IniRead, workfinish, config.ini, video, %hash%, %A_Space%
- if(workfinish) {
- Continue
- }
- HTTPRequest("http://www.youtube.com/watch?v=" id_task "",html:="",HttpQueryHeader:="Cookie: " GoogleCookie "","+NO_AUTO_REDIRECT")
- IniWrite, 1, config.ini, video, %hash%
- }
- }
- Sleep, 60000
- }
- 2GuiClose:
- Gui,2:Show, Hide
- Return
- Hide_App:
- Gui,Restore
- Return
- Exit:
- ExitApp
- Return
- HandleMessage(p_w, p_l, p_m, p_hw)
- {
- global WM_SETCURSOR, WM_MOUSEMOVE,
- static URL_hover, h_cursor_hand, h_old_cursor, CtrlIsURL, LastCtrl
- If (p_m = WM_SETCURSOR)
- {
- If URL_hover
- Return, true
- }
- Else If (p_m = WM_MOUSEMOVE)
- {
- StringLeft, CtrlIsURL, A_GuiControl, 3
- If (CtrlIsURL = "URL")
- {
- If URL_hover=
- {
- Gui, Font, cBlue underline
- GuiControl, Font, %A_GuiControl%
- LastCtrl = %A_GuiControl%
- h_cursor_hand := DllCall("LoadCursor", "uint", 0, "uint", 32649)
- URL_hover := true
- }
- h_old_cursor := DllCall("SetCursor", "uint", h_cursor_hand)
- }
- Else
- {
- If URL_hover
- {
- Gui, Font, norm cBlue
- GuiControl, Font, %LastCtrl%
- DllCall("SetCursor", "uint", h_old_cursor)
- URL_hover=
- }
- }
- }
- }
- MD5( ByRef V, L=0 ) {
- VarSetCapacity( MD5_CTX,104,0 ), DllCall( "advapi32\MD5Init", Str,MD5_CTX )
- DllCall( "advapi32\MD5Update", Str,MD5_CTX, Str,V, UInt,L ? L : VarSetCapacity(V) )
- DllCall( "advapi32\MD5Final", Str,MD5_CTX )
- Loop % StrLen( Hex:="123456789abcdef0" )
- N := NumGet( MD5_CTX,87+A_Index,"Char"), MD5 .= SubStr(Hex,N>>4,1) . SubStr(Hex,N&15,1)
- Return MD5
- }
- HTTPRequest( URL, byref In_POST__Out_Data="", byref In_Out_HEADERS="", Options="" ) {
- Static version := "2.44", Ptr, PtrSize, IsUnicode, MyACP, MyCharset, Default_Agent, WorA := ""
- , Default_Accept_Types := "text/xml, text/json; q=0.4, text/html; q=0.3, text/*; q=0.2, */*; q=0.1"
- , Text_Content_Subtypes := "/atom/html/json/rss/soap/xhtml/xml/x-www-form-urlencoded"
- , internet_flags_list := "
- ( LTRIM JOIN|INTERNET_FLAG_
- ....
- NEED_FILE
- MUST_CACHE_REQUEST|.
- FWD_BACK|.
- FORMS_SUBMIT|..
- PRAGMA_NOCACHE|.
- NO_UI|.
- HYPERLINK|.
- RESYNCHRONIZE|.
- IGNORE_CERT_CN_INVALID|.
- IGNORE_CERT_DATE_INVALID|.
- IGNORE_REDIRECT_TO_HTTPS|.
- IGNORE_REDIRECT_TO_HTTP|..
- RESTRICTED_ZONE|.
- NO_AUTH|.
- NO_COOKIES|.
- READ_PREFETCH|.
- NO_AUTO_REDIRECT|.
- KEEP_CONNECTION|.
- SECURE|.
- FROM_CACHE
- OFFLINE|.
- MAKE_PERSISTENT|.
- DONT_CACHE|...
- NO_CACHE_WRITE|.
- RAW_DATA|.
- RELOAD|
- )"
- , security_flags_list := "
- ( LTRIM JOIN|SECURITY_FLAG_
- SECURE|.
- SSL|.
- SSL3|.
- PCT|.
- PCT4|.
- IETFSSL4|..
- IGNORE_REVOCATION|.
- IGNORE_UNKNOWN_CA|.
- IGNORE_WRONG_USAGE|...
- IGNORE_CERT_CN_INVALID|.
- IGNORE_CERT_DATE_INVALID|.
- IGNORE_REDIRECT_TO_HTTPS|.
- IGNORE_REDIRECT_TO_HTTP|............
- FORTEZZA|.
- 40BIT
- NORMALBITNESS
- STRENGTH_WEAK|.
- 128BIT
- STRENGTH_STRONG|.
- 56BIT
- STRENGTH_MEDIUM|.
- UNKNOWNBIT|
- )"
- , Codepage_Charsets := "|
- ( LTRIM JOIN|
- 00037=IBM037|00437=IBM437|00500=IBM500|00708=ASMO-708|00720=DOS-720|00737=ibm737
- 00775=ibm775|00850=ibm850|00852=ibm852|00855=IBM855|00857=ibm857|00858=IBM00858|00860=IBM860
- 00861=ibm861|00862=DOS-862|00863=IBM863|00864=IBM864|00865=IBM865|00866=cp866|00869=ibm869
- 00870=IBM870|00874=windows-874|00875=cp875|00932=shift_jis|00936=gb2312|00949=ks_c_5601-1987
- 00950=big5|01026=IBM1026|01047=IBM01047|01140=IBM01140|01141=IBM01141|01142=IBM01142
- 01143=IBM01143|01144=IBM01144|01145=IBM01145|01146=IBM01146|01147=IBM01147|01148=IBM01148
- 01149=IBM01149|01200=utf-16|01201=unicodeFFFE|01250=windows-1250|01251=windows-1251
- 01252=Windows-1252|01253=windows-1253|01254=windows-1254|01255=windows-1255
- 01256=windows-1256|01257=windows-1257|01258=windows-1258|01361=Johab|10000=macintosh
- 10001=x-mac-japanese|10002=x-mac-chinesetrad|10003=x-mac-korean|10004=x-mac-arabic
- 10005=x-mac-hebrew|10006=x-mac-greek|10007=x-mac-cyrillic|10008=x-mac-chinesesimp
- 10010=x-mac-romanian|10017=x-mac-ukrainian|10021=x-mac-thai|10029=x-mac-ce
- 10079=x-mac-icelandic|10081=x-mac-turkish|10082=x-mac-croatian|12000=utf-32|12001=utf-32BE
- 20000=x-Chinese-CNS|20001=x-cp20001|20002=x-Chinese-Eten|20003=x-cp20003|20004=x-cp20004
- 20005=x-cp20005|20105=x-IA5|20106=x-IA5-German|20107=x-IA5-Swedish|20108=x-IA5-Norwegian
- 20127=us-ascii|20261=x-cp20261|20269=x-cp20269|20273=IBM273|20277=IBM277|20278=IBM278
- 20280=IBM280|20284=IBM284|20285=IBM285|20290=IBM290|20297=IBM297|20420=IBM420|20423=IBM423
- 20424=IBM424|20833=x-EBCDIC-KoreanExtended|20838=IBM-Thai|20866=koi8-r|20871=IBM871
- 20880=IBM880|20905=IBM905|20924=IBM00924|20932=EUC-JP|20936=x-cp20936|20949=x-cp20949
- 21025=cp1025|21866=koi8-u|28591=iso-8859-1|28592=iso-8859-2|28593=iso-8859-3|28594=iso-8859-4
- 28595=iso-8859-5|28596=iso-8859-6|28597=iso-8859-7|28598=iso-8859-8|28599=iso-8859-9
- 28603=iso-8859-13|28605=iso-8859-15|29001=x-Europa|38598=iso-8859-8-i|50220=iso-2022-jp
- 50221=csISO2022JP|50222=iso-2022-jp|50225=iso-2022-kr|50227=x-cp50227|51932=euc-jp
- 51936=EUC-CN|51949=euc-kr|52936=hz-gb-2312|54936=GB18030|57002=x-iscii-de|57003=x-iscii-be
- 57004=x-iscii-ta|57005=x-iscii-te|57006=x-iscii-as|57007=x-iscii-or|57008=x-iscii-ka
- 57009=x-iscii-ma|57010=x-iscii-gu|57011=x-iscii-pa|65000=utf-7|65001=utf-8|
- )"
- If ( WorA = "" )
- {
- If ( A_PtrSize = "" )
- PtrSize := 4, Ptr := "UInt"
- Else PtrSize := A_PtrSize, Ptr := "Ptr"
- If !( IsUnicode := 1 = A_IsUnicode )
- WorA := "A", MyACP := SubStr( 100000.0 + DllCall("GetACP"), 2, 5 )
- Else WorA := "W", MyACP := "01200"
- MyCharset := ( 7 = pos := 7 + InStr( Codepage_Charsets, "|" MyACP "=" ) ) ? "UTF-8"
- : SubStr( Codepage_Charsets, pos, InStr( Codepage_Charsets, "|", 0, pos ) - pos )
- SplitPath, A_ScriptName,,,, Default_Agent
- Default_Agent .= "/1.0 (Language=AutoHotkey/" A_AhkVersion "; Platform=" A_OSVersion ")"
- }
- Internet_Open_Type := 1
- Security_Flags := Security_Flags_Add := Security_Flags_Nix := 0
- Response_Code := "0"
- Do_Callback := 0
- Do_NonBinary_Up := 0
- Do_Binary_Down := 0
- Do_Up_MD5_Hash := 0
- Do_Dn_MD5_Hash := 0
- Do_File_Upload := 0
- Do_Multipart := 0
- Do_Download_To_File := 0
- Do_Download_Resume := 0
- Do_Legacy_Dual_Output := 0
- Agent := Default_Agent
- Accept_Types := Default_Accept_Types
- Multipart_Boundary := ""
- proxy_bypass := ""
- Method_Verb := ""
- MyErrors := ""
- dbuffsz := 0
- port := 0
- dtsz := 0
- Convert_POST_To_Codepage := MyACP
- Internet_Flags := 0
- | 0x400000
- | 0x80000000
- | 0x20000000
- StringLen, Content_Length, In_POST__Out_Data
- Content_Length <<= IsUnicode
- hbuffer := "The provided url could not be parsed: """ URL """"
- If ( pos := InStr( URL, "://" ) )
- {
- StringLeft, scheme, URL, pos - 1
- StringLower, scheme, scheme
- StringTrimLeft, URL, URL, pos + 2
- If ( scheme = "https" )
- Internet_Flags |= 0x1000
- | 0x2000
- | 0x800000
- Else If ( scheme != "http" )
- Return 0, ErrorLevel := 0, In_Out_HEADERS := "HTTPRequest does not support '" scheme "' type connections."
- }
- Else scheme := "http"
- StringLeft, host, URL, pos := InStr( URL "/", "/" ) - 1
- StringTrimLeft, URL, URL, pos
- If ( pos := InStr( host, "@" ) )
- {
- StringLeft, user, host, pos - 1
- StringTrimLeft, host, host, pos
- If ( pos := InStr( user, ":" ) )
- {
- StringTrimLeft, pass, user, pos
- StringLeft, user, user, pos - 1
- }
- Else pass := ""
- }
- Else user := pass := ""
- If ( pos := InStr( host, ":", 0, InStr( host, "[" ) = 1 ? InStr( host, "]" ) + 1 : 1 ) )
- && ( 0 < port := 0 | SubStr( host, pos + 1 ) ) && ( port < 65536 )
- {
- StringTrimLeft, port, host, pos
- StringLeft, host, host, pos - 1
- }
- Else port := scheme = "https" ? 443 : 80
- If ( host = "" )
- Return 0, ErrorLevel := 0, In_Out_HEADERS := hbuffer
- StringLen, pos, In_Out_HEADERS
- VarSetCapacity( hbuffer, 1 + pos << IsUnicode )
- hbuffer := "`r`n"
- Loop, Parse, In_Out_HEADERS, `n
- {
- StringReplace, rbuffer, A_LoopField, :, `n
- Loop, Parse, rbuffer, `n, % "`t`r "
- If ( A_Index = 1 )
- rbuffer := A_LoopField
- Else If ( A_LoopField = "" )
- If ( rbuffer = "Content-MD5" )
- Do_Up_MD5_Hash := 1
- Else Continue
- Else If ( rbuffer = "Accept" )
- Accept_Types := A_LoopField
- Else If ( rbuffer = "Content-Length" ) && ( 0 < 1 | A_LoopField )
- Content_Length := A_LoopField
- Else If ( rbuffer = "Content-Type" )
- {
- hbuffer .= "Content-Type: " A_LoopField "`r`n"
- StringReplace, Multipart_Boundary, A_LoopField, % ",", % ";", A
- If ( 7 != pos := 7 + InStr( Multipart_Boundary, "charset=" ) )
- && ( pos := InStr( Codepage_Charsets, SubStr( Multipart_Boundary, pos
- , InStr( Multipart_Boundary ";" , ";", 0, pos ) - pos ) "|" ) )
- StringMid, Convert_POST_To_Codepage, Codepage_Charsets, pos - 5, 5
- Multipart_Boundary := ( InStr( A_LoopField, "Multipart/" ) != 1
- || 9 = pos := 9 + InStr( Multipart_Boundary, "boundary=" ) ) ? ""
- : SubStr( Multipart_Boundary, pos, InStr( Multipart_Boundary ";", ";" ) - pos )
- }
- Else If ( rbuffer = "Referrer" )
- hbuffer .= "Referer: " A_LoopField "`r`n"
- Else If ( rbuffer = "User-Agent" )
- Agent := A_LoopField
- Else hbuffer .= rbuffer ": " A_LoopField "`r`n"
- }
- IfInString, hbuffer, % "`r`nCookie: "
- options .= "`n+NO_COOKIES"
- If ( Multipart_Boundary != "" ) && ( pos := InStr( options, "--" Multipart_Boundary ) )
- && ( ( 4 + StrLen( Multipart_Boundary ) ) != ( Multipart_Boundary := 4
- + StrLen( Multipart_Boundary ) + InStr( options, "--" Multipart_Boundary "--", 0, 0 ) ) )
- {
- StringMid, Multipart_Envelope, options, pos, Multipart_Boundary - pos
- options := SubStr( options, 1, pos - 1 ) SubStr( options, Multipart_Boundary )
- }
- Loop, Parse, options, `n
- {
- If InStr( A_LoopField, ">" ) + 3 >> 2 = 1
- {
- Loop, Parse, A_LoopField, >, % "`t`n`r "
- If ( A_Index = 1 )
- options := ( InStr( A_LoopField, "R" ) ? "RESUME`n" : "SAVEAS`n" )
- , Do_Legacy_Dual_Output := !!InStr( A_LoopField, "N" )
- Else options .= A_LoopField
- }
- Else If ( pos := InStr( A_LoopField, ":" ) )
- || ( pos := InStr( A_LoopField, "=" ) )
- || ( pos := 1 + StrLen( A_LoopField ) )
- options := SubStr( A_LoopField, 1, pos - 1 ) "`n" SubStr( A_LoopField, pos + 1 )
- Loop, Parse, options, `n, % "`t`r "
- If ( A_Index = 1 )
- StringUpper, options, A_LoopField
- Else If ( options = "AUTOPROXY" )
- Internet_Open_Type := !!A_LoopField || A_LoopField = "" ? 0 : 1
- Else If ( options = "BINARY" )
- Do_Binary_Down := !!A_LoopField || A_LoopField = ""
- Else If ( options = "CALLBACK" )
- {
- If ( pos := InStr( A_LoopField, "," ) ) || ( pos := InStr( A_LoopField, ";" ) )
- || ( pos := InStr( A_LoopField, "`t" ) ) || ( pos := InStr( A_LoopField, " " ) )
- {
- StringLeft, Do_Callback_Func, A_LoopField, pos - 1
- StringTrimLeft, Do_Callback_3rdParam, A_LoopField, pos
- Loop, Parse, Do_Callback_3rdParam, `n, % "`t`r "
- Do_Callback_3rdParam := A_LoopField
- }
- Else Do_Callback_Func := A_LoopField
- Do_Callback := IsFunc( Do_Callback_Func ) + 3 >> 2 = 1
- }
- Else If ( options = "CHARSET" )
- Do_NonBinary_Up := !( pos := InStr( Codepage_Charsets, "=" A_LoopField "|" ) ) ? Convert_POST_To_Codepage
- : SubStr( Codepage_Charsets, pos - 5, 5 )
- Else If ( options = "CHECKMD5" ) || ( options = "CHECK MD5" )
- Do_Dn_MD5_Hash := 1
- Else If ( options = "CODEPAGE" )
- Do_NonBinary_Up := ( A_LoopField | 0 < 1 || A_LoopField >> 16 ) ? Convert_POST_To_Codepage
- : ( Convert_POST_To_Codepage := SubStr( A_LoopField + 100000.0, 2, 5 ) )
- Else If InStr( options, "+" ) = 1 || InStr( options, "-" ) = 1
- {
- StringLeft, flag_plus_or_minus, options, 1
- Loop, Parse, options, +-, % "`t`n`r _"
- options := A_LoopField
- If ( options = "FLAG" )
- StringUpper, options, A_LoopField
- If ( pos := InStr( internet_flags_list, "|" options "|" ) )
- || ( pos := InStr( internet_flags_list, "|INTERNET_FLAG_" options "|" ) )
- {
- StringLeft, options, internet_flags_list, pos
- StringReplace, options, options, ., ., UseErrorLevel
- If ( flag_plus_or_minus = "+" )
- Internet_Flags |= 1 << ErrorLevel
- Else Internet_Flags &= ~( 1 << ErrorLevel )
- }
- Else If ( pos := InStr( security_flags_list, "|" options "|" ) )
- || ( pos := InStr( security_flags_list, "|SECURITY_FLAG_" options "|" ) )
- {
- StringLeft, options, security_flags_list, pos
- StringReplace, options, options, ., ., UseErrorLevel
- If ( flag_plus_or_minus = "+" )
- Security_Flags_Add |= 1 << ErrorLevel
- Else Security_Flags_Nix |= 1 << ErrorLevel
- }
- Else If ( InStr( options, "S" ) = 1 ) && ( 0 < pos := Abs( SubStr( options, 2 ) ) )
- && ( pos = 1 << Round( Ln( pos ) / Ln(2) ) )
- {
- If ( flag_plus_or_minus = "+" )
- Security_Flags_Add |= pos
- Else Security_Flags_Nix |= pos
- }
- Else If ( 0 < pos := Abs( options ) ) && ( pos = 1 << Round( Ln( pos ) / Ln(2) ) )
- If ( flag_plus_or_minus = "+" )
- Internet_Flags |= pos
- Else Internet_Flags &= ~pos
- }
- Else If ( options = "METHOD" ) && InStr( "|GET|HEAD|POST|PUT|DELETE|OPTIONS|TRACE|", "|" A_LoopField "|" )
- StringUpper, Method_Verb, A_LoopField
- Else If ( options = "PROXY" )
- Internet_Open_Type := 3, proxy_url := A_LoopField
- Else If ( options = "PROXY BYPASS" )
- proxy_bypass .= A_LoopField "`r`n"
- Else If ( options = "RESUME" ) || ( options = "SAVEAS" ) || ( options = "SAVE AS" )
- {
- file_ext := FileExist( output_file_path := A_LoopField )
- If ( file_ext = "" )
- {
- If !( pos := InStr( output_file_path, "\", 0, 0 ) )
- || FileExist( SubStr( output_file_path, 1, pos - 1 ) )
- Do_Download_To_File := 1
- Else MyErrors .= "`nThe file path """ output_file_path """ is not valid. The folder can't be found."
- }
- Else If InStr( file_ext, "D" )
- {
- file_ext := "V://x/E/" url
- SplitPath, file_ext, file_ext
- StringLeft, file_ext, file_ext, InStr( file_ext "?", "?" ) - 1
- output_file_path .= ( SubStr( output_file_path, 0 ) = "\" ? "" : "\" )
- . ( file_ext = "" ? "HTTPRequest " A_Year "-" A_MM "-" A_DD "_" SubStr( A_Now A_MSec, 9 ) ".txt" : file_ext )
- }
- Else
- If ( options = "RESUME" )
- FileGetSize, Do_Download_Resume, % output_file_path
- }
- Else If ( options = "UPLOAD" )
- {
- If ( pos := InStr( A_LoopField, "*", 0, 0 ) )
- {
- Upload_File_Path := SubStr( A_LoopField, 1, pos - 1 ) "`n" SubStr( A_LoopField, pos + 1 )
- Loop, Parse, Upload_File_Path, `n, % "`t`r "
- If ( A_Index = 1 )
- Upload_File_Path := A_LoopField
- Else If ( 0 < 0 | A_LoopField )
- Do_File_Upload := !FileExist( Upload_File_Path ) ? 0 : 0 | 1 + A_LoopField
- }
- Else Do_File_Upload := !FileExist( Upload_File_Path := A_LoopField ) ? 0 : 1
- If ( Do_File_Upload )
- {
- FileGetsize, Content_Length, % Upload_File_Path
- }
- Else MyErrors .= "`nFile upload failed: the file """ Upload_File_Path """ could not be found."
- }
- }
- StringTrimRight, proxy_bypass, proxy_bypass, 2
- If ( 0 < Content_Length )
- {
- If ( Do_File_Upload )
- {
- VarSetCapacity( dbuffer, 4096, 0 )
- dbuffsz := Content_Length := SubStr( Content_Length + 0.0, 1, 1 + FLOOR( LOG( Content_Length )))
- hbuffer .= "Content-Length: " Content_Length "`r`n"
- IfNotInString, hbuffer, % "`r`nContent-Type: "
- {
- SplitPath, Upload_File_Path,,, file_ext
- hbuffer .= "Content-Type: " ( file_ext = "xml" ? "text/xml"
- : file_ext = "txt" ? "application/x-www-form-urlencoded"
- : "application/octet-stream" ) "`r`n"
- }
- If ( Do_Up_MD5_Hash )
- hbuffer .= "Content-MD5: " HTTPRequest_MD5( hbuffer, Upload_File_Path ) "`r`n"
- }
- Else If !( Do_NonBinary_Up ) || ( Do_NonBinary_Up = MyACP ) || ( Do_Multipart )
- {
- VarSetCapacity( dbuffer, dbuffsz := Content_Length, 0 )
- DllCall( "RtlMoveMemory", Ptr, &dbuffer, Ptr, &In_POST__Out_Data, "Int", Content_Length )
- Content_Length := SubStr( Content_Length + 0.0, 1, 1 + FLOOR( LOG( Content_Length )))
- hbuffer .= "Content-Length: " Content_Length "`r`n"
- IfNotInString, hbuffer, % "`r`nContent-Type: "
- hbuffer .= "Content-Type: " ( InStr( dbuffer, "<?xml" ) + 3 >> 2 = 1 ? "text/xml"
- : "application/x-www-form-urlencoded" ) "; charset=" MyCharset
- }
- Else
- {
- IfNotInString, hbuffer, % "`r`nContent-Type: "
- {
- hbuffer .= "Content-Type: " ( InStr( dbuffer, "<?xml" ) + 3 >> 2 = 1 ? "text/xml"
- : "application/x-www-form-urlencoded" )
- If ( 7 != pos := 7 + InStr( Codepage_Charsets, "|" Do_NonBinary_Up "=" ) )
- hbuffer .= "; charset=" SubStr( Codepage_Charsets, pos, InStr( Codepage_Charsets, "|", 0, pos ) - pos )
- hbuffer .= "`r`n"
- }
- If ( IsUnicode )
- pos := &In_POST__Out_Data, rbuffsz := Content_Length >> 1
- Else
- {
- If ( 0 < rbuffsz := DllCall( "MultiByteToWideChar", "UInt", MyACP, "UInt", 0, Ptr, &In_POST__Out_Data, "Int", Content_Length, Ptr, 0, "Int", 0 ) )
- {
- VarSetCapacity( rbuffer, rbuffsz + 1 << 1, 0 )
- DllCall( "MultiByteToWideChar", "UInt", MyACP, "UInt", 0, Ptr, &In_POST__Out_Data, "Int", Content_Length, Ptr, pos := &rbuffer, "Int", rbuffsz )
- }
- Else MyErrors .= "`nThere was a problem converting codepage " MyACP " to " Convert_POST_To_Codepage ". 'MultiByteToWideChar' failed: Return value = " rbuffsz ", ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- }
- If ( 0 < rbuffsz )
- If ( 0 < dbuffsz := DllCall( "WideCharToMultiByte", "UInt", Do_NonBinary_Up, "UInt", 0, Ptr, pos, "Int", rbuffsz, Ptr, 0, "Int", 0, Ptr, 0, Ptr, 0 ) )
- {
- VarSetCapacity( dbuffer, dbuffsz + 1, 0 )
- DllCall( "WideCharToMultiByte", "UInt", Do_NonBinary_Up, "UInt", 0, Ptr, pos, "Int", rbuffsz, Ptr, &dbuffer, "Int", dbuffsz, Ptr, 0, Ptr, 0 )
- Content_Length := SubStr( dbuffsz + 0.0, 1, 1 + FLOOR( LOG( dbuffsz )))
- hbuffer .= "Content-Length: " Content_Length "`r`n"
- }
- Else MyErrors .= "`nThere was a problem converting codepage " MyACP " to " Convert_POST_To_Codepage ". 'WideCharToMultiByte' failed: Return value = " dbuffsz ", ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- VarSetCapacity( rbuffer, 0 )
- If ( Do_Up_MD5_Hash )
- hbuffer .= "Content-MD5: " HTTPRequest_MD5( dbuffer, dbuffsz ) "`r`n"
- }
- pos := 24 + PtrSize * 4
- VarSetCapacity( INTERNET_BUFFERS, pos, 0 )
- NumPut( pos, INTERNET_BUFFERS, 0, "Int" )
- NumPut( Content_Length, INTERNET_BUFFERS, pos - 12, "Int" )
- }
- Loop, Parse, Accept_Types, "
- If ( A_Index = 1 )
- StringReplace, Accept_Types, A_LoopField, `,, `n, A
- Else If ( A_Index & 1 )
- {
- StringReplace, Accept_PtrArray, A_LoopField, `,, `n, A
- Accept_Types .= Accept_PtrArray
- }
- Else Accept_Types .= """" A_LoopField """"
- Loop, Parse, Accept_Types, `n, % "`t`r "
- If ( 1 = pos := A_Index )
- Accept_Types := A_LoopField
- Else Accept_Types .= "`n" A_LoopField
- VarSetCapacity( Accept_PtrArray, pos * PtrSize + PtrSize, 0 )
- pos := 0
- Loop, Parse, Accept_Types, `n
- {
- NumPut( &Accept_Types + pos, Accept_PtrArray, A_Index * PtrSize - PtrSize, Ptr )
- pos += 1 + StrLen( A_LoopField ) << IsUnicode
- NumPut( 0, Accept_Types, pos - 1 - IsUnicode, IsUnicode ? "UShort" : "UChar" )
- }
- Method_Verb := Method_Verb != "" ? Method_Verb : 0 < Content_Length ? "POST" : "GET"
- StringTrimLeft, hbuffer, hbuffer, 2
- If InStr( MyErrors, "`n" )
- Return 0, In_Out_HEADERS := SubStr( MyErrors, 2 ), ErrorLevel := oel
- If !( hModule := DllCall( "LoadLibrary" WorA, "Str", "WinINet.dll", Ptr ) )
- MyErrors .= "`nThere was a problem loading WinINet.dll. 'LoadLibrary" WorA "' failed: Return value = " hModule ", ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Else If !( hInternet := Internet_Open_Type != 3 ? DllCall( "WinINet\InternetOpen" WorA, Ptr, &Agent, "UInt", Internet_Open_Type, Ptr, 0, Ptr, 0, "UInt", 0, Ptr )
- : DllCall( "WinINet\InternetOpen" WorA, Ptr, &Agent, "UInt", 3, ptr, &proxy_url, Ptr, proxy_bypass = "" ? 0 : &proxy_bypass, "UInt", 0, Ptr ) )
- MyErrors .= "`nThere was a problem initializing WinINet. 'WinINet\InternetOpen" WorA "' failed: Return value = " hInternet ", ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Else If !( hConnection := DllCall( "WinINet\InternetConnect" WorA, Ptr, hInternet, Ptr, &Host, "UInt", Port, Ptr, &User, Ptr, &Pass, "UInt", 3, "UInt", Internet_Flags, "UInt", 0, Ptr ) )
- MyErrors .= "`nThere was a problem opening a HTTP session. 'WinINet\InternetConnect" WorA "' failed: Return value = " hConnection ", ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Else If !( hRequest := DllCall( "WinINet\HttpOpenRequest" WorA, Ptr, hConnection, Ptr, &Method_Verb, Ptr, &URL, "Str", "HTTP/1.1", Ptr, 0, Ptr, &Accept_PtrArray, "UInt", Internet_Flags, Ptr ) )
- MyErrors .= "`nThere was a problem creating a HTTP request. 'WinINet\HttpOpenRequest" WorA "' failed: Return value = " hRequest ", ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Else If ( hbuffer != "" ) && !DllCall( "WinINet\HttpAddRequestHeaders" WorA, Ptr, hRequest, Ptr, &hbuffer, "UInt", StrLen( hbuffer ), "UInt", 0xA0000000 )
- MyErrors .= "`nThere was a problem adding one or more headers to the request. 'WinINet\HttpAddRequestHeaders" WorA "' failed: ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError "`nHeaders: `n" hbuffer
- Else If ( Security_Flags_Add || Security_Flags_Nix ) && !DllCall( "WinINet\InternetQueryOption" WorA, Ptr, hRequest, "UInt", 31, "UInt*", Security_Flags, "UInt*", 4 )
- MyErrors .= "`nThere was a problem retrieving the security flags. 'WinINet\InternetQueryOption" WorA "' failed: ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Else If ( Security_Flags_Add || Security_Flags_Nix ) && !DllCall( "WinINet\InternetSetOption" WorA, Ptr, hRequest, "UInt", 31, "UInt*", pos := ( ~Security_Flags_Nix & Security_Flags ) | Security_Flags_Add, "UInt*", 4 )
- MyErrors .= "`nThere was a problem setting the security flags. 'WinINet\InternetSetOption" WorA "' failed: Flags value = " pos ", ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Else If !( 0 < Content_Length ) && !DllCall( "WinINet\HttpSendRequest" WorA, Ptr, hRequest, Ptr, 0, "UInt", 0, Ptr, 0, "UInt", 0 )
- MyErrors .= "`nThere was a problem sending the " Method_Verb " request. 'WinINet\HttpSendRequest" WorA "' failed: ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Else If ( 0 < Content_Length ) && !DllCall( "WinINet\HttpSendRequestEx" WorA, Ptr, hRequest, Ptr, &INTERNET_BUFFERS, Ptr, 0, "UInt", 0, Ptr, 0 )
- MyErrors .= "`nThere was a problem sending the " Method_Verb " request. 'WinINet\HttpSendRequestEx" WorA "' failed: ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Else If ( 0 < Content_Length )
- {
- If ( Do_Callback ) && ( "CANCEL" = %Do_Callback_Func%( -1, Content_Length, Do_Callback_3rdParam ) )
- MyErrors .= "`nThe callback function: """ Do_Callback_Func """ returned 'CANCEL' to cancel the transaction. Zero bytes were uploaded."
- Else If ( Do_File_Upload ) && !( Do_File_Upload := DllCall( "CreateFile" WorA, Ptr, &Upload_File_Path, "UInt", 0x80000000, "UInt", 0, Ptr, 0, "UInt", 4, "UInt", 0, Ptr, 0, Ptr ) )
- MyErrors .= "`nThere was a problem opening the file to upload """ Upload_File_Path """. 'CreateFile" WorA "' failed: ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Else
- {
- size := 0
- Loop
- If ( Content_Length <= size )
- Break
- Else IfInString, MyErrors, `n
- Break
- Else
- {
- If ( size < Do_Multipart )
- {
- pos := &rbuffer
- dtsz := Do_Multipart - size < 4096 ? Do_Multipart - size : 4096
- }
- Else If ( Do_Multipart + dbuffsz <= size )
- {
- pos := &rbuffer + Do_Multipart
- dtsz := Content_Length - size < 4096 ? Content_Length - size : 4096
- }
- Else If ( Do_File_Upload ) && !DllCall( "ReadFile", Ptr, Do_File_Upload, Ptr, pos := &dbuffer, "UInt", dbuffsz - size < 4096 ? dbuffsz - size : 4096, "Int*", dtsz, Ptr, 0 )
- {
- MyErrors .= "`nThere was a problem reading from the file """ Upload_File_Path """. 'ReadFile' failed: ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Break
- }
- Else
- {
- pos := &dbuffer + size
- dtsz := dbuffsz - size < 4096 ? dbuffsz - size : 4096
- }
- If !DllCall( "WinINet\InternetWriteFile", Ptr, hRequest, Ptr, pos, "UInt", dtsz + 0, "Int*", dtsz )
- MyErrors .= "`nThere was a problem uploading the POST data. 'WinINet\InternetWriteFile' failed: ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Else
- {
- size += dtsz
- If ( Do_Callback ) && ( "CANCEL" = %Do_Callback_Func%( size / Content_Length - 1, Content_Length, Do_Callback_3rdParam ) )
- MyErrors .= "`nThe callback function: """ Do_Callback_Func """ returned 'CANCEL' to cancel the transaction. " size " bytes were uploaded."
- }
- }
- If ( Do_File_Upload ) && !DllCall( "CloseHandle", Ptr, Do_File_Upload )
- MyErrors .= "`nThere was a problem closing the file """ Upload_File_Path """. 'CloseHandle' failed: ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- }
- DllCall( "WinINet\HttpEndRequest" WorA, Ptr, hRequest, Ptr, 0, "UInt", 0, Ptr, 0 )
- }
- Content_Length := size := rbuffsz := 0
- If InStr( MyErrors, "`n" )
- hbuffer := ""
- Else
- {
- DllCall( "WinINet\InternetQueryDataAvailable", Ptr, hRequest, "Int*", Content_Length, "UInt", 0, Ptr, 0 )
- If VarSetCapacity( hbuffer, hbuffsz := 4096, 0 )
- && !DllCall( "WinINet\HttpQueryInfo" WorA, Ptr, hRequest, "UInt", 22, Ptr, &hbuffer, "Int*", hbuffsz, Ptr, 0 )
- && VarSetCapacity( hbuffer, hbuffsz, 0 )
- && !DllCall( "WinINet\HttpQueryInfo" WorA, Ptr, hRequest, "UInt", 22, Ptr, &hbuffer, "Int*", hbuffsz, Ptr, 0 )
- MyErrors .= "`nThere was a problem reading the response headers. 'WinINet\HttpQueryInfo" WorA "' failed: ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Else
- {
- VarSetCapacity( hbuffer, -1 )
- StringReplace, hbuffer, hbuffer, `r`n, `n, A
- StringMid, Response_Code, hbuffer, InStr( hbuffer, " " ) + 1, 3
- If ( 17 != pos := 17 + InStr( hbuffer, "`nContent-Length: " ) )
- StringMid, Content_Length, hbuffer, pos, InStr( hbuffer, "`n", 0, pos ) - pos
- }
- }
- If ( Content_Length ) && !InStr( MyErrors, "`n" )
- {
- If ( Do_Download_To_File ) && !( Do_Download_To_File := DllCall( "CreateFile" WorA, Ptr, &output_file_path, "UInt", 0x40000000, "UInt", 0, Ptr, 0, "UInt", 4, "UInt", 0, Ptr, 0, Ptr ) )
- MyErrors .= "`nThere was a problem opening/creating the output file for writing data: """ output_file_path """. 'CreateFile" WorA "' failed: ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Else If ( Do_Download_Resume ) && !DllCall( "SetFilePointerEx", Ptr, Do_Download_To_File, "Int64", Do_Download_Resume, Ptr, 0, "UInt", 0 )
- MyErrors .= "`nThere was a problem seeking to the end of the output file for resuming the download. 'SetFilePointerEx' failed: ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Else If ( Do_Callback ) && ( "CANCEL" = %Do_Callback_Func%( Do_Download_Resume, Content_Length + Do_Download_Resume, Do_Callback_3rdParam ) )
- MyErrors .= "`nThe callback function: """ Do_Callback_Func """ returned 'CANCEL' to cancel the transaction. Zero bytes were downloaded."
- Else
- {
- VarSetCapacity( dbuffer, dbuffsz := Do_Download_To_File ? 4096 : 4096 + Content_Length, 0 )
- Loop
- IfInString, MyErrors, `n
- Break
- Else
- {
- If ( Do_Download_To_File )
- pos := &dbuffer
- Else If ( size + 4096 < Content_Length )
- pos := &dbuffer + size
- Else
- {
- VarSetCapacity( rbuffer, rbuffsz := size + 4096 + 1, 0 )
- pos := &rbuffer + size
- }
- If !DllCall( "WinINet\InternetReadFile", Ptr, hRequest, Ptr, pos, "UInt", 4096, "Int*", dtsz )
- MyErrors .= "`nThere was a problem downoading data. 'WinINet\InternetReadFile' failed: ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Else If !dtsz
- {
- If ( Do_Callback )
- %Do_Callback_Func%( 1, Content_Length + Do_Download_Resume, Do_Callback_3rdParam )
- Break
- }
- Else If ( Do_Download_To_File ) && !DllCall( "WriteFile", Ptr, Do_Download_To_File, Ptr, pos, "UInt", dtsz, "Int*", 0, Ptr, 0 )
- MyErrors .= "`nThere was a problem writing data to the disk. 'WriteFile' failed: ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- Else If !( Do_Download_To_File ) && ( size < rbuffsz )
- {
- DllCall( "RtlMoveMemory", Ptr, &rbuffer, Ptr, &dbuffer, "Int", size )
- VarSetCapacity( dbuffer, Content_Length := 4096 + ( size += dtsz ), 0 )
- DllCall( "RtlMoveMemory", Ptr, &dbuffer, Ptr, &rbuffer, "Int", size )
- rbuffsz := 0
- }
- Else size += dtsz
- If ( Do_Callback ) && ( "CANCEL" = %Do_Callback_Func%( ( size + Do_Download_Resume ) / ( Content_Length + Do_Download_Resume ), Content_Length + Do_Download_Resume, Do_Callback_3rdParam ) )
- MyErrors .= "`nThe callback function: """ Do_Callback_Func """ returned 'CANCEL' to cancel the transaction. " size " bytes were uploaded."
- }
- If ( Do_Download_To_File )
- {
- If ( Do_Legacy_Dual_Output )
- {
- VarSetCapacity( dbuffer, size + 1, 0 )
- If !DllCall( "ReadFile", Ptr, Do_Download_To_File, Ptr, &dbuffer, "UInt", size, Ptr, 0, Ptr, 0 )
- MyErrors .= "`nThere was a problem reading the file """ output_file_path """. 'ReadFile' failed: ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- }
- If !DllCall( "CloseHandle", Ptr, Do_Download_To_File )
- MyErrors .= "`nThere was a problem closing the file """ output_file_path """. 'CloseHandle' failed: ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- }
- }
- }
- DllCall( "WinINet\InternetCloseHandle", Ptr, hRequest )
- DllCall( "WinINet\InternetCloseHandle", Ptr, hConnection )
- DllCall( "WinINet\InternetCloseHandle", Ptr, hInternet )
- DllCall( "FreeLibrary", Ptr, hModule )
- If ( Do_Dn_MD5_Hash ) && InStr( hbuffer, "`nContent-MD5: " )
- If ( Do_Download_To_File )
- hbuffer .= "`nComputed-MD5: " HTTPRequest_MD5( rbuffer, output_file_path )
- Else hbuffer .= "`nComputed-MD5: " HTTPRequest_MD5( dbuffer, size )
- If ( size ) && ( !( Do_Download_To_File ) || ( Do_Legacy_Dual_Output ) )
- {
- If ( 15 != pos := 15 + InStr( hbuffer, "`nContent-Type: " ) )
- StringMid, Content_Type, hbuffer, pos, InStr( hbuffer "`n", "`n", 0, pos ) - pos
- Else Content_Type := "text/plain; charset=" MyCharset
- If ( 7 != pos := 7 + InStr( Content_Type, "charset=" ) )
- && ( pos := InStr( Codepage_Charsets, SubStr( Content_Type, pos
- , InStr( Content_Type ";" , ";", 0, pos ) - pos ) "|" ) )
- StringMid, Convert_POST_To_Codepage, Codepage_Charsets, pos - 5, 5
- Else Convert_POST_To_Codepage := IsUnicode ? "65001" : MyACP
- StringLeft, Content_Type, Content_Type, InStr( Content_Type ";", ";" ) - 1
- If !( pos := InStr( Content_Type, "text/" ) = 1 )
- Loop, Parse, Text_Content_Subtypes, /
- If ( pos |= 0 < InStr( Content_Type, "/" A_LoopField ) )
- Break
- If ( Do_Binary_Down ) || !( pos ) || ( Convert_POST_To_Codepage = MyACP )
- {
- VarSetCapacity( In_POST__Out_Data, size + 2, 0 )
- DllCall( "RtlMoveMemory", Ptr, &In_POST__Out_Data, Ptr, &dbuffer, "Int", size )
- If ( pos )
- VarSetCapacity( In_POST__Out_Data, -1 )
- }
- Else
- {
- If ( Convert_POST_To_Codepage = "01200" )
- {
- pos := &dbuffer
- rbuffsz := size >> 1
- }
- Else If ( 0 < rbuffsz := DllCall( "MultiByteToWideChar", "UInt", Convert_POST_To_Codepage, "UInt", 0, Ptr, &dbuffer, "Int", size, Ptr, 0, "Int", 0 ) )
- {
- VarSetCapacity( rbuffer, rbuffsz + 1 << 1 )
- DllCall( "MultiByteToWideChar", "UInt", Convert_POST_To_Codepage, "UInt", 0, Ptr, &dbuffer, "Int", size, Ptr, pos := &rbuffer, "Int", rbuffsz )
- }
- Else MyErrors .= "`nThere was a problem converting codepage " Convert_POST_To_Codepage " to " MyACP ". 'MultiByteToWideChar' failed: Return value = " rbuffsz ", ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- If ( IsUnicode )
- {
- VarSetCapacity( In_POST__Out_Data, rbuffsz + 1 << 1, 0 )
- DllCall( "RtlMoveMemory", Ptr, &In_POST__Out_Data, Ptr, &rbuffer, "Int", rbuffsz << 1 )
- VarSetCapacity( In_POST__Out_Data, -1 )
- }
- Else If ( 0 < rbuffsz ) && ( 0 < dbuffsz := DllCall( "WideCharToMultiByte", "UInt", MyACP, "UInt", 0, Ptr, pos, "Int", rbuffsz, Ptr, 0, "Int", 0, Ptr, 0, Ptr, 0 ) )
- {
- VarSetCapacity( In_POST__Out_Data, dbuffsz + 1, 0 )
- DllCall( "WideCharToMultiByte", "UInt", MyACP, "UInt", 0, Ptr, pos, "Int", rbuffsz, Ptr, &In_POST__Out_Data, "Int", dbuffsz, Ptr, 0, Ptr, 0 )
- size := dbuffsz
- VarSetCapacity( In_POST__Out_Data, -1 )
- }
- Else MyErrors .= "`nThere was a problem converting codepage " Convert_POST_To_Codepage " to " MyACP ". 'WideCharToMultiByte' failed: Return value = " dbuffsz ", ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
- }
- }
- Else
- In_POST__Out_Data := ""
- In_Out_HEADERS := SubStr( hbuffer, 1, -1 ) . SubStr( MyErrors, 1 + ( hbuffer = "" ) )
- Return size, dbuffer := "", hbuffer := "", rbuffer := "", ErrorLevel := Response_Code
- }
- HTTPRequest_MD5( byref data, length=-1 ) {
- Static s, k, pty, u, p:=0, r := "GLQVGLQVGLQVGLQVEINTEINTEINTEINTDKPWDKPWDKPWDKPWFJOUFJOUFJOUFJOU"
- If !( p )
- {
- VarSetCapacity( k, 256 )
- VarSetCapacity( S, 64, 0 )
- u := !!A_IsUnicode
- pty := A_PtrSize = "" ? "UInt" : "Ptr"
- Loop, 64
- NumPut( i := Floor(Abs(Sin(A_Index)) * 0x100000000 ), k, A_Index - 1 << 2, "UInt" )
- }
- If length IS NOT NUMBER
- IfExist, % length
- {
- hFile := DllCall( "CreateFile" ( u ? "W" : "A" ), "Str", length
- , "UInt", 0x80000000
- , "UInt", 0, pty, 0
- , "UInt", 4
- , "UInt", 0, pty, 0, Ptr )
- VarSetCapacity( l, 8 )
- DllCall( "GetFileSizeEx", pty, hFile, pty, &l )
- length := NumGet( l, 0, "Int64" )
- }
- If Round( length ) < 1
- length := StrLen( dat ) << u
- ha := 0x67452301, hb := 0xEFCDAB89, hc := 0x98BADCFE, hd := 0x10325476
- Loop % length + 72 >> 6
- {
- If ( f := length - 64 > ( e := A_Index - 1 << 6 ) ? 64 : length > e ? length - e : 0 )
- If ( hFile )
- DllCall( "ReadFile", pty, hFile, pty, &s, "UInt", f, pty, &l, pty, 0 )
- Else DllCall( "RtlMoveMemory", pty, &s, pty, &data + e, "UInt", f )
- If ( f != 64 && e <= length )
- NumPut( 128, s, f, "UChar" )
- If ( f < 56 )
- Loop 8
- NumPut( ( ( length << 3 ) >> ( A_Index - 1 << 3 ) ) & 255, s, 55 + A_Index, "UChar" )
- a := ha, b := hb, c := hc, d := hd
- Loop 64
- {
- e := NumGet( r, ( i := A_Index - 1 ) << u, "UChar" ) & 31
- f := 0 = ( j := i >> 4 ) ? (b&c)|(~b&d) : j=1 ? (d&b)|(~d&c) : j=2 ? b^c^d : c^(~d|b)
- g := &s + (( i * ( 3817 >> j * 3 & 7 ) + ( 328 >> j * 3 & 7 ) & 15 ) << 2 )
- w := (*(g+3) << 24 | *(g+2) << 16 | *(g+1) << 8 | *g) + a + f + NumGet(k,i<<2,"UInt")
- a := d, d := c, c := b, b += w << e | (( w & 0xFFFFFFFF ) >> ( 32 - e ))
- }
- ha := ha+a&0xFFFFFFFF, hb := hb+b&0xFFFFFFFF, hc := hc+c&0xFFFFFFFF, hd := hd+d&0xFFFFFFFF
- VarSetCapacity( S, 64, 0 )
- }
- If ( hFile )
- DllCall( "CloseHandle", pty, hFile )
- Loop 32
- g:=1&(i:=A_Index-1), e:=Chr(97+(i>>3))
- , f:=15&(h%e%>>((!g-g+i&7)<<2)), s.=Chr(48+f+39*(9<f))
- s .= "0000"
- Loop 6
- Loop, % 4+0*(g := Abs("0x" SubStr( s,A_Index*6-5,6)))
- i:=(g>>6*(4-A_Index))&63, s.=i=63 ? "/" : i=62 ? "+" : Chr(i<26 ? i+65 : i<52 ? i+71 : i-4)
- Return SubStr( s, 37, 22 ) "=="
- }
- httpQuery(byref Result, lpszUrl, POSTDATA="", HEADERS="")
- { global httpQueryOps, httpAgent, httpProxy, httpProxyByPass, httpQueryReferer, httpQueryAcceptType
- , httpQueryDwFlags
- defaultOps =
- (LTrim Join|
- httpAgent=script|httpProxy=0|httpProxyByPass=0|INTERNET_FLAG_SECURE=0x00800000
- SECURITY_FLAG_IGNORE_UNKNOWN_CA=0x00000100|SECURITY_FLAG_IGNORE_CERT_CN_INVALID=0x00001000
- SECURITY_FLAG_IGNORE_CERT_DATE_INVALID=0x00002000|SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE=0x00000200
- INTERNET_OPEN_TYPE_PROXY=3|INTERNET_OPEN_TYPE_DIRECT=1|INTERNET_SERVICE_HTTP=3
- )
- Loop,Parse,defaultOps,|
- {
- RegExMatch(A_LoopField,"(?P<Option>[^=]+)=(?P<Default>.*)",http)
- if StrLen(%httpOption%)=0
- %httpOption% := httpDefault
- }
- hModule := DllCall("LoadLibrary", "Str", "WinINet.Dll")
- offset_name_length:= "4-lpszScheme-255|16-lpszHostName-1024|28-lpszUserName-1024|"
- . "36-lpszPassword-1024|44-lpszUrlPath-1024|52-lpszExtrainfo-1024"
- VarSetCapacity(URL_COMPONENTS,60,0)
- NumPut(60,URL_COMPONENTS,0), NumPut(255,URL_COMPONENTS,12), NumPut(0xffff,URL_COMPONENTS,24)
- Loop,Parse,offset_name_length,|
- {
- RegExMatch(A_LoopField,"(?P<Offset>\d+)-(?P<Name>[a-zA-Z]+)-(?P<Size>\d+)",iCU_)
- VarSetCapacity(%iCU_Name%,iCU_Size,0)
- NumPut(&%iCU_Name%,URL_COMPONENTS,iCU_Offset)
- NumPut(iCU_Size,URL_COMPONENTS,iCU_Offset+4)
- }
- DllCall("WinINet\InternetCrackUrlA","Str",lpszUrl,"uInt",StrLen(lpszUrl),"uInt",0,"uInt",&URL_COMPONENTS)
- Loop,Parse,offset_name_length,|
- {
- RegExMatch(A_LoopField,"-(?P<Name>[a-zA-Z]+)-",iCU_)
- VarSetCapacity(%iCU_Name%,-1)
- }
- nPort:=NumGet(URL_COMPONENTS,24,"uInt")
- dwFlags := httpQueryDwFlags
- if (lpszScheme = "https")
- dwFlags |= (INTERNET_FLAG_SECURE|SECURITY_FLAG_IGNORE_CERT_CN_INVALID
- |SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE)
- if (lpszScheme="unknown") {
- Result := "ERR: No Valid URL supplied."
- Return StrLen(Result)
- }
- hInternet := DllCall("WinINet\InternetOpenA"
- ,"Str",httpAgent,"UInt"
- ,(httpProxy != 0 ? INTERNET_OPEN_TYPE_PROXY : INTERNET_OPEN_TYPE_DIRECT )
- ,"Str",httpProxy,"Str",httpProxyBypass,"Uint",0)
- hConnect := DllCall("WinINet\InternetConnectA"
- ,"uInt",hInternet,"Str",lpszHostname, "Int",nPort
- ,"Str",lpszUserName, "Str",lpszPassword,"uInt",INTERNET_SERVICE_HTTP
- ,"uInt",0,"uInt*",0)
- if (Strlen(POSTDATA)>0) {
- HTTPVerb:="POST"
- if StrLen(Headers)=0
- Headers:="Content-Type: application/x-www-form-urlencoded"
- } else
- HTTPVerb:="GET"
- hRequest := DllCall("WinINet\HttpOpenRequestA"
- ,"uInt",hConnect,"Str",HTTPVerb,"Str",lpszUrlPath . lpszExtrainfo
- ,"Str",ProVer := "HTTP/1.1", "Str",httpQueryReferer,"Str",httpQueryAcceptTypes
- ,"uInt",dwFlags,"uInt",Context:=0 )
- sRequest := DllCall("WinINet\HttpSendRequestA"
- , "uInt",hRequest,"Str",Headers, "uInt",Strlen(Headers)
- , "Str",POSTData,"uInt",Strlen(POSTData))
- VarSetCapacity(header, 2048, 0)
- VarSetCapacity(header_len, 4, 0)
- Loop, 5
- if ((headerRequest:=DllCall("WinINet\HttpQueryInfoA","uint",hRequest
- ,"uint",21,"uint",&header,"uint",&header_len,"uint",0))=1)
- break
- If (headerRequest=1) {
- VarSetCapacity(res,headerLength:=NumGet(header_len),32)
- DllCall("RtlMoveMemory","uInt",&res,"uInt",&header,"uInt",headerLength)
- Loop,% headerLength
- if (*(&res-1+a_index)=0)
- NumPut(Asc("`n"),res,a_index-1,"uChar")
- VarSetCapacity(res,-1)
- } else
- res := "timeout"
- Loop,Parse,res,`n,`r
- {
- RetValue := A_LoopField
- break
- }
- If (RetValue="timeout") {
- html := "Error: timeout"
- return -1
- }
- RetValue := RegExReplace(RetValue,"HTTP/1\.[01]\s+")
- RetValue := SubStr(RetValue,1,3)
- if strlen(HTTPQueryOps)>0 {
- if (instr(HTTPQueryOps,"showHeader"))
- MsgBox % res
- if (instr(HTTPQueryOps,"storeHeader"))
- global HttpQueryHeader := res
- if (instr(HTTPQueryOps,"updateSize")) {
- Loop,Parse,res,`n
- If RegExMatch(A_LoopField,"Content-Length:\s+?(?P<Size>\d+)",full) {
- global HttpQueryFullSize := fullSize
- break
- }
- if (fullSize+0=0)
- HttpQueryFullSize := "size unavailable"
- }
- }
- if !(InStr("100 200 201 202 500 502",RetValue)) {
- Result := RetValue " " RetMsg
- return StrLen(Result)
- }
- VarSetCapacity(BytesRead,4,0)
- fsize := 0
- Loop
- { bc := A_Index
- VarSetCapacity(buffer%bc%,1024,0)
- ReadFile := DllCall("wininet\InternetReadFile"
- ,"uInt",hRequest,"uInt",&buffer%bc%,"uInt",1024,"uInt",&BytesRead)
- ReadBytes := NumGet(BytesRead)
- If ((ReadFile!=0)&&(!ReadBytes))
- break
- Else {
- fsize += ReadBytes
- sizeArray .= ReadBytes "|"
- }
- if (instr(HTTPQueryOps,"updateSize"))
- Global HttpQueryCurrentSize := fsize
- }
- sizeArray := SubStr(sizeArray,1,-1)
- VarSetCapacity(result,fSize+1,0)
- Dest := &result
- Loop,Parse,SizeArray,|
- DllCall("RtlMoveMemory","uInt",Dest,"uInt",&buffer%A_Index%,"uInt",A_LoopField)
- , Dest += A_LoopField
- DllCall("WinINet\InternetCloseHandle", "uInt", hRequest)
- DllCall("WinINet\InternetCloseHandle", "uInt", hInternet)
- DllCall("WinINet\InternetCloseHandle", "uInt", hConnect)
- DllCall("FreeLibrary", "UInt", hModule)
- return fSize
- }
- EncodeURL( p_data, p_reserved=true, p_encode=true )
- {
- old_FormatInteger := A_FormatInteger
- SetFormat, Integer, hex
- unsafe =
- ( Join LTrim
- 25000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20
- 22233C3E5B5C5D5E607B7C7D7F808182838485868788898A8B8C8D8E8F9091929394
- 95969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6
- B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8
- D9DADBDCDDDEDF7EE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9
- FAFBFCFDFEFF
- )
- if ( p_reserved )
- unsafe = %unsafe%24262B2C2F3A3B3D3F40
- if ( p_encode )
- loop, % StrLen( unsafe )//2
- {
- StringMid, token, unsafe, A_Index*2-1, 2
- StringReplace, p_data, p_data, % Chr( "0x" token ), `%%token%, all
- }
- else
- loop, % StrLen( unsafe )//2
- {
- StringMid, token, unsafe, A_Index*2-1, 2
- StringReplace, p_data, p_data, `%%token%, % Chr( "0x" token ), all
- }
- SetFormat, Integer, %old_FormatInteger%
- return, p_data
- }
- DecodeURL( p_data )
- {
- return, EncodeURL( p_data, true, false )
- }
- Ansi2Oem(sString)
- {
- Ansi2Unicode(sString, wString, 0)
- Unicode2Ansi(wString, zString, 1)
- Return zString
- }
- Oem2Ansi(zString)
- {
- Ansi2Unicode(zString, wString, 1)
- Unicode2Ansi(wString, sString, 0)
- Return sString
- }
- Ansi2UTF8(sString)
- {
- Ansi2Unicode(sString, wString, 0)
- Unicode2Ansi(wString, zString, 65001)
- Return zString
- }
- UTF82Ansi(zString)
- {
- Ansi2Unicode(zString, wString, 65001)
- Unicode2Ansi(wString, sString, 0)
- Return sString
- }
- Ansi2Unicode(ByRef sString, ByRef wString, CP = 0)
- {
- nSize := DllCall("MultiByteToWideChar"
- , "Uint", CP
- , "Uint", 0
- , "Uint", &sString
- , "int", -1
- , "Uint", 0
- , "int", 0)
- VarSetCapacity(wString, nSize * 2)
- DllCall("MultiByteToWideChar"
- , "Uint", CP
- , "Uint", 0
- , "Uint", &sString
- , "int", -1
- , "Uint", &wString
- , "int", nSize)
- }
- Unicode2Ansi(ByRef wString, ByRef sString, CP = 0)
- {
- nSize := DllCall("WideCharToMultiByte"
- , "Uint", CP
- , "Uint", 0
- , "Uint", &wString
- , "int", -1
- , "Uint", 0
- , "int", 0
- , "Uint", 0
- , "Uint", 0)
- VarSetCapacity(sString, nSize)
- DllCall("WideCharToMultiByte"
- , "Uint", CP
- , "Uint", 0
- , "Uint", &wString
- , "int", -1
- , "str", sString
- , "int", nSize
- , "Uint", 0
- , "Uint", 0)
- }
Advertisement
Add Comment
Please, Sign In to add comment