У меня есть ISP, который случайным образом регистрирует меня, и мое соединение теряется. Таким образом, я хочу записать сценарий, который автоматически регистрирует меня в без взаимодействия с пользователем, когда он выходится из системы (который я могу протестировать использование статуса выхода ping).But, проблема, я ничего не знаю о веб-программировании. Я испытал завихрение, но материал числа наклона. Попробованный elinks, но это не работает сценарием или cronjob без взаимодействия с пользователем
что я попробовал до сих пор
cat ~/bin/elink
elinks -auto-submit http://192.168.1.2:9088/WISHN/Login.jsp
путем выполнения этой команды это автоматический регистрирует меня в (путем редактирования ~/.elinks/elinks.conf)
но это просто остается там, непока пользователь не взаимодействует и выходит из приложения, но нажимающий "q"
вот почему этот сценарий не работает
#!/bin/bash
while [ 1 -eq 1 ]
do
. ~/bin/elink
slleep 3
pkill-9 elinks
sleep 5
done
следующая команда не работает недо elinks выходы
timeout 1m elinks -auto-submit http://192.168.1.2:9088/WISHN/Login.jsp
это не делает работ также, ничего не происходит
Я попробовал их завихрением, но как обычно не работаю
curl -d "Username=someuser&Password=shhhitsasecret" -s http://192.168.1.2:9088/WISHN/loginUI.do2
и это
curl -d "Username=someuser&Password=shhhitsasecret" -s http://192.168.1.2:9088/WISHN/Login.jsp
я нашел loginUI.do2 в разделе действия источника, но он перестал работать также
Я в значительной степени пуст от идей, любая справка будет очень цениться
и вот источник страницы, я удалил некоторые части, которые могли привести к нарушению конфиденциальности
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>somewebsite</title>
<link href="templatemo_style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="stylesheet/styles.css" />
<link rel="stylesheet" type="text/css" href="stylesheet/style_pop.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/custom.js"></script>
<!--
<script language="javascript" type="text/javascript">
function clearText(field)
{
if (field.defaultValue == field.value) field.value = '';
else if (field.value == '') field.value = field.defaultValue;
}
</script>-->
<script language="JavaScript">
function newCookie(Username,value,days) {
var days = 30; // the number at the left reflects the number of days for the cookie to last
// modify it according to your needs
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString(); }
else var expires = "";
document.cookie = Username+"="+value+expires+"; path=/"; }
function readCookie(Username) {
var nameSG = Username + "=";
var nuller = '';
if (document.cookie.indexOf(nameSG) == -1)
return nuller;
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameSG) == 0) return c.substring(nameSG.length,c.length); }
return null; }
function eraseCookie(Username) {
newCookie(Username,"",1); }
function toMem(a) {
newCookie('theName', document.login.Username.value); // add a new cookie as shown at left for every
newCookie('theEmail', document.login.Password.value); // field you wish to have the script remember
}
function delMem(a) {
eraseCookie('theName'); // make sure to add the eraseCookie function for every field
eraseCookie('theEmail');
document.login.Username.value = ''; // add a line for every field
document.login.Password.value = ''; }
function remCookie() {
document.login.Username.value = readCookie("theName");
document.login.Password.value = readCookie("theEmail");
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(function() {
remCookie();
});
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
if ((version >= 5.5) && (document.body.filters))
{
for(var i=0; i<document.images.length; i++)
{
var img = document.images[i]
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
{
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}
}
/* ------- Trim ------- */
function trim(str) {
return ltrim(rtrim(str));
}
function ltrim(str) {
return str.replace(new RegExp("^[\\s]+", "g"), "");
}
function rtrim(str) {
return str.replace(new RegExp("[\\s]+$", "g"), "");
}
/* ------- End of Trim ------- */
function validateForm(){
var input=true;
document.login.Username.value = trim(document.login.Username.value);
if(document.login.Username.value.length==0){
alert("User Name is required.");
document.login.Username.focus();
input=false;
return false;
}
if(document.login.Password.value.length==0){
alert("Password is required.");
document.login.Password.focus();
input=false;
return false;
}
var uname = "?"+document.login.Username.value+"+/@";
var pwd = "?"+document.login.Password.value+"+/@";
document.login.LoginName.value=encodeURIComponent(uname);
document.login.LoginPassword.value=encodeURIComponent(pwd);
if (input==true&&document.login.checker.checked)
toMem(this);
}
window.attachEvent("onload", correctPNG);
</script>
</head>
<!--Main Container Starts here-->
<form name="login" method="post" action="loginUI.do2" onSubmit="if (this.checker.checked) toMem(this)" id="login-form">
<body>
<div id="templatemo_wrapper">
<div id="templatemo_menu">
<marquee scrollamount="3" behavior="slide" direction="left" height="20" width="100%" style="color:#00162b"><p> Your Default Password is <strong style="color:#FFFFFF">wnpl123</strong> for first time login only. Please change your password after first login.</p></marquee>
</div> <!-- end of templatemo_menu -->
<div id="templatemo_header_bar">
<div id="header"><!--<div class="right"></div>-->
<h1><a href="#">
<img src="images/templatemo_logo.png" alt="Site Title" width="254" />
<span> </span>
</a></h1>
</div>
<div style=" font-size:22px; color:#000; margin-top:50px; float:right; font-family:Arial, Helvetica, sans-serif; left: 878px; top: 0px; width: 285px;">
Toll Free : 1800 419 4244 </div>
</div> <!-- end of templatemo_header_bar -->
<div class="cleaner"></div>
<div id="sidebar"><div class="sidebar_top"></div><div class="sidebar_bottom"></div>
<div class="sidebar_section">
<h2>Login Form</h2>
<div style="color:#FFFF00; font-size:12px; margin-top:45px; margin-bottom:10px;"><b>
</b></div>
<label>Username</label>
<input type="text" name="Username" size="20" class="input_field" />
<label>Password</label>
<input type="password" value="" name="Password" class="input_field" title="password" />
<input type="hidden" name="LoginName" />
<input type="hidden" name="LoginPassword" />
<label for="checkbox"><br><input type="checkbox" name="checker" id="checker" /> Remember Me</label>
<br />
<input type="submit" value="Login" id="submit_btn" onClick="return validateForm()" />
</div>
</div> <!-- end of sidebar -->
<div id="templatmeo_content">
<div id="latest_product_gallery">
<img src="images/bannerr.png" />
<a href="index1.html" target="_blank"> <div class="intro-texttt" align="right"></div>
</a>
</div> <!-- end of latest_content_gallery -->
</div>
Z<!-- end of templatmeo_content -->
</div> <!-- end of templatemo_wrapper -->
<!--<div class="popupbox3" id="popuprel3">
<div id="intabdiv3" align="left">
<table border="0" align="left">
<tr height="16px"><td></td></tr>
<tr height="16px"><td></td></tr>
<tr><td><h2> Steps to Install:-</h2> </td><tr>
<tr><td><Font color="#000000"><strong>1.</strong> <a href="http://172.18.1.60/gamestore/UrbanTerror.rar" style="color:#0000CC">Download</a> UrbanTerror -> Extract UrbanTerror.rar-></font></td></tr><tr><td><Font color="#000000" > Install UrbanTerror.exe</font></td></tr><tr height="14px"><td></td></tr>
<tr><td><Font color="#000000">
<strong> 2.</strong><b>Play :</b><i>Online </i>|<b>Source :</b><i>Favorites </i>| <b> Type : </b><i>On/All</i></font> </td></tr>
<tr><td><Font color="#000000" >
<b>Create Favourite Name : </b><i>WISH-UT </i></font></td></tr>
<tr><td><Font color="#000000" >
<b> IP Address :</b><i>172.18.1.60 |</i>
<b> Guides: </b><i>On/All</i></font></td></tr>
<tr><td><Font color="#000000">
<b>OK & CONNECT</b></font></td></tr>
</table>
</div>
</div>
-->
<div id="templatemo_footer_wrapper">
<div id="templatemo_footer">
Copyright © 2099 <a href="#">somewebsite</a> |
Designed by <a href="http://www.templatemo.com" target="_parent">Wish Net</a>
</div> <!-- end of footer -->
</div> <!-- end of footer_wrapper -->
<!--<div id="fade"></div>-->
<!--</form>
<script type="text/javascript"> Cufon.now(); </script>-->
</body>
</html>
Поскольку никто не отвечал, я выяснил довольно основной путь, но делаю задание.Because, я не могу выяснить завихрение, я выяснил путь с elinks путем создания сценария и определения источника его (не создание его исполняемый файл, потому что он выполняет команду elinks в позади оболочки сцены и этого обучающая работа.
#!/bin/bash
arg1="set document.browse.forms.show_formhist = 1"
arg2="set document.browse.forms.confirm_submit = 0"
count=0
terminal=`tty`
dpkg -s zenity > /dev/null 2>&1
if ! [ $? -eq 0 ]
then
echo "\033[1mzenity is not installed do you want to install y/n \033[0m\c: "
read choice
if [ "$choice" = "y" -o "$choice" = "Y" ]
then
sudo apt-get install zenity
else
echo "OK Sorry For Asking Jeez"
sleep 3
exit 100
fi
if ! [ $? -eq 0 ]
then
echo "something went wrong with apt-get so exiting byebye"
sleep 3
exit 200
fi
fi
dpkg -s elinks > /dev/null 2>&1
if ! [ $? -eq 0 ]
then
echo "elinks is not installed you will be prompted for installation in a sec"
sleep 3
zenity --question --title="Query" --text="Would you Like to Install Elinks ?"
if [ $? -eq 0 ]
then
sudo apt-get install elinks
else
zenity --error --title="Hmmmmm" --text="OK Sorry For Asking Jeez"
exit 100
fi
if ! [ $? -eq 0 ]
then
echo "something went wrong with apt-get so exiting byebye"
sleep 3
exit 200
fi
fi
zenity --question --title="Query" --text="Do you wanna login to isp page now using elinks to save password if you havent already ?"
if [ $? -eq 0 ]
then
zenity --info --title="Soooooo" --text="elink will open enter username and password save them so we can do autologin later elink will autoexit in 20 seconds so hurry up"
timeout 20s elinks http://192.168.1.2:9088/WISHN/Login.jsp
fi
newf () {
while true
do
echo -e "\033[42m Script For Wishnet AutoLogin By Shantanu Running......\033[0m"
sleep 10m
timeout 3s wget -O /dev/null http://cachefly.cachefly.net/100mb.test > /dev/null 2>&1
condition=$?
result=8
case $condition in
$result)
echo "were logged back in"
timeout 5s elinks -auto-submit http://192.168.1.2:9088/WISHN/Login.jsp
;;
*)
echo "nothing is wrong"
;;
esac
done
}
if ! [ -e ~/.elinks/elinks.conf ]
then
touch ~/.elinks/elinks.conf
fi
exec < ~/.elinks/elinks.conf
while read -r line
do
if [ "$arg1" = "$line" -o "$arg2" = "$line" ]
then
let count+=1
fi
done
exec < "$terminal"
if [ $count -eq 2 ]
then
newf
else
echo $arg1 > ~/.elinks/elinks.conf
echo $arg2 >> ~/.elinks/elinks.conf
newf
fi