Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 16:56

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



POST Packets mit anderem Content-Type

Discussion on POST Packets mit anderem Content-Type within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1

 
Mr.Tr33's Avatar
 
elite*gold: 2778
Join Date: Feb 2012
Posts: 3,527
Received Thanks: 1,044
POST Packets mit anderem Content-Type

Moin,
ich möchte gerne Information aus einer Seite mit PHP oder AutoIt, jedenfalls per HTTP Packets, auslesen und Formulare abschicken.

So mein Problem ist aber jetzt, dass ich noch nie mit einem multipart/form-data Content-Type gearbeitet habe.
So sieht das Packet aus:

Code:
-----------------------------299053068410299\r\n
Content-Disposition: form-data; name="authenticity_token"\r\n
\r\n
jC103HtaajY1zUeHUQJcwvccWZyHvqHuQOFV6OBP0ds=\r\n
-----------------------------299053068410299\r\n
Content-Disposition: form-data; name="user[login]"\r\n
\r\n
test\r\n
-----------------------------299053068410299\r\n
Content-Disposition: form-data; name="user[name]"\r\n
\r\n
test\r\n
-----------------------------299053068410299\r\n
Content-Disposition: form-data; name="user[password]"\r\n
\r\n
test\r\n
-----------------------------299053068410299\r\n
Content-Disposition: form-data; name="user[password_confirmation]"\r\n
\r\n
test\r\n
-----------------------------299053068410299\r\n
Content-Disposition: form-data; name="user[email]"\r\n
\r\n
\r\n
-----------------------------299053068410299\r\n
Content-Disposition: form-data; name="user[born_at_day]"\r\n
\r\n
6\r\n
-----------------------------299053068410299\r\n
Content-Disposition: form-data; name="user[born_at_month]"\r\n
\r\n
7\r\n
-----------------------------299053068410299\r\n
Content-Disposition: form-data; name="user[born_at_year]"\r\n
\r\n
1987\r\n
-----------------------------299053068410299\r\n
Content-Disposition: form-data; name="user[gmt_offset]"\r\n
\r\n
-120\r\n
-----------------------------299053068410299\r\n
Content-Disposition: form-data; name="user[language_id]"\r\n
\r\n
14\r\n
-----------------------------299053068410299\r\n
Content-Disposition: form-data; name="captcha"\r\n
\r\n
iqrcoj\r\n
-----------------------------299053068410299\r\n
Content-Disposition: form-data; name="captcha_key"\r\n
\r\n
273551cb9ee379304ccc98a44028b6d9856b1593\r\n
-----------------------------299053068410299\r\n
Content-Disposition: form-data; name="commit"\r\n
\r\n
Registrieren\r\n
-----------------------------299053068410299--\r\n
Also mein eigenetliches Problem ist, woher diese Zahl 299053068410299 kommt. Im Header steht sie nicht und sie entsteht plötzlich beim verschicken.

Ich habe mir überlegt, was wenn man einfach beim Packet selbst sagt, dass es ein application/x-www-form-urlencoded Content-Type ist?
Dann Würde mein Packet ja so aussehen:

Code:
user[name]=test&user[password]=test&user[password_confirmation]=test&user[email]=&user[born_at_day]=21&user[born_at_month]=7&user[born_at_year]=1991&user[language_id]=14&captcha=tfzguh&commit=Registrieren
Kann mir da einer helfen?

Mit freundlichen Grüßen,
Mr.Tr33
Mr.Tr33 is offline  
Old 10/09/2013, 20:53   #2

 
snow's Avatar
 
elite*gold: 724
Join Date: Mar 2011
Posts: 10,479
Received Thanks: 3,318
Das hatte ich auch mal vor längerer Zeit bei einem Bot, am Ende habe ich es so gelöst:

Code:
	protected String generateBoundary() {
        StringBuilder buffer = new StringBuilder();
        Random rand = new Random();
        
        for (int i = 0; i < 29; ++i) {
        	buffer.append(MULTIPART_CHARS[rand.nextInt(MULTIPART_CHARS.length)]);
        }
        
        return buffer.toString();
   }
Code:
	private final static char[] MULTIPART_CHARS = "1234567890".toCharArray();
Code:
String boundaryRand = generateBoundary();
		String boundary = "-----------------------------" + boundaryRand;
Code:
connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=---------------------------" + boundaryRand);
Code:
out.writeBytes("Content-Disposition: form-data; name=\"name\"" + \r\n);
	 out.writeBytes(name + endl);
Das ganze ist wohl einfach zufällig generiert, solange alles übereingestimmt hat, hat bei mir alles geklappt.
Code ist in Java, kann man gerne direkt übernehmen oder umschreiben.
snow is offline  
Thanks
1 User
Old 10/09/2013, 21:26   #3

 
Mr.Tr33's Avatar
 
elite*gold: 2778
Join Date: Feb 2012
Posts: 3,527
Received Thanks: 1,044
Hmm danke.
Also du hast einfach irgend ein Zahlenstring in der selben länge generiert?
Habe ich es richtig verstanden?
Mr.Tr33 is offline  
Old 10/09/2013, 21:35   #4
 
tolio's Avatar
 
elite*gold: 2932
The Black Market: 169/1/0
Join Date: Oct 2009
Posts: 6,966
Received Thanks: 1,097
der string ist random, üblich ist es afaik den aktuellen timestamp zu nehmen
tolio is offline  
Thanks
1 User
Old 10/09/2013, 23:32   #5

 
snow's Avatar
 
elite*gold: 724
Join Date: Mar 2011
Posts: 10,479
Received Thanks: 3,318
Quote:
Originally Posted by Mr.Tr33 View Post
Hmm danke.
Also du hast einfach irgend ein Zahlenstring in der selben länge generiert?
Habe ich es richtig verstanden?
Korrekt, einfach die Länge, die auch von der Website verwendet wurde.
snow is offline  
Old 10/10/2013, 03:57   #6
 
meak1's Avatar
 
elite*gold: 220
Join Date: Jun 2007
Posts: 3,768
Received Thanks: 1,126
Code:
Func getBoundary()
	Return StringLeft(_TimeGetStamp() * Random(10, 256, 1), 16)
EndFunc   ;==>getBoundary

Func _TimeGetStamp()
	Local $av_Time
	$av_Time = DllCall('CrtDll.dll', 'long:cdecl', 'time', 'ptr', 0)
	If @error Then
		SetError(99)
		Return False
	EndIf
	Return $av_Time[0]
EndFunc   ;==>_TimeGetStamp

$boundary = getBoundary()
meak1 is offline  
Reply


Similar Threads Similar Threads
[Release] +5500 Packets structure , client/packets constants
10/07/2012 - CO2 PServer Guides & Releases - 10 Replies
edit : if u know nothing about packets go to this post first explaining what is packets , and explaining a packet with details and everything http://www.elitepvpers.com/forum/co2-pserver-disc ussions-questions/2162344-packets-packets-packets. html#post19074533 i start making my very own packet structure to use them on my new proxy but i thought of ripping them from the source so yeah the following packets is ripped of trinity base source right now im just providing the packets structure...
Need item type and token type boot
03/18/2008 - Conquer Online 2 - 1 Replies
Hi All programers and makers of boots, Great job. Could some one make item and token type boot for patch 5118. Please



All times are GMT +1. The time now is 16:56.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.