PDA

View Full Version : [Python] POST Error



Ghosts
11-07-2014, 09:42 PM
Been running into an issue with a script I'm working on, can't seem to figure it out. It should be accepting items, but it doesn't look like the POST request is actually doing anything.



itemnames = []
postdata = {}

html = acc.get("[Only registered and activated users can see links]")

startpos = 0
while html.find("'><br><b>", startpos) != -1:
pos1 = html.find("'><br><b>", startpos) + 9
pos2 = html.find("<", pos1) - 1
pos3 = html.find("input type='radio' name='", pos2) + 25
pos4 = html.find("'", pos3)
startpos = pos4

itemid = urllib.quote_plus(html[pos3:pos4])
postdata[itemid] = "accept"
itemnames.append(html[pos1:pos2])

html = acc.post("[Only registered and activated users can see links]", postdata)


Printout of what the postdata looks like upon submitting:

{'itemgiven%5B14154130660334%2C191782743%2Crzerox% 2Cdylamn%5D': 'accept'}

j03
11-08-2014, 11:12 AM
Do you have the right referer being sent?

Ghosts
11-08-2014, 11:27 AM
Do you have the right referer being sent?

I should, I have tried both of these, though I'd assume either would work.
[Only registered and activated users can see links]
[Only registered and activated users can see links]

I'm posting to '[Only registered and activated users can see links]' as well, since that's what the form action is set as.



<form name='transfer_form' action='/items/transfer_list.phtml' method='post'>

Zachafer
11-08-2014, 12:00 PM
Is there an error? Try sending the Referrer field

Ghosts
11-08-2014, 12:21 PM
Is there an error? Try sending the Referrer field

No error, just doesn't do anything. I've tried that too.

Zachafer
11-09-2014, 03:00 PM
Try posting to [Only registered and activated users can see links] so you can see what the HTTP request looks like.

Ghosts
11-09-2014, 07:53 PM
Done Zachafer

{
"args": {},
"data": "",
"files": {},
"form": {
"itemgiven%5B14154130660334%2C191782743%2Crzerox%2C dylamn%5D": "accept",
"itemgiven%5B14154633856655%2C191790778%2Crzerox%2C abril_1999__83%5D": "accept"
},
"headers": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-us,en;q=0.5",
"Connect-Time": "1",
"Connection": "close",
"Content-Length": "161",
"Content-Type": "application/x-[Only registered and activated users can see links]",
"Host": "[Only registered and activated users can see links]",
"Referer": "[Only registered and activated users can see links]",
"Total-Route-Time": "0",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1",
"Via": "1.1 vegur",
"X-Request-Id": "a5d04a92-0864-4b3a-945d-0be203b56386"
},
"json": null,
"origin": "184.75.218.9",
"url": "[Only registered and activated users can see links]"
}


Edit: not sure why it's showing a space in the formdata, that doesn't show up in the shell.

DarkByte
11-10-2014, 04:57 AM
if u pm me contents of the html string after the get ill find the bug :p.

Zachafer
11-12-2014, 07:51 PM
Done Zachafer

Edit: not sure why it's showing a space in the formdata, that doesn't show up in the shell.

The space is vBulletin. It's not your code (if you edit your post, your code will not have a space)

DarkByte
11-13-2014, 11:44 AM
Not sure why its failing tbh an u send me a account with gifts on? Everything looks like its working but for some reason its just not processing , probably something small. If you dont wanna do that , try charles proxy and set your browsers proxy to localhost:8888 then do the same in ur script and compare the request.