D
D
Dmitry Tereshchuk2018-03-09 08:42:10
PHP
Dmitry Tereshchuk, 2018-03-09 08:42:10

Why not a valid token?

Good day!
I ran into a problem when writing a bot for a browser.
I'm writing to bespredel.mobi
-
Krch, I regularly cut out the token, but then it says that it is not valid because of this, it says that it was not possible to check the data.
----

preg_match('/<meta name="csrf-token" content="(.*)">/iSu',$html,$ar);
$post= [
'_csfr' => $ar[1],
'LoginOfficialForm' => ['login' => 'МОЙЛОГИН', 'password' => 'МОЙПАРОЛЬ']];
$html=dima("http://bespredel.mobi/",$post);
echo $html;

---
dima()- function for connecting and passing the request. Works 100%. All other games are great.
--
The form source itself:
<form id="w0" action="/" method="post">
<input type="hidden" name="_csrf" value="bGotMkFSRWc.JVddDwAVMT41R0MqAwgfGRhDWggVEzAaHmJ/eAoSJQ==">
    <div class="form-group field-loginofficialform-login required">
<label class="control-label" for="loginofficialform-login">Логин или ID персонажа</label>
<input type="text" id="loginofficialform-login" class="form-control" name="LoginOfficialForm[login]">

<div class="help-block"></div>
</div>    <div class="form-group field-loginofficialform-password required">
<label class="control-label" for="loginofficialform-password">Пароль</label>
<input type="password" id="loginofficialform-password" class="form-control" name="LoginOfficialForm[password]">

<div class="help-block"></div>
</div>
        <span class="m3 btn_start middle"><span class="btn_end"><button type="submit" class="btn">Войти в игру</button></span></span>
</form></div>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-03-09
@zkelo

The regular search looks for "meta name=csrf-token", and in the form source you can see that the csrf token is written to a hidden input. Maybe that's the thing

A
Alexander, 2018-03-09
@AK-VoronM

Ahem... The whole point of this token is to ensure that the forms are not tampered with. For each session, it is generated anew. Accordingly, you will not be able to cut the token and use it for extraneous scripts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question