-
Posts
187 -
Joined
-
Last visited
About Chance
- Birthday 03/13/1996
Profile Information
-
Location
Equestria
-
Interests
everything
Recent Profile Visitors
759 profile views
Chance's Achievements
-
Parsix reacted to a post in a topic:
Encode image in memory without saving to file [Save image to stream]
-
boomingranny reacted to a post in a topic:
Software written in AutoIt
-
Molina reacted to a post in a topic:
Software written in AutoIt
-
I have had some time playing with UIs, not as much as others like UEZ iirc but what I know NOW leads me to believe that there is no convenient method for this, not even with some nifty UI UDF here (unless you count metro udf) and the easiest way about it is to use something like the metro UDF and design your own UI using GDIplus or use some HTML/CSS rendering system for this. I'm not a pro but iirc AutoIt's GUI stuff uses windows API which is very limited in speed and ability so it is best to tackle this with another language.
-
steveeye reacted to a post in a topic:
Web programming suggestions
-
You would probably like Electron. https://electron.atom.io/ A lot of people get mad at people who use this to develop desktop apps because it can sometimes be costly on memory but it's the easiest way to develop cross platform desktop apps. I find it fun to make random stuff with this, you can also use autoitx with it iirc. It's basically a stripped down version of chromium which starts by loading a main javascript file, with that you tell it to create a window, how it will look with CSS and HTML and listen for window events and handle them with javascript, it also has nodejs built in so you have file system access and many other things. Even small projects end up being around 100 mb more or less though, and around 800 MB on ram lol discordapp desktop uses electron, photoshop uses it for several things. It's been gaining some momentum over the past 5 years.
-
Skysnake reacted to a post in a topic:
Software written in AutoIt
-
Do stories of encountering software written in autoit in the wild count? Some small company once hired me to maintain a VPS with data mining bots on windows because the previous guy was constantly having to maintain the VPS because the programs he created were unstable and crashing the VPS. I discovered the programs were autoit scripts. Being a fan of the language I was quite amused at how much data these three programs were processing, a chain of API requests and SQL queries. One program was constantly making requests to several APIs and got several tens of keys, then passed it to the next program who would make a call for each of those keys, then the next program would create several queries for each of those keys. It was really testing its limits. There was an API call that dealt with having to MD5 hash a key and the guy used a javascript processing program (not even nodejs, ie or whatever else) to run some MD5 hashing code, it would launch that program once a second.. I was surprised the guy wasn't able to recognize an MD5 hashing function in javascript when he saw one yet wrote all these programs.. I told my employer this was the wrong language for the job so I replaced everything with my own stuff but I did keep a version of the autoit bots maintained just because I wanted to see them functioning and doing that job cause I thought it was kinda cute somehow, probably because how elaborate it was using all these components to deal with things he didn't know how to properly deal with. Replaced the JS md5 hashing function and that JS interpreter with a simple "_Crypt_HashData" call, created a logging system to catch where the crash happened and realized after 3 days of running it built a ridiculous SQL query that killed the server and it could run for weeks with no issues after that, but still it was quite laggy compared to its successor so I had to let it die... Autoits limit is it's single threaded and developing functionality to circumvent this can be more costly than doing everything in another language that is well suited for the task.
-
Chance reacted to a post in a topic:
MetroGUI UDF v5.1 - Windows 10 style buttons, toggles, radios, menu etc.
-
oh snap, I see now. This is useful when you download a project and keep getting that dumb untrusted warning. Thanks
-
What exactly do you mean by unblock? Does this take ownership of files and allow you to delete them when owned by another user or does this literally remove locks on files when held by another process, such as when scite has a lock on the parent folder of the open script and does nto allow you to delete it until the process is closed
-
coffeeturtle reacted to a post in a topic:
Network Connections Viewer
-
Well now since this has been bumped, I was wondering. Is there a way to get process receive/send bytes over network like procexp?
-
How to select a web element by its displaying text?
Chance replied to devchaminda's topic in AutoIt General Help and Support
Isn't that firefox? does that have to be done with autoit? If I were you, and I was just trying to automate things (i used autoit mostly to set up larger projects and keep them in order on windows), I'd save me the trouble of 'automating' some browser related task with a few extra megabytes and operation time with things that were designed specifically for that (if that's the case and u know JS, trust me), just use something like NodeJS with get the info u need or want to automate. If that wasn't enough, go another 10 megabytes and use slimerjs/phantomjs If not, go with the above, what smoke_n said, IE works best with AutoIt as it's the best supported ofc. -
mLipok reacted to a post in a topic:
_pop3 UDF, according to the 1939 RFC
-
neat, I've been using that API for some time to manage passwords on my chromium installation.. I've been meaning to make a password manager in autoit for some time now that imports passwords.. I already have one that does that for chrome/chromium I'm surprised noone's made a legit one yet.. or thrown some source for one here..
-
Chance reacted to a post in a topic:
Your public IP (STUN protocol)
-
Chance reacted to a post in a topic:
Multi-thread AutoIt
-
HTTP Request GET with proxy don't work
Chance replied to MRXTO09's topic in AutoIt General Help and Support
Sometimes proxies with those weird port numbers don't work. I usually use proxies that are on the 3128, 3129, 443, 8x, 8xxx ports. Sometimes they do works but it's not nearly as common as the ones on those ports. Also, it depends on what the proxy supports, http/https, make sure you're setting the right flags for the request. -
I was curious.. I remember there was mention of some changes to the syntax, like making it so $test = [1,2,3] would create an array w/o needing to specify $test[3]. Is that still being continued?
-
C structures and AutoIt [MT DLL]
Chance replied to Chance's topic in AutoIt General Help and Support
... you're right.... I dunno why i didn't see that, I read on how the function I'm using works and it will return all the array, uncluding the null portions.. Now I guess I need to figure out how to spit out a byte array of variable size so as to avoid all those null bytes.. heh, thanks, but I guess it was actually a problem with my lack of understanding how AutoIts DllStructGetData works. -
C structures and AutoIt [MT DLL]
Chance replied to Chance's topic in AutoIt General Help and Support
thanks It was a good friend, one eyed guy who was shot in the eye some time ago. He was drunk and trying to unload a Colt SAA. he tried pulling on the pin to release the chamber and accidentally pulled back on the hammer which slipped and fired... yes, your work and existence makes me come back. Anyway, I'm at my PC now and took this on again, managed to make it work after a few more tries.. memcpy(tData->ResponceHTML, m_pResponse, INT_BUFFERSIZE); this time it's copying everything from the web resource, but now it's returning an ungodly amount of 0s after the resource.. "746D6C3E0000000000000" How do I make it stop giving me all those null bytes? I'm not sure if this is a problem with DllStructGetData($tURL_COMPONENTS, "ResponceHTML") or that I might be messing up the struct I created in autoit.. -
C structures and AutoIt [MT DLL]
Chance replied to Chance's topic in AutoIt General Help and Support
No, unrelated to the code, I actually received a bullet to the fovea capitis on the femur, aka the ball joint of the Femur... Some drunk idiot "shot" me while we were drinking. lol.. -
C structures and AutoIt [MT DLL]
Chance replied to Chance's topic in AutoIt General Help and Support
K, so I will be abandoning this. Someone shot me shortly after this post so now my focus is set on recovery... -
So some time ago I created a project, a DLL to create background requests in separate threads using WinHTTP and pass around data using C structures. It all worked out wonderfully with the exception of a crash every now and then, but it got the job done. Now I have need to make my dll return data in binary instead of doing the conversions internally, I want to be able to receive any kind of data, from text, binary all the way to gzip data. I basically make a copy of the structure in my dll on the AutoIt side. Global $INT_BUFFERSIZE = 1048576 Global $tagTHREAD_PARAMETERS = _ "WCHAR UserAgent[1024];" & _ ; user agent "WCHAR HTTPVerb[1024];" & _ ; POST/GET/HEAD etc "WCHAR Host[1024];" & _ ; ex: google.com "WCHAR Resource[1024];" & _ ; ex: /somescript.php "int Port;" & _ ; 80/443 "WCHAR Referer[1024];" & _ ; optional referer "WCHAR Headers[1024];" & _ ; null terminated request headers "ptr ExtraData;" & _ ; pointer to structure with arguments ex: a=1&b=2&page=45 "DWORD Length;" & _ ; lenght of the arguents "DWORD TotalLength;" & _ ; same as above "int dwResolveTimeout;" & _ ; Resolve timout "int dwConnectTimeout;" & _ ; Connection timout "int dwSendTimeout;" & _ ; Send timeout "int dwReceiveTimeout;" & _ ; Recieve timeout "WCHAR Proxy[1024];" & _ ; proxy string "DWORD ProxyFlags;" & _ ; WinHTTP open flags "DWORD SendFlags;" & _ ; WinHttpOpenRequest flags "BYTE ResponceHTML[" & $INT_BUFFERSIZE & "];" & _ ; HTML returned "WCHAR ResponceHeaders[" & $INT_BUFFERSIZE & "];" & _ ; Responce Headers "DOUBLE Latency;" & _ ; Responce Latency "int RetryTimes;" & _ ; Times to retry request with server "int MaxTestTime;" & _ ; max amount of time the request can run for "ptr httpSession;" & _ "ptr httpConnect;" & _ "ptr httpRequest" And I have this copy in my dll which I later initialize with my AutoIt copy so I can use all the info in it and subsequently return data as well. // AutoIt thread parameters static const int INT_BUFFERSIZE = 1048576; // Had to increase to 1MB because I was getting very big pages with some tests and it wouldn't work // AutoIt thread parameters, AutoIt will create a version of this and pass it as a thread paramater struct THREAD_PARAM_COMPONENTS { WCHAR UserAgent[1024]; // user agent WCHAR HTTPVerb[1024]; // POST/GET/HEAD etc WCHAR Host[1024]; // Domain name for target request WCHAR Resource[1024]; // resource at target int Port; // port on target WCHAR Referer[1024]; // referer WCHAR Headers[1024]; // headers string LPVOID ExtraData; // additional data/paramaters to send DWORD Length; // lenght of additional data DWORD TotalLenght; // same as above for some reason int dwResolveTimeout; // max time for resolving int dwConnectTimeout; // max time for connection int dwSendTimeout; // max time to wait while sending int dwReceiveTimeout; // max time to wait for recieving responce WCHAR Proxy[1024]; // proxy for request DWORD ProxyFlags; // flags for proxy DWORD SendFlags; // send flags BYTE ResponceHTML[INT_BUFFERSIZE]; // HTML from responce WCHAR ResponceHeaders[INT_BUFFERSIZE]; // headers from responce double Latency; // return indicating total time spent in request int RetryTimes; // maximum times to retry request if failures happen int MaxTestTime; // maximum time to spend in request LPVOID httpSession; // Session handles returned to AutoIt LPVOID httpConnect; // Session handles returned to AutoIt LPVOID httpRequest; // Session handles returned to AutoIt }; I then pass the structure I created AutoIt side to the dll and it creates a thread and initializes the structure. THREAD_PARAM_COMPONENTS* tData = (THREAD_PARAM_COMPONENTS*)threadData; // threadData is passed as an LPVOID to the thread And then I start accessing the stuff I sent from my AutoIt script from inside the DLL... ... hSession = ::WinHttpOpen(tData->UserAgent, tData->ProxyFlags, tData->Proxy, WINHTTP_NO_PROXY_BYPASS, 0); ... So far all that stuff works, requests are made and data was returned, up until I attempted to change my program from returning WCHAR data to a BYTE array. And now I get nothing but a ridiculous amount of zeros like "0x0000.... to infinity". so far this is the problem var in both sides. BYTE ResponceHTML[INT_BUFFERSIZE]; // HTML from responce This is my DLL codebase, unicode. ////////////////////////////////////////////////////////////////////////////////////////// // DLL to create multiple background WinHTTP requests. // Why? since AutoIt is single threaded, I need a nonblocking function to make requests. // Project is Unicode ////////////////////////////////////////////////////////////////////////////////////////// #include <Windows.h> #include <WinHTTP.h> #include <string> #include <time.h> #pragma comment(lib, "winhttp.lib") // need to link to lib using namespace std; // AutoIt thread parameters static const int INT_BUFFERSIZE = 1048576; // Had to increase to 1MB because I was getting very big pages with some tests and it wouldn't work // AutoIt thread parameters, AutoIt will create a version of this and pass it as a thread paramater struct THREAD_PARAM_COMPONENTS { WCHAR UserAgent[1024]; // user agent WCHAR HTTPVerb[1024]; // POST/GET/HEAD etc WCHAR Host[1024]; // Domain name for target request WCHAR Resource[1024]; // resource at target int Port; // port on target WCHAR Referer[1024]; // referer WCHAR Headers[1024]; // headers string LPVOID ExtraData; // additional data/paramaters to send DWORD Length; // lenght of additional data DWORD TotalLenght; // same as above for some reason int dwResolveTimeout; // max time for resolving int dwConnectTimeout; // max time for connection int dwSendTimeout; // max time to wait while sending int dwReceiveTimeout; // max time to wait for recieving responce WCHAR Proxy[1024]; // proxy for request DWORD ProxyFlags; // flags for proxy DWORD SendFlags; // send flags BYTE ResponceHTML[INT_BUFFERSIZE]; // HTML from responce WCHAR ResponceHeaders[INT_BUFFERSIZE]; // headers from responce double Latency; // return indicating total time spent in request int RetryTimes; // maximum times to retry request if failures happen int MaxTestTime; // maximum time to spend in request LPVOID httpSession; // Session handles returned to AutoIt LPVOID httpConnect; // Session handles returned to AutoIt LPVOID httpRequest; // Session handles returned to AutoIt }; DWORD WINAPI _WinHTTP_Process(LPVOID threadData); ////////////////////////////////////////////////////////////////////////////////////////// // Dll entry point ////////////////////////////////////////////////////////////////////////////////////////// BOOLEAN APIENTRY DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) { switch ( fdwReason ) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls( hinstDLL );// disable callbacks on new threads, we don't need them. break; case DLL_PROCESS_DETACH: break; } return TRUE; } // End of DllMain ////////////////////////////////////////////////////////////////////////////////////////// // The exported function of our DLL ////////////////////////////////////////////////////////////////////////////////////////// HANDLE WINAPI WinHTTP_Action(LPVOID threadData) { return CreateThread(NULL, 0, // SIZE_T dwStackSize &_WinHTTP_Process, threadData, // LPVOID threadData 0, // DWORD dwCreationFlag NULL); // LPDWORD lpThreadId } // End of WinHTTP_Action ////////////////////////////////////////////////////////////////////////////////////////// // "The Thread" ////////////////////////////////////////////////////////////////////////////////////////// DWORD WINAPI _WinHTTP_Process(LPVOID threadData) { // Initialize the structure that AutoIt sent us, threadData with internal equivalent THREAD_PARAM_COMPONENTS THREAD_PARAM_COMPONENTS* tData = (THREAD_PARAM_COMPONENTS*)threadData; // Timer clock_t init, final; wstring m_charset; //DWORD dError; const unsigned int INT_RETRYTIMES = tData->RetryTimes; bool bRetVal = true; HINTERNET hSession = NULL; hSession = ::WinHttpOpen(tData->UserAgent, tData->ProxyFlags, tData->Proxy, WINHTTP_NO_PROXY_BYPASS, 0); //Note: do not use async... if (!hSession) return false; tData->httpSession = hSession; WinHttpSetTimeouts(hSession, tData->dwResolveTimeout, tData->dwConnectTimeout, tData->dwSendTimeout, tData->dwReceiveTimeout); HINTERNET hConnect = NULL; hConnect = ::WinHttpConnect(hSession, tData->Host, tData->Port, 0 ); if (hConnect != NULL) { tData->httpConnect = hConnect; HINTERNET hRequest = NULL; hRequest = ::WinHttpOpenRequest(hConnect, tData->HTTPVerb, tData->Resource, L"HTTP/1.1", tData->Referer, WINHTTP_DEFAULT_ACCEPT_TYPES, tData->SendFlags); if (hRequest != NULL) { tData->httpRequest = hRequest; bool bGetReponseSucceed = false; init = clock(); // start timer double TotalTime; if (!::WinHttpSendRequest(hRequest, tData->Headers, -1L, //<-- using wcslen()+1 seems to cause an invalid param error here so will stick with -1L tData->ExtraData, (DWORD) tData->Length, (DWORD) tData->TotalLenght, (DWORD) 0)) { // This is just here in case I need to refrence back to how to get and view the last error of a function //dError = GetLastError(); //WCHAR temp[100]; //swprintf_s(temp, 100, L"Error: %d" , dError); //MessageBox(0 , temp, L"Error!", 0); } else { // Call was successfull, continue accepting whatever if (::WinHttpReceiveResponse(hRequest, NULL)) { DWORD dwSize = 0; // Get the buffer size of the HTTP response header. BOOL bResult = ::WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_RAW_HEADERS_CRLF, WINHTTP_HEADER_NAME_BY_INDEX, NULL, &dwSize, WINHTTP_NO_HEADER_INDEX); if (bResult || (!bResult && (::GetLastError() == ERROR_INSUFFICIENT_BUFFER))) { wchar_t *szHeader = new wchar_t[dwSize]; if (szHeader != NULL) { memset(szHeader, 0, dwSize* sizeof(wchar_t)); // Get HTTP response header. if (::WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_RAW_HEADERS_CRLF, WINHTTP_HEADER_NAME_BY_INDEX, szHeader, &dwSize, WINHTTP_NO_HEADER_INDEX)) { _wcslwr_s(szHeader, wcslen(szHeader)+1); wstring lwrHeader = szHeader; // get headers to our structure later unsigned int iMaxBufferSize = INT_BUFFERSIZE; // Should proabbly be setting buffer size autoit side somehow unsigned int iCurrentBufferSize = 0; BYTE* m_pResponse = NULL; m_pResponse = new BYTE[iMaxBufferSize]; memset(m_pResponse, 0, iMaxBufferSize); do { dwSize = 0; if (::WinHttpQueryDataAvailable(hRequest, &dwSize)) { BYTE *pResponse = new BYTE[dwSize + 1]; if (pResponse != NULL) { memset(pResponse, 0, dwSize); DWORD dwRead = 0; if (::WinHttpReadData(hRequest, pResponse, dwSize, &dwRead)) { if (dwRead + iCurrentBufferSize > iMaxBufferSize) { BYTE *pOldBuffer = m_pResponse; m_pResponse = new BYTE[iMaxBufferSize * 2]; if (m_pResponse == NULL) { m_pResponse = pOldBuffer; bRetVal = false; break; } iMaxBufferSize *= 2; memset(m_pResponse, 0, iMaxBufferSize); memcpy(m_pResponse, pOldBuffer, iCurrentBufferSize); delete[] pOldBuffer; } memcpy(m_pResponse + iCurrentBufferSize, pResponse, dwRead); iCurrentBufferSize += dwRead; } delete[] pResponse; } } } while (dwSize > 0); final=clock()-init; TotalTime = (double)final / ((double)CLOCKS_PER_SEC); // Return anything regardless, unless it took too long if (TotalTime < tData->MaxTestTime) { bGetReponseSucceed = true; int p=0; while (p < sizeof(m_pResponse)) { if(m_pResponse[p] != NULL) tData->ResponceHTML[p]=m_pResponse[p]; // write chars to our autoit char array so we can process it over at scriptside p++; } swprintf(tData->ResponceHeaders, INT_BUFFERSIZE, L"%s" ,lwrHeader); tData->Latency = TotalTime; } } } } } } ::WinHttpCloseHandle(hRequest); } ::WinHttpCloseHandle(hConnect); } ::WinHttpCloseHandle(hSession); return 1; } // End of _WinHTTP_Process Everything looked like it should work right but obviously something is not going over as planned... I create the thread like so~ Local $ContentType = _ "Connection: keep-alive" & @CRLF & _ "Cache-Control: no-cache" & @CRLF & _ "Pragma: no-cache" & @CRLF & _ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" & @CRLF & _ "Accept-Language: en-US,en;q=0.8" & @CRLF & _ "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3" & @CRLF $tURL_COMPONENTS = DllStructCreate($tagTHREAD_PARAMETERS) DllStructSetData($tURL_COMPONENTS, "UserAgent", "(COMPATABLE; AutoIt/v3)") DllStructSetData($tURL_COMPONENTS, "HTTPVerb", "GET") DllStructSetData($tURL_COMPONENTS, "Host", "www.google.com") DllStructSetData($tURL_COMPONENTS, "Resource", "test") DllStructSetData($tURL_COMPONENTS, "Port", $INTERNET_DEFAULT_HTTPS_PORT) DllStructSetData($tURL_COMPONENTS, "Referer", "") DllStructSetData($tURL_COMPONENTS, "Headers", $ContentType) DllStructSetData($tURL_COMPONENTS, "ExtraData", 0) DllStructSetData($tURL_COMPONENTS, "Length", 0) DllStructSetData($tURL_COMPONENTS, "TotalLength", 0) DllStructSetData($tURL_COMPONENTS, "dwResolveTimeout", 30000) DllStructSetData($tURL_COMPONENTS, "dwConnectTimeout", 30000) DllStructSetData($tURL_COMPONENTS, "dwSendTimeout", 30000) ; 15 seconds DllStructSetData($tURL_COMPONENTS, "dwReceiveTimeout", 30000) If $Proxy Then DllStructSetData($tURL_COMPONENTS, "Proxy", $Proxy) DllStructSetData($tURL_COMPONENTS, "ProxyFlags", $WINHTTP_ACCESS_TYPE_NAMED_PROXY) Else DllStructSetData($tURL_COMPONENTS, "ProxyFlags", $WINHTTP_ACCESS_TYPE_NO_PROXY) EndIf DllStructSetData($tURL_COMPONENTS, "SendFlags", BitOR($WINHTTP_FLAG_SECURE, $WINHTTP_FLAG_ESCAPE_DISABLE)) ;DllStructSetData($tURL_COMPONENTS, "RetryTimes", 2); unused now DllStructSetData($tURL_COMPONENTS, "MaxTestTime", 60) $hThread = CreateThread(DllStructGetPtr($tURL_COMPONENTS)); dllcall() that will pass the structure pointer to the dll as "ptr" then after creating the thread, the app idles around and waits for the thread to report it terminated. Once the thread has finished doing its thing, it will write whatever it got my my BYTE array and return it. The problem comes when I try to access it now... DllStructGetData($tURL_COMPONENTS, "ResponceHTML") DllStructGetData() will return the binary equivalent of "<!Doc" and then the rest will be zeros, garbage and totally not what I was expecting.. Any ideas? I have included a ready to compile project with a script to test the DLL in the release directory. Full Project.zip