You are not logged in.

#1 2010-10-14 04:03:31

ShadowKyogre
Member
From: Hell! XP No... I'm not telling
Registered: 2008-12-19
Posts: 476
Website

Bash, Curl, and logging into sites with complex passwords [solved]

I'm working on a little script to help check deviantArt messages, but I'm stuck at the moment. Below is the code so far:

#!/bin/sh
#checks your dA messages for you
#FIXME: store username and password in file?

curl -A "Mozilla/4.73 [en] (X11; U; Linux 2.2.15 i686)" \
--cookie /tmp/cjar --cookie-jar /tmp/cjar \
--data "username=$1" \
--data "password=$2" \
--data "action=Login" \
--location "https://www.deviantart.com/users/login" >/tmp/tmp.html

It works fine with simple passwords, but as soon as it involves special characters like !@#$%^&*(), the following page that's churned out says "Wrong Password" even though the given password is correct. Is curl parsing one of these special characters as a special character (like when merging the input given to the site) or is there something I need to do with any of these special characters before they're passed onto the site?

Last edited by ShadowKyogre (2010-10-15 00:36:04)


For every problem, there is a solution that is:
Clean
Simple and most of all...wrong!
Github page

Offline

#2 2010-10-14 05:57:57

juster
Forum Fellow
Registered: 2008-10-07
Posts: 195

Re: Bash, Curl, and logging into sites with complex passwords [solved]

You might try using the --data-urlencode option instead of the --data option. Special characters should be url-encoded (that funky %20 stuff you see in the URL bar) which --data does not appear to do automatically.

Offline

#3 2010-10-15 00:35:52

ShadowKyogre
Member
From: Hell! XP No... I'm not telling
Registered: 2008-12-19
Posts: 476
Website

Re: Bash, Curl, and logging into sites with complex passwords [solved]

Thanks, that worked smile


For every problem, there is a solution that is:
Clean
Simple and most of all...wrong!
Github page

Offline

Board footer

Powered by FluxBB