Sinisterly
Question about sending a javascript:submitform() to a website - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Python (https://sinister.ly/Forum-Python)
+--- Thread: Question about sending a javascript:submitform() to a website (/Thread-Question-about-sending-a-javascript-submitform-to-a-website)



Question about sending a javascript:submitform() to a website - Lysergide - 06-22-2015

Hello guys,
let's say I want to make a script that auto-sends a request to this site: http://makemehost.com/

So I can host maps without inserting each and every parameter every time.

I looked around for a bit, but I can't seem to figure out how to do it.

Could any of you help with that?
Not asking to be spoon-fed, just to be directed.

Thanks in advance


RE: Question about sending a javascript:submitform() to a website - Inori - 06-22-2015

I got nothing, but I think StackOverflow is your friend on this one


RE: Question about sending a javascript:submitform() to a website - Rye123 - 06-22-2015

I looked around for a short while, and found this, might be useful. It's about sending a GET or POST request to a URL.

Or this, which is on submitting a form.

Both are in stackoverflow, in Python. Sorry if you've already seen these Tongue


RE: Question about sending a javascript:submitform() to a website - Lysergide - 06-22-2015

Thank you for the answer.
I first looked around for POST and GET, but the thing is: this is some javascript code (javascriptConfusedubmitform()) that I activate on the site by the mean of the big button, then (i suppose) the parameters that I have inserted into the form are somewhat processed by the site...
Is this a "normal" POST request? This javascript code makes me uncomfortable...

I think my biggest problem is that I don't know how does the whole process works.


RE: Question about sending a javascript:submitform() to a website - lux - 06-22-2015

Simplified, lightweight HTTP request client libraries.

This is worth a look.


RE: Question about sending a javascript:submitform() to a website - Lysergide - 06-22-2015

Thank you Lux. I'll check it out.


RE: Question about sending a javascript:submitform() to a website - Lysergide - 06-23-2015

Sorry for the double posting, and a question: there is a way to edit the older post and let others know there is something new in the thread?

Anyway: Thank you Lux! After a while I managed to make it work.
I used Wireshark to see exactly the content of the packet being sent when i clicked on the button in the site, then I coded the header and the payload like that and it worked!

Thanks again!


RE: Question about sending a javascript:submitform() to a website - lux - 06-23-2015

(06-23-2015, 11:41 AM)Lysergide Wrote: Sorry for the double posting, and a question: there is a way to edit the older post and let others know there is something new in the thread?

Anyway: Thank you Lux! After a while I managed to make it work.
I used Wireshark to see exactly the content of the packet being sent when i clicked on the button in the site, then I coded the header and the payload like that and it worked!

Thanks again!

Good that you got it to work!

I assume you're making some kind of bot to create free game servers without having to visit the site? if so, that's awesome!


RE: Question about sending a javascript:submitform() to a website - Lysergide - 06-23-2015

(06-23-2015, 03:21 PM)Lux Wrote: Good that you got it to work!

I assume you're making some kind of bot to create free game servers without having to visit the site? if so, that's awesome!

Not precisely a bot, because the designated "owner" has to join the game within 5 minutes, so I need to be active anyway.
The usefulness of this script is that it let me host a game just executing the file from my desktop, without visiting the site or inserting parameters.

I found a weird thing tho: under a certain number of characters, the post request didnt work, gave a strange timeout error and I still don't understand why.
Edit: watching the header it occurred to me: maybe the "certain number of characters" is the number that I put in the "Content-Length" field. I have to run some tests...

The code, for those who are interested:
Spoiler:
Code:
import unirest response = unirest.post( "http://makemehost.com/gamestart.php", headers={ "Host": "makemehost.com", "Connection":"keep-alive", "Content-Length":"81", "Cache-Control":"max-age=0", "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Origin":"http://makemehost.com", "User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36", "Content-Type":"application/x-www-form-urlencoded", "Referer":"http://makemehost.com", "Accept-Encoding":"gzip,deflate", "Accept-Language":"it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4,es;q=0.2"}, params={ "map": "Parasite%202%20[v1.14B].w3x", "pp": "Public", "gn":"PARASITE+2", "owner":"Owner_name", "location":"ALL"} ) print response.code # The HTTP status code #print response.headers # The HTTP headers #print response.body # The parsed response #print response.raw_body # The unparsed response