Bash 在shell中生成登录cookie(使用curl?)
在启动浏览器之前,我想在shell中生成一个登录cookie,这样我就已经登录到了某些网站。目前,我正在使用以下命令在自己的nextcloud服务器上尝试此操作Bash 在shell中生成登录cookie(使用curl?),bash,authentication,curl,cookies,browser,Bash,Authentication,Curl,Cookies,Browser,在启动浏览器之前,我想在shell中生成一个登录cookie,这样我就已经登录到了某些网站。目前,我正在使用以下命令在自己的nextcloud服务器上尝试此操作 curl --cookie test.txt --cookie-jar test.txt \ -d "user=***name***" \ -d "password=***password***" \ <my nextcloud server>/index.php/login cu
curl --cookie test.txt --cookie-jar test.txt \
-d "user=***name***" \
-d "password=***password***" \
<my nextcloud server>/index.php/login
curl--cookie test.txt--cookie jar test.txt\
-d“用户=***名称***”\
-d“密码=***密码***”\
/index.php/login
得到一个如下所示的cookie。但是,将其放在我的其他cookie中不允许我登录
# Netscape HTTP Cookie File
# https://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_<my nextcloud server> FALSE /nextcloud TRUE nc_sameSiteCookiestrict true
#HttpOnly_<my nextcloud server> FALSE /nextcloud TRUE nc_sameSiteCookielax true
#HttpOnly_<my nextcloud server> FALSE /nextcloud TRUE oc_sessionPassphrase .....
#HttpOnly_<my nextcloud server> FALSE /nextcloud TRUE ..... ...................
#Netscape HTTP Cookie文件
# https://curl.haxx.se/docs/http-cookies.html
#这个文件是由libcurl生成的!编辑风险自负。
#HttpOnly_uuFalse/nextcloud TRUE nc_SamesiteCookiestrictTrue
#HttpOnly_uuFalse/nextcloud TRUE nc_SamesiteCookielaxTrue
#HttpOnly_uuFalse/nextcloud TRUE oc_sessionPassphrase。。。。。
#HttpOnly_uu为假/下一个为真。。。。。。。。。。。。。。。。。。。
使用chromium录制正常登录的操作时,会从下面的cookie中生成不同的cookie,是否有人熟悉此登录方法?
谢谢
我的目标是一个类似于冲浪浏览器的自动登录脚本如果您在查看浏览器开发工具的“网络”选项卡时尝试使用浏览器连接到nextcloud,您将看到确切的请求 您需要使用Curl再次执行完全相同的请求 在您的情况下,您缺少以下设置:
-X POST-H“内容类型:应用程序/X-ww-form-urlencoded”
要求邮寄一份表格
但是您还缺少表单的其他隐藏字段,包括requesttoken字段
此字段是登录页面时随机生成的令牌,该页面存储在php会话中,并在登录时与表单的值进行比较。
这是一个使暴力攻击更加困难的安全系统
要绕过此安全系统,首先需要在登录页面上发出请求,提取生成的cookie并解析页面内容以检索requesttoken字段。
然后,您可以发出第二个请求,发送带有登录名和密码的表单,最终获得经过身份验证的cookie
祝你好运