Thema: vB API + externer Login
-
27.07.2012, 17:17 #1
vB API + externer Login
Aus Langeweile entstanden,
wenn jemand mit Zugriff auf die Datenbank das Script anpasst könnte man es für die Entwickler verwenden, ist jetzt auf meine vBulletin Datenbank angepasst, ist aber wahrscheinlich das Gleiche.
Verwendung:
Externer Login auf UH:
/api/index.php?a=login&username=Nico&password=PASSWORT
UH-API:
/api/index.php?a=user_info&username=Nico
Wenn ihr die Adresse über den Browser aufruft seht ihr nur den Usernamen und ein paar Zahlen, die Informationen verstecken sich im Quelltext, den ihr z.B. über eine .NET-Anwendung auslesen könnt. (Kann man auch mit XML lösen!) Dieser sieht z.B. so aus:
PHP-Code:
<Username>Nico</Username>
<UserID>1</UserID>
<UserGroupID>6</UserGroupID>
<Posts>0</Posts>
<Reputation>10</Reputation>
<Warnings>0</Warnings>
functions.php
PHP-Code:<?php
function vBulletinLogin($user, $pass)
{
$md5Pass = md5($pass);
$data = "do=login&url=%2Findex.php&securitytoken=guest&vb_login_md5password=$md5Pass&vb_login_md5password_utf=$md5Pass&vb_login_username=$user&cookieuser=1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://u-hacks.net/login.php?do=login"); // replace ** with tt
curl_setopt($ch, CURLOPT_REFERER, 'http://u-hacks.net/index.php');
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_TIMEOUT, '40');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/codecall_$user.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/codecall_$user.txt");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
curl_close($ch);
$pos = strpos($store, "Danke");
if ($pos === FALSE) {
return 0;
} else {
return 1;
}
}
?>
PHP-Code:<?php
//author: NicoSMTZ
//schmitz_dev@live.de
//27.07.2012
error_reporting(0);
include "functions.php";
$action = $_GET["a"];
$loggedin = FALSE;
switch($action)
{
case "login":
if($loggedin==FALSE)
{
$username = $_GET["username"];
$password = md5($_GET["password"]);
if (vBulletinLogin($username,$password))
{
echo "Eingeloggt!";
$loggedin = TRUE;
}
else
{
echo "Fehler beim Loginvorgang!";
$loggedin = FALSE;
}
}
break;
case "user_info":
$username = $_GET["username"];
//Check informationen für $username
$connection = mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("forum");
$res = mysql_query("SELECT userid,usergroupid,posts,reputation,warnings FROM user WHERE username = '$username'") or die(mysql_error());
while($row = mysql_fetch_object($res))
{
$userid = $row->userid;
$usergroupid = $row->usergroupid;
$posts = $row->posts;
$reputation = $row->reputation;
$warnings = $row->warnings;
echo "<Username>$username</Username>";
echo "\n";
echo "<UserID>$userid</UserID>";
echo "\n";
echo "<UserGroupID>$usergroupid</UserGroupID>";
echo "\n";
echo "<Posts>$posts</Posts>";
echo "\n";
echo "<Reputation>$reputation</Reputation>";
echo "\n";
echo "<Warnings>$warnings</Warnings>";
//Sieht im Quelltext so aus:
//<Username>Nico</Username>
//<UserID>1</UserID>
//<UserGroupID>6</UserGroupID>
//<Posts>0</Posts>
//<Reputation>10</Reputation>
//<Warnings>0</Warnings>
}
break;
}
?>
-
27.07.2012, 18:41 #2
AW: vB API + externer Login
SQLi!
-
27.07.2012, 19:15 #3
-
The Following 2 Users Say Thank You to Localhost For This Useful Post:
-
27.07.2012, 21:02 #4
AW: vB API + externer Login
Nö eigentlich sollte man Strings schon escapen. Wieso sollte man es dem User so schwer machen und die Lücken drinne lassen?
Sinn?
-
27.07.2012, 21:08 #5
AW: vB API + externer Login
Das ist nur ein Snippet, dessen Sinn die Funktionalität ist - man muss da nicht explizit auf irgendwelche Lücken achten.
Und wie schon gesagt: "Wer damit umzugehen weiß, sieht/prüft auch direkt die Lücken und fixed diese." Man soll hier nicht nur Copy&Paste betreiben.
-
The Following User Says Thank You to Localhost For This Useful Post:
Snees (28.07.2012)
Ähnliche Themen
-
Musik Problem mit Externer Festplatte.
Von 19JimBeam im Forum HardwareAntworten: 3Letzter Beitrag: 08.03.2014, 18:25 -
Win8 Windows von externer Festplatte installieren ohne Verlust von Daten
Von ThunderStorm im Forum WindowsAntworten: 1Letzter Beitrag: 30.07.2013, 01:55 -
Problem mit Externer Festplatte
Von dGL im Forum HardwareAntworten: 1Letzter Beitrag: 21.08.2012, 12:01 -
[C#] Login-Problem
Von Pwned im Forum SourcecodeAntworten: 3Letzter Beitrag: 27.06.2012, 14:49 -
[Bug] Login
Von MixerY im Forum SupportAntworten: 4Letzter Beitrag: 16.12.2011, 13:10
Diese Seite nutzt Cookies, um das Nutzererlebnis zu verbessern. Klicken Sie hier, um das Cookie-Tracking zu deaktivieren.