Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Duplicating website form login via Python HTTPS PUT requests?

deleteddeleteddeleteddeleteddeleteddeleted
Use requests or curl to post the data. You’ll have to solve the captcha to get that variable as well as scrape the csrf field
(Mar 30, 2020 10:49 AM)SIM-4604643 Wrote:  Hey thanks for the reply.

Sorry is requests and curl a python library? How would I do this? Also what do you mean scrape the csrf field? Do you mind just explaining a bit more? Thanks.

Yes.

csrf is going to be a form field or JavaScript variable that you’ll need to get the value of to submit your request.
I think you should use two libraries: requests and bs4.

Use requests to make a request to the page, scrape with bs4 and send the captcha to your handler. I've been using anticaptcha for a while, and it suits my needs.
If you want help hit me up with your telegram name in a PM.
(Mar 30, 2020 11:13 AM)SIM-4604643 Wrote:  So what's the difference between curl and requests. Any recommendations? How do you know what the csrf is before you submit the form?


Never heard of bs4 thanks I'll look it up. How would you fill out the REQUESTS form? Thanks for your offer of help on the anticaptcha will definitely hit you up for some coaching on that.

Cheers

If you use requests you could post data to a url easily.

Let's say you have a form:

127.0.0.1/index.html
PHP Code

<?php 
<form action="/register" method="POST">
 
   <input type="text" name="_token" value="ce30ek21le03" hidden />
 
   <input type="text" name="username" />
</
form> 

With Python you can visit the index, grab the page source and scrape the token.

PHP Code

<?php 
from requests import post
, get
from bs4 import BeautifulSoup

req 
= get('http://127.0.0.1/index.html')
soup = BeautifulSoup(str(req.content), 'html.parser')
elem = soup.find('input', {'name': '_token'})
token = elem['value']

data = {
 
   'username': 'example',
 
   '_token': token
}
post_req = post('http://127.0.0.1/register', data=data) 


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 630 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[Python] by OGLORDAug 20, 2023 01:40 AM 3 208 Aug 20, 2023 01:40 AM
Last Post: Lucky4L
[Python] by evilgnomeJan 11, 2022 05:39 AM 2 194 Jan 11, 2022 05:39 AM
Last Post: Charger