i an Trying to login on PV-Meter, which is using php+cookies for the login. If i copy the post with Firefox i'll get this
curl 'http://192.168.96.68/shared/getDeviceData.php' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0' -H 'Accept: */*' -H 'Accept-Language: de,en-US;q=0.7,en;q=0.3' --compressed -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'X-Requested-With: XMLHttpRequest' -H 'Origin: http://192.168.96.68' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Referer: http://192.168.96.68/home.php' -H 'Cookie: lang=de; PHPSESSID=tqoehqr3n9iclggolii9rc0mn2; lang=de' --data-raw 'showActiveDeviceStatus=true'
It works, unitl the cookie exprires So i thought, i have to login, save the cookie and call the page again, but iam not successfull
if i try:
curl --cookie-jar cookies.txt --data passphrase=pass.word --data username=admin http://192.168.96.68/home.php
and after curl -b cookies.txt http://192.168.96.68/home.php
-> no success
Any ideas what i forgot?
code of html Page
<!DOCTYPE HTML> <html lang="en"><head><title>MaxWeb XPN</title><meta charset="UTF-8" />
<meta name="theme-color" content="#fcbf00">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="manifest" href="manifest.json">
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="css/font-awesome.css" />
<link rel="stylesheet" href="css/unicorn-login.css" />
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="css/xpn.css" />
<!--[if lt IE 9]>
<script type="text/javascript" src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="container">
<div id="logo" >
<img class='img-responsive' src='img/logo_xpn.png'/> </div>
<div id="loginbox">
<form id="loginform" action="home.php">
<br>
<div class="input-group input-sm">
<span class="input-group-addon"><i class="fa fa-user"></i></span><input class="form-control" type="text" id="username" placeholder="Benutzername" />
</div>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-lock"></i></span><input class="form-control" type="password" id="password" placeholder="Passwort" />
</div>
<div class="form-actions clearfix">
<input type="submit" class="btn btn-block btn-primary btn-default" value="Login"/>
<br>
<div class="pull-right">
<a href="#recoverform" class="flip-link to-recover grey"><div class='fa fa-question'></div> Support</a>
</div>
</div>
</form>
<form id="recoverform" action="#">
<p><b>Anlagenname:</b> SolarPlant
<br> <b>Seriennummer:</b> 00000000
<br><b>Firmware-Version:</b> 0.0.0
<br><b>Hardware-Version:</b> 0.0.0
<br><b>Ident:</b> XXXXXXXXXXXXXXX<br>
<br><b>Hotline:</b><br>
DE +49 3733 507840 <br>
CH +41 315 281 165 <br>
GB +44 20 38080346 <br>
ES +34 93 2203859 <br>
FR +33 820420684 <br>
IT +39 0418520076 <br></p>
<div class="form-actions clearfix">
<div>
<a href="mailto:hotline@solarmax.com?
subject=sxxxxxxxx%20Support%xxxxxxxx%20xxxxxxxxxx&
body=%0A%0A--------------------------------%0AMaxWeb%20XPN%20Service-Info:%0A%20Serial:%xxxxxxxxx%0APlantname:%20xxxxxxx%0AFirmwareversion:%20x.x.x%0AHardwareversion:%20x.x.x%0AIdent:%20somaxxxxxxx%0A--------------------------------%0A"
class="btn btn-block btn-inverse"><div class="fa fa-envelope"></div> E-Mail Support</a>
</div>
<br>
<div>
<a href="#loginform" class="btn btn-block btn-primary flip-link to-login"><div class="fa fa-arrow-left"></div> Login</a>
</div>
</div>
</form>
</div>
<div>
<img class='img-responsive' src='img/solarmax_logo.png'/>
</div>
</div>
<script type="text/javascript" src="js/respond.min.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/jquery-ui.custom.min.js"></script>
<script src="js/unicorn.login.js"></script>
</body>
<div style="display:none;" id="dialog-confirm" title="Service-Modus">
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:12px 12px 20px 0;"></span>Im Service-Modus sind umfassende Änderungen am System möglich. <br>Dadurch kann die Funktionsfähigkeit des Systems beeinträchtigt werden. <br>Für eventuelle Probleme sind Sie selbst verantwortlich!
</div>
source https://stackoverflow.com/questions/67852928/login-on-php-site-with-curl
No comments:
Post a Comment