Gå til innhold

Automatisering med cURL


Anbefalte innlegg

Skrevet

Hei, har prøvet å lage en "bot" som automatiserer en brukeropprettelse via ett admininterface jeg har en konto på, den skal lage subaccounts ved å feks besøke

http://minurl.com/account_setup.php?ident=...assord=testpass

 

Koden:

 

<?php

// Logg inn på siden og lagre session id og cookies
$post = 'user=2791&pw=*sensurert*&lang=english';
$cookie_file_path = "output.txt";
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);

curl_setopt ($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b)");
curl_setopt($curl, CURLOPT_URL,"https://www.bouncer-interface.de/?");
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
echo("Resultat: <br>".$result);

// Post 2, Når vi er logget inn >lag en ny sub account i interfacet med get's
// Hente session id og cookies fra forrige post
$post1 = 'ident='.$_GET['ident']&username.'='.$_GET['nick'].'&pw='.$_GET['passord'].'&server=4343&vhost=ist.ein.bot.nu&awaymsg=away&awaynick='.$_GET['nick'].'&leavemsg=lol&irc-server=underworld.no.quakenet.org&irc-port=6667';
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);

curl_setopt ($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b)");
curl_setopt($curl, CURLOPT_URL,"https://www.bouncer-interface.de/?modul=psybnc&a=adduser");
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($curl);

echo("Resultat: <br>".$result);

// Hele poenget, automatisering.
/* ved å skrive http://myurl.net/setup_bnc.php?ident=40&nick=Xstasy&passord=testpass */

curl_close ($curl);
?>

 

Jeg får ingen error når jeg åpner siden, det kommer heller ingenting i output.txt

Men det skjer ingenting i interfacet når jeg sjekker etterpå, altså ingen konto ble opprettet.

 

Info:

PHP/4.4.2

CURL support: enabled

CURL Information: libcurl/7.15.3 OpenSSL/0.9.7e

 

Vært kjempefint om dere hadde noen løsninger på dette, har sett gjennom forumposter over alt i hele natt uten å finne noen løsninger på mitt problem.

  • 1 måned senere...
Videoannonse
Annonse
Skrevet (endret)

Du kan prøve og skrive error_reporting(E_ALL); på toppen og se om du får noen feilmeldinger. Og prøve å chmodde output.txt slik som VisualStudio sa.

Endret av Shadows0
Skrevet

Gjorde noen endringer i "Post nr 1", får i hvertfall feilmelding om "Login failed!" fordi jeg ikke har riktig passord.

<?php
$post = "user=2791&pw=sensurert&lang=english&submit=Login!";
$cookie_file_path = "/output.txt";
$curl = curl_init();

curl_setopt ($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b)");
curl_setopt($curl, CURLOPT_URL, "https://www.bouncer-interface.de/?");
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); 
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); 
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
curl_exec($curl);

curl_close ($curl);
?>

Dette er bare første del, husk å bruke det absolutte filnavnet til output.txt.

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
×
×
  • Opprett ny...