браузер lynx, введите hid / pwd в качестве команды?

1296
cHam

Я нахожусь в сети с брандмауэром, который требует имя пользователя / пароль. Я хочу написать скрипт для некоторых автоматических установок yum (в частности, инструментов для монтирования nfs), но сначала мне нужно зайти на веб-страницу в lynx и войти в систему, чтобы обойти брандмауэр. Есть ли способ передать аргумент user / pwd в lynx из терминала, чтобы он автоматически входил в систему?

0

1 ответ на вопрос

1
Jeff VanNieulande

I don't know of a way via lynx, but there's a few things you could attempt with curl or elinks, depending on the configuration of the login page.

If it's just basic proxy authentication, you can try passing the username and password via curl:

 curl -u username:password http://example.com 

You can also use curl to do more complicated logins, storing session cookies and such. Check out "Using cURL to automate HTTP jobs"

Finally, you may be able to do this in a dirty way using ELinks. ELinks has a function to save a username and password, and also a command line switch to automatically submit a form. By combining the two, this may be what you need:

Enable password saving in elinks.conf by adding this line:

set document.browse.forms.auto_submit = 1 

Then run the command to automatically submit the first form on a webpage:

elinks http://example.com/login -auto-submit 1 

The problem then is quitting elinks, you may have to kill it in your script.

Good luck.