expression engine log-in

Simplehat

  • Joined: May 23, 2010
  • Posts: 3

Sun 5/23/2010 - 19:53

I'm trying to create a bot that will log into an account on an expression engine forum, such as this forum: http://fatnews.com/index.php/member/profile/, and edit the account's bio. It needs to run in the background, so I'm trying to use the Download from web action.

Here's the information I'm putting in the action:

URL: Select  http://  and paste  fatnews.com/index.php/member/profile/ in the text box.

Method: Post

Post Parameters:

username     (account username)

password     (account password)

auto_login     0

anon     0

ACT     9

site_id     1

FROM     (blank)

RET     http://fatnews.com/index.php/member/profile/

I found all of those things by looking at the source text for the page.

Here's the return data I get when I run the bot.

<html>
<head>

<title>Error</title>



<style type="text/css">

body {
background-color: #ffffff;
margin: 50px;
font-family: Verdana, Arial, Tahoma, Trebuchet MS, Sans-serif;
font-size: 11px;
color: #000;
background-color: #fff;
}

a {
font-family: Verdana, Arial, Tahoma, Trebuchet MS, Sans-serif;
font-weight: bold;
letter-spacing: .09em;
text-decoration: none;
color: #330099;
background-color: transparent;
}

a:visited {
color: #330099;
background-color: transparent;
}

a:active {
color: #ccc;
background-color: transparent;
}

a:hover {
color: #000;
text-decoration: underline;
background-color: transparent;
}

#content {
border: #999999 1px solid;
padding: 22px 25px 14px 25px;
}

h1 {
font-family: Verdana, Arial, Tahoma, Trebuchet MS, Sans-serif;
font-weight: bold;
font-size: 14px;
color: #000;
margin-top: 0;
margin-bottom: 14px;
}

p {
font-family: Verdana, Arial, Tahoma, Trebuchet MS, Sans-serif;
font-size: 12px;
font-weight: normal;
margin-top: 12px;
margin-bottom: 14px;
color: #000;
}

ul {
margin-bottom: 16px;
}

li {
list-style: square;
font-family: Verdana, Arial, Tahoma, Trebuchet MS, Sans-serif;
font-size: 12px;
font-weight: normal;
margin-top: 8px;
margin-bottom: 8px;
color: #000;
}

</style>

</head>

<body>

<div id="content">

<h1>The following errors were encountered</h1>

<ul><li>You are not authorized to perform this action</li>
</ul>

<p><a href='JavaScript:history.go(-1)'>Return to Previous Page</a></p>

</div>

</body>

  </html>
 

Can anyone tell me how to use the download from web action to log into the site? I'm lost. Thanks in advance.

#1

D.M.Altizer

  • Joined: Jan 12, 2010
  • Posts: 204

Tue 5/25/2010 - 11:36

 Hello there,

There are a couple of things that you should notice when you are trying to use the "Download from Web" action:

- The URL in the "Download from Web" action, should be the same with the "action" property of the <form> tag. In your example, the form tag is:

<form id='member_login_form' method="post" action="http://fatnews.com/index.php"  > 

so your URL is fatnews.com/index.php

- The second thing that you should notice is that some of the hidden inputs may have standard values and some may not. So, in your example, the post parameters:

ACT, RET, FROM, site_id seem to have a standard value, but the XID parameter seems to be something that changes everytime that you try to login. This is why, you should probable use a "Download from Web" action with the "Get" method and the URL:

fatnews.com/index.php/member/profile

Then, in the variable that you will get from this download from web action, you should use a Parse Text action, retrieve the first occurrence only, and use the following regular expression to grab the XID parameter and save it in a variable (remember to check the "Use Regular Expressions" checkbox and use the %Match% variable):


(?<=<input\stype="hidden"\sname="XID"\svalue=").*?(?=")

After that, you can post to the URL:

fatnews.com/index.php

and use the static parameters for the rest of the inputs, and the %Match% that you got from the "Parse Text" action for the XID input.

If you can't make it work, let me know and I will create a sample job for you.

 

#2

Simplehat

  • Joined: May 23, 2010
  • Posts: 3

Fri 5/28/2010 - 2:01

Works like a charm! Thanks. 

#3

D.M.Altizer

  • Joined: Jan 12, 2010
  • Posts: 204

Fri 5/28/2010 - 9:15

Glad that I could help :)

#4
Not a member yet? Register

Copyright 2012 - Softomotive Ltd