简体   繁体   English

在没有浏览器的情况下调用外部JavaScript函数

[英]Call an external JavaScript function without a browser

I'm working on a raspberry pi project that connects to a Wi-Fi network that requires a user to click a "Log in" button by redirecting the webpage to an internal server, which presumably stores the MAC address in a table, and permits traffic to pass through. 我正在研究一个连接到Wi-Fi网络的raspberry pi项目,该项目要求用户通过将网页重定向到内部服务器来单击“登录”按钮,该服务器大概是将MAC地址存储在表格中,并允许交通通过。

Given that the pi will run headless, is there anyway to write a script that calls the button's java script function, preferably with something like cURL? 假设pi将无头运行,是否仍然需要编写一个脚本来调用按钮的Java脚本函数,最好使用cURL之类的脚本?

Use fiddler to sniff at the traffic. 使用提琴手来嗅交通。 Figure out what is being submitted to the URL (form post, http/https, etc.) and create a cURL request (or Python or NodeJS ...) that submits the same information. 找出要提交给URL的内容(表单发布,http / https等),并创建一个提交相同信息的cURL请求 (或Python或NodeJS ...)。

If they are using CSRF tokens, you will have to request the web page first via cURL, grep the output, and submit using that same token. 如果他们使用CSRF令牌,则必须先通过cURL请求网页,grep输出,然后使用相同的令牌提交。 See one example here 在这里看到一个例子

Sorry can't help much further without additional details. 抱歉,没有其他详细信息将无济于事。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM