Kaptain.
Telegram /
LinkedIn /
Email /
GIT /
RSS /
GPG /

№ 10157 В разделах:
Programming
Sysadmin
от August 3rd, 2019,
В подшивках: Bash, Headless browser, Lua, Splash
Before start install jq application, required to work with JSON, used to prepare lua script for sending to Splash API.
Create file named splash.lua
function main(splash, args)
splash:set_user_agent('Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_2_1 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5H11 Safari/525.20')
splash:set_viewport_size(800, 600)
splash:go('https://www.whatismybrowser.com/')
splash:wait(0.5)
return splash:png()
end
Create bash script run.sh
#!/bin/bash
JSON="{\"lua_source\":$(jq -Rs . < script.lua)}"
curl -s -X POST -H "Content-Type: application/json" -d "${JSON}" \
"http://192.168.1.9:5009/execute" -o out.png
Check result image
Fortune cookie: There was a young girl of Newcastle Whose charms were declared universal. While one man in front Wired into her cunt, Another was engaged at her arsehole.
Leave a Reply