This question already has answers here:
HTTP GET in VBS
(4 answers)
Closed 1 year ago.
Long time lurker.. first time poster..
I'm fairly proficient with PowerShell. However, I have a requirement to use a get response to a rest API using VBS and I'm completely out of my depths.
Normally using the following in PowerShell would return me a string for a just in time password.
Invoke-RestMethod "https://domain/password" -UseDefaultCredentials
I'm attempting to do the same method in VBS but I believe my issue is to do with passing through the credentials. Everything I've tried has failed me and I can't find any relatable KBs
How can I do a API call in VBS?
I solved this by using curl with a --ntlm switch
curl.exe --ntlm -u : -sX GET ""https://domain/password""
Related
I'm trying to write a bash script to access a journal overview page on SSRN.
I'm trying to use curl for this, which works for me on other webpages, but it returns error code: 1020 for me if I try to run the following codes:
curl https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1925128
I thought it might have to do with the question mark in the URL, but I got it to work with other pages that contained question marks.
It probably has something to do with what the page's allows to do. However, I can also access the page using R's rvest package, so I think it should work in general also using bash.
Looks like the site has blocked access via curl. Change the user agent and it should work fine i.e.
curl --user-agent 'Chrome/79' "https://papers.ssrn.com/sol3/papersstract_id=1925128"
I want to create a script, which accesses a website behind a login (with 2FA) and press the submit button every x seconds.
Unfortunately, I am a total Shell noob, but I already automated the process with the Chrome extensions "Kantu Browser Automation", but the extension has limits on the looping and a looping timeout.
use curl command for this and put it crontab.
curl:
https://curl.haxx.se/
you have to use POST method.
crontab:
https://crontab.guru/
This question already has answers here:
How to get usernames with VBScript
(4 answers)
Find User Logged on to a Remote Computer
(1 answer)
Closed 4 years ago.
We have a VBScript that pulls the username from HKCU\Volatile Environment\USERNAME. This is great except when running the script as an admin. Then this value changes to the admin username.
Where/how can I get the ORIGINAL username that was logged in? I can't get it from HKEY_CURRENT_USER because the ADMIN account get swapped in from HKEY_USERS.
I found it. I KNEW that the registry had to be hiding the last logged in user somewhere!
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\ LastLoggedOnUser = ".\crewr"
Pull that string and just
replace( returnedRegString, ".\", "" )
and you're golden!
This question already has an answer here:
Google Place Photo API returning 404
(1 answer)
Closed 5 years ago.
When making a call to https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJyWEHuEmuEmsRm9hTkapTCrk with my key, a got a correct response. It gives me photos and photo reference. But when searching for the photo, I got a 404 message. I'm doing a search on https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CmRZAAAAaCHi7iCO7RowcwbEF5dg_QUG3lNW6fr7F_tVLIQ2cy2agD3lvWH2Bms_pvet71mxz7CZaSm3zud8sjPIxN7RrD-pbDHQ6P24yMQS2vJnDFOMHTWx2GowZoQ2GnoAFHU4EhDbUH2QDrCIVXT7JgXg-Ck9GhSlBLEcxhUM7Ewl6LP9cnh4_YYZSQ for instance (with key). The photo reference is what I got from the above search.
Anything I'm doing wrong? Or could it be a Google caching problem?
I think this is because the response is not json try removing it:
https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CmRZAAAAaCHi7iCO7RowcwbEF5dg_QUG3lNW6fr7F_tVLIQ2cy2agD3lvWH2Bms_pvet71mxz7CZaSm3zud8sjPIxN7RrD-pbDHQ6P24yMQS2vJnDFOMHTWx2GowZoQ2GnoAFHU4EhDbUH2QDrCIVXT7JgXg-Ck9GhSlBLEcxhUM7Ewl6LP9cnh4_YYZSQ&key=yourkey
I believe there is an issue with a few of the google sources but it may be related to the placeId you are dealing with. The only difference I have noticed is that 404 are returned when hitting this server https://lh5.googleusercontent.com and photos are returned when hitting this server https://lh4.googleusercontent.com.
For example, I had success with this placeId - ChIJWTLw5D17NYgR0WSz74Ble5s
i'm testing some network simple process to understand better and know how to work with NTLM.
Following this (ntlm-proxy-without-password) Q&A i found hot to uthenticate my transaction via ntml using the log information of the current user.
The command is this: curl.exe -U : --proxy-ntlm --proxy myproxy.com:8080 http://www.google.com
Know i have to do the same thing using libcurl since i need to achieve that result into the application i'm developing. There is a way to do this?
Following this Q&A i found hot to
This solved like a charm
curl_easy_setopt(ctx, CURLOPT_PROXYUSERPWD, ":");