Example #1
1
<?php

include_once "../src/snapchat.php";
echo "\n\nUsername: "******"\nPassword: "******"\nGmail account: ";
$gEmail = trim(fgets(STDIN));
echo "\nGmail password: "******"\nCasper key: ";
$casperKey = trim(fgets(STDIN));
echo "\nCasper secret: ";
$casperSecret = trim(fgets(STDIN));
echo "\nPhone number: ";
$phone = trim(fgets(STDIN));
$snapchat = new Snapchat($username, $gEmail, $gPasswd, $casperKey, $casperSecret, true);
$snapchat->login($password);
$snapchat->sendPhoneVerification($phone);
echo "\nCode: ";
$code = trim(fgets(STDIN));
$snapchat->verifyPhoneNumber($code);
Example #2
0
function postImageStory($file, $mod_id, $username, $password)
{
    $snapchat = new Snapchat($username, $password);
    //create new instance of class Snapchat
    $id = $snapchat->upload(Snapchat::MEDIA_IMAGE, file_get_contents('media/temp/' . $file));
    //upload the temp to story
    $snapchat->setStory($id, Snapchat::MEDIA_IMAGE);
    //set story
    $id = $snapchat->upload(Snapchat::MEDIA_IMAGE, file_get_contents('media/accept.jpg'));
    //send verification snap
    $exploded = explode("__", $file);
    $exploded = explode(".", $exploded[1]);
    $snapchat->send($id, array($exploded[0]), 10);
    //10 seconds long
    rename("media/temp/" . $file, "media/archive/" . $file);
    //move temp to archive
    $imagelog = file_get_contents("log/imagelog");
    $imagelog .= "MOD: " . $mod_id . " - FILE: " . $file . " - TIME: " . time();
    $imagelog .= PHP_EOL;
    file_put_contents("log/imagelog", $imagelog);
    $count = intval(file_get_contents("log/count"));
    $count++;
    file_put_contents("log/count", $count);
}
Example #3
0
<?php

// header("Content-Type:text/plain");
// ini_set('display_errors',1);
// ini_set('display_startup_errors',1);
// error_reporting(-1);
header("Content-Type:text/json");
require "src/snapchat.php";
if ($_POST['token'] === "1234567demo") {
    $username = $_POST['username'];
    // Your snapchat username
    $password = $_POST['password'];
    // Your snapchat password
    $gEmail = $_POST['gMail'];
    // Gmail account
    $gPasswd = $_POST['gPasswd'];
    // Gmail account password
    $debug = false;
    // Set this to true if you want to see all outgoing requests and responses from server
    $casperKey = "4232cf886ff2d2c1747d40adfab409f0";
    // Casper API Key
    $casperSecret = "b47a666ce0fefb90de058a8a38f01ff2";
    // Casper API Secret
    $snapchat = new Snapchat($username, $gEmail, $gPasswd, $casperKey, $casperSecret, $debug);
    $snapchat->login($password);
    $friends = $snapchat->getFriends();
    echo json_encode(array("SUCCES" => $friends));
} else {
    echo "NOT FOUND";
}
Example #4
0
}
//***************************************************************************************************
//VARIABLES
//***************************************************************************************************
// *** CONNECT TO DATABASE *** //
if ($config['firstsetup'] != true) {
    $db = new mysqli($config['dbhost'], $config['dbuser'], $config['dbpass'], $config['dbname']);
    //do not edit
    if ($db->connect_errno > 0) {
        die("Database connection error: " . $db->connect_error);
    }
}
// *** ------------------- *** //
// *** INITIALIZE SNAPCHAT *** //
if (!$config['firstsetup']) {
    $snapchat = new Snapchat($config['username'], $config['gusername'], $config['gpassword'], $debug);
    $snapchat->login($config['password']);
}
// *** ------------------- *** //
//***************************************************************************************************
//FUNCTIONS
//***************************************************************************************************
// *** CHECK FOR BANNED SNAPCHAT USER *** //
function is_banned($username)
{
    $sql = "SELECT * FROM `bans` WHERE `bans`.`username` = '" . $username . "'";
    if (!($result = $GLOBALS['db']->query($sql))) {
        die("Database error! (is_banned)");
    }
    while ($row = $result->fetch_assoc()) {
        if ($row['username'] != "") {
Example #5
0
$gEmail = "*****@*****.**";
// Gmail account
$gPasswd = "BoilerMake1";
// Gmail account password
$casperKey = "e353a611077d86617e6e5ffbb3a3774f";
// Casper API Key
$casperSecret = "de518df5975757cf18143185dbd25cc6";
// Casper API Secret
$debug = true;
// Set this to true if you want to see all outgoing requests and responses from server
////////////////////////////////
// Thisisdumb1
$imagePath = "";
// URL or local path to a media file (image or video)
$sendTo = array();
$snapchat = new Snapchat($username, $gEmail, $gPasswd, $casperKey, $casperSecret, $debug);
//Login to Snapchat with your username and password
$snapchat->login($password);
// Get your friends in an array
$friends = $snapchat->getFriends();
echo "My friends: ";
print_r($friends);
// Send snap adding text to your image and 10 seconds
// $snapchat->send($imagePath, $sendTo, "this is a test :D", 10);
// Set a story
// $snapchat->setStory($imagePath);
// Set a story adding text to the image and 5 seconds
// $snapchat->setStory($imagePath, 5, "This is my story");
// Get snaps data (Without storing them)
//$snapchat->getSnaps();
// Automatically downloads Snaps and store it in 'Snaps' folder
 public function testManageUserSettings()
 {
     $snapchat = new Snapchat($this->users[1]['name'], $this->users[1]['pass']);
     $this->assertNotEquals($snapchat->auth_token, FALSE, 'Login failed for test user 1.');
     $this->assertEquals($snapchat->block($this->users[5]['name']), TRUE, 'User 1 blocked user 5.');
     $this->assertEquals($snapchat->unblock($this->users[5]['name']), TRUE, 'User 1 unblocked user 5.');
     $this->assertEquals($snapchat->updatePrivacy(Snapchat::PRIVACY_EVERYONE), TRUE, 'User 1 accepts snaps from everyone.');
     $this->assertEquals($snapchat->updatePrivacy(Snapchat::PRIVACY_FRIENDS), TRUE, 'User 1 accepts snaps only from friends.');
     $this->assertEquals($snapchat->updateEmail($this->users[1]['name'] . '@php-snapchat.tld'), FALSE, 'User 1 attempted to change his email to an invalid address.');
     $this->assertEquals($snapchat->updateEmail($this->users[1]['name'] . '@php-snapchat.org'), TRUE, 'User 1 changed his email.');
     $this->assertEquals($snapchat->setDisplayName($this->users[2]['name'], $this->users[2]['name']), TRUE, 'User 1 set user 2\'s display name.');
 }
Example #7
0
// Your snapchat password
$gEmail = "";
// Gmail account
$gPasswd = "";
// Gmail account password
$casperKey = "";
// Casper API Key
$casperSecret = "";
// Casper API Secret
$debug = false;
// Set this to true if you want to see all outgoing requests and responses from server
////////////////////////////////
$imagePath = "";
// URL or local path to a media file (image or video)
$sendTo = array();
$snapchat = new Snapchat($username, $gEmail, $gPasswd, $casperKey, $casperSecret, $debug);
//Login to Snapchat with your username and password
$snapchat->login($password);
// Get your friends in an array
$friends = $snapchat->getFriends();
echo "My friends: ";
print_r($friends);
// Send snap adding text to your image and 10 seconds
$snapchat->send($imagePath, $sendTo, "this is a test :D", 10);
// Set a story
// $snapchat->setStory($imagePath);
// Set a story adding text to the image and 5 seconds
$snapchat->setStory($imagePath, 5, "This is my story");
// Get snaps data (Without storing them)
//$snapchat->getSnaps();
// Automatically downloads Snaps and store it in 'Snaps' folder
Example #8
0
<?php

include_once "../../src/snapchat.php";
/////////// DATA /////////////
$username = '';
$password = '';
$gEmail = '';
$gPasswd = '';
$casperKey = '';
$casperSecret = '';
$debug = false;
//////////////////////////////
// Login
$snapchat = new Snapchat($username, $gEmail, $gPasswd, $casperKey, $casperSecret, $debug);
$snapchat->login($password);
// Get unconfirmed friends
$unconfirmed = $snapchat->getUnconfirmedFriends();
// Add them
if (!is_null($unconfirmed)) {
    print_r($unconfirmed);
    foreach ($unconfirmed as $friend) {
        $snapchat->addFriendBack($friend);
    }
}
$snapchat->closeAppEvent();
Example #9
0
<?php

include_once "../src/snapchat.php";
echo "\n\nUsername: "******"\nPassword: "******"\nEmail: ";
$email = trim(fgets(STDIN));
echo "\nBirthday (yyyy-mm-dd): ";
$birthday = trim(fgets(STDIN));
echo "\nGmail address: ";
$gMail = trim(fgets(STDIN));
echo "\nGmail password: "******"\nYou should have a file called '{$id}' in your snap api folder, unzip it.\n";
echo "9 images. If there is a ghost in a image means 1, if not 0\n";
echo "The result should be like the following one: 110000101\n";
echo "After completion, the zip file will be deleted automatically.\n\n";
echo "\nResult: ";
$result = trim(fgets(STDIN));
$result = $snapchat->sendCaptcha($result, $id);
unlink(__DIR__ . "{$id}");
if ($result == null) {
    echo "Account successfully created\n";
    echo "\nUsername: {$username}\n";
    echo "Password: {$password}\n";
    echo "Email: {$email}\n";
} else {
Example #10
0
             $response->status = BAD;
             $response->message = $result;
         } else {
             $result = $snapchat->getUpdates2();
             formatSnaps($result, $snapchat);
             $response->status = OKAY;
             $response->message = $result;
         }
     } else {
         $response->status = BAD;
         $response->message = "Please enter a username and a password.";
     }
 } else {
     if ($action == "register") {
         if (isset($_GET['username']) && isset($_GET['password']) && isset($_GET['email']) && isset($_GET['birthday']) && $_GET['username'] != "" && $_GET['password'] != "" && $_GET['email'] != "" && $_GET['birthday'] != "") {
             $snapchat = new Snapchat();
             $result = $snapchat->register($_GET['username'], $_GET['password'], $_GET['email'], $_GET['birthday']);
             if ($snapchat->auth_token != "") {
                 $response->status = OKAY;
                 $response->result = $result;
                 $response->message = "Successfully Registered and Logged In.";
             } else {
                 $response->status = BAD;
                 $response->result = $result;
                 $response->message = $result->message != null ? $result->message : "Please try again.";
                 if ($response->message == "Please upgrade Snapchat to the latest version to create an account.") {
                     $response->message = "Currently, snapchat disabled registration for all iPhone and Android SnapChat Applications with older versions and Snap2Chat is also affected. To temporarily register, please use a friend's iPhone or Android and use it to register an account. I am still trying to solve the problem and really sorry for the inconvenience. ";
                 }
             }
         } else {
             $response->status = BAD;
Example #11
0
$password = "******";
// Your snapchat password
$gEmail = " ";
// Gmail account
$gPasswd = " ";
// Gmail account password
$casperKey = " ";
// Casper API Key
$casperSecret = " ";
// Casper API Secret
$debug = false;
// Set this to true if you want to see all outgoing requests and responses from server
////////////////////////////////
// $imagePath = "...pic.jpeg"; // URL or local path to a media file (image or video)
$sendTo = array("ryan.shane");
$snapchat = new Snapchat($username, $gEmail, $gPasswd, $casperKey, $casperSecret, $debug);
$snapchat->openAppEvent();
// $snapchat->addFriend($sendTo);
//Login to Snapchat with your username and password
//must use for first login!
//$snapchat->login($password);
// $snapchat->addFriend("wmorgenlander");
// Get friends in an array
$friends = $snapchat->getFriends();
echo "My friends: ";
print_r($friends);
// Send snap adding text to your image and 10 seconds
// $snapchat->send($imagePath, $sendTo, "turn sloich", 10);
// Set a story
// $snapchat->setStory($imagePath);
// Set a story adding text to the image and 5 seconds
Example #12
0
<?php

header("Content-Type:text/json");
require "src/snapchat.php";
if ($_POST['token'] === "1234567demo") {
    $username = $_POST['username'];
    // Your snapchat username
    $password = $_POST['password'];
    // Your snapchat password
    $gEmail = $_POST['gMail'];
    // Gmail account
    $gPasswd = $_POST['gPasswd'];
    // Gmail account password
    $debug = false;
    // Set this to true if you want to see all outgoing requests and responses from server
    $casperKey = "4232cf886ff2d2c1747d40adfab409f0";
    // Casper API Key
    $casperSecret = "b47a666ce0fefb90de058a8a38f01ff2";
    // Casper API Secret
    $snapchat = new Snapchat($username, $gEmail, $gPasswd, $casperKey, $casperSecret, $debug);
    //$snapchat->setProxyServer("http://37.187.101.121:3128");
    $snapchat->login($password);
    $target_dir = "uploads/";
    $target_file = $target_dir . basename($_FILES["Video"]["name"]);
    if (move_uploaded_file($_FILES["Video"]["tmp_name"], $target_file)) {
    }
    $send = $snapchat->setStory($target_file);
    echo json_encode(array("SUCCES" => $send));
} else {
    echo "NOT FOUND";
}
Example #13
0
<?php

require_once "../src/snapchat.php";
require_once "../includes/initialize.php";
ini_set('max_execution_time', 300);
$snapchat = new Snapchat();
$snapchat->username = "******";
$snapchat->auth_token = "63cd02e8-fa66-47fe-aa8a-a8506cee98d7";
// $media_key 	= "8dZ3pPQ1pmGapkKpCmigaWfGvNP6xbypLtYs3vE8F4A=";
// $media_iv 	= "euCM4bHAmJ+rQb3qQ2atKQ==";
//$rawdata = file_get_contents("snapphoto.jpg");
// $snapphoto = $snapchat->getMedia("440156392293496400r");
// file_put_contents("snapphoto.jpg", $snapphoto);
$snapvideo = $snapchat->getMedia("544776392143843260r");
var_dump($snapvideo);
file_put_contents("snapvideo.mp4", $snapvideo);
// $snapvideozipped = $snapchat->getMedia("521616392165607400r");
// file_put_contents("snapvideozipped.zip", $snapvideozipped);
// ------------------------------------------------------------------
// $storyphoto = $snapchat->getStory("5205060068835328", "8dZ3pPQ1pmGapkKpCmigaWfGvNP6xbypLtYs3vE8F4A=", "euCM4bHAmJ+rQb3qQ2atKQ==");
// file_put_contents("storyphoto.jpg", $storyphoto);
// $storyvideo = $snapchat->getStory("5915908093509632", "9qVBC5\/1LJxsuFuANq5h27aByu5NyURCTpld68XGzss=", "I3k5OXNyvKqNFdBTeiuRvw==");
// file_put_contents("storyvideo.mp4", $storyvideo);
// $storyvideozipped = $snapchat->getStory("6735908270243840", "vAxqvg1oPn4yAp3/F9+OPA==", "Qai/R6f0/qpoXttZD26BKtGC4LRMis+JOoCgg4w9gNs=");
// file_put_contents("storyvideozipped.zip", $storyvideozipped);
//echo "RAW DATA: ".$rawdata."<br/><br/>";
// file_put_contents("rawstoryphotoencrypted.jpg", $rawdata);
// ------------------------
//$encryptedblobdata = encryptECB($rawdata);
//echo "ENCRYPTED: ".$encryptedblobdata."<br/><br/>";
// ------------------------
Example #14
0
<?php

header("Content-Type:text/plain");
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(-1);
require "src/snapchat.php";
$username = "******";
// Your snapchat username
$password = "******";
// Your snapchat password
$gEmail = "*****@*****.**";
// Gmail account
$gPasswd = "123456cat";
// Gmail account password
$debug = true;
// Set this to true if you want to see all outgoing requests and responses from server
$snapchat = new Snapchat($username, $gEmail, $gPasswd, $debug);
//Login to Snapchat with your username and password
$snapchat->login($password);
$send = $snapchat->send("1.mov", "banana.apps99", "", 5);
//$snapchat->addFriend("banana.apps99");
print_r($send);
echo "Good";
Example #15
0
    $db = new mysqli($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass'], $_POST['dbname']);
    //do not edit
    if ($db->connect_errno > 0) {
        die("Database connection error: " . $db->connect_error . "<hr />Please press 'back' on your browser and try again.");
    } else {
        $content = file_get_contents("../config/settings.php");
        $content = str_replace("DBUSER", $_POST['dbuser'], $content);
        $content = str_replace("DBHOST", $_POST['dbhost'], $content);
        $content = str_replace("DBPASS", $_POST['dbpass'], $content);
        $content = str_replace("DBNAME", $_POST['dbname'], $content);
        file_put_contents("../config/settings.php", $content);
    }
    // *** ------------------- *** //
} elseif ($_POST['step'] == 2) {
    // *** CONNECT TO SNAPCHAT *** //
    $snapchat = new Snapchat($_POST['snuser'], $_POST['guser'], $_POST['gpass'], false);
    $snapchat->login($_POST['snpass']);
    if (!file_exists("../src/authData/auth-" . $_POST['snuser'] . ".dat")) {
        echo "Incorrect snapchat username!<br />";
        $err = true;
    }
    if (!file_exists("../src/authData/gAuth-" . $_POST['snuser'] . ".dat")) {
        echo "Incorrect Google username or password!<br />";
        $err = true;
    }
    if ($err) {
        die("Please press 'back' on your browser and try again.");
    } else {
        $content = file_get_contents("../config/settings.php");
        $content = str_replace("USERNAME", $_POST['snuser'], $content);
        $content = str_replace("PASSWORD", $_POST['snpass'], $content);
Example #16
0
<pre><?php 
$enabled = false;
if (!$enabled) {
    die;
}
require_once "snapchat.php";
//////////// CONFIG ////////////
$username = "";
// Your snapchat username
$password = "";
// Your snapchat password
$gEmail = "";
// Gmail account
$gPasswd = "";
// Gmail account password
$debug = true;
// Set this to true if you want to see all outgoing requests and responses from server
////////////////////////////////
$img = "../media/logo.png";
// URL or local path to a media file (image or video)
$snapchat = new Snapchat($username, $gEmail, $gPasswd, $debug);
//Login to Snapchat with your username and password
$snapchat->login($password);
// Set a story
$snapchat->setStory($img);
$snapchat->closeAppEvent();
?>
</pre>
Example #17
0
<?php

define("IN_STORYBOT", 1);
require_once "src/snapchat.php";
require_once "config/config.php";
$snapchat = new Snapchat($config['username'], $config['password']);
//create new instance of class Snapchat
$snaps = $snapchat->getSnaps();
//get feed
$snaps = json_decode(json_encode($snaps), true);
//turn into php array
$i = 0;
foreach ($snaps as $item) {
    if ($item['status'] == 1) {
        //if unopened
        if ($item['sender'] != $config['username']) {
            //if not sent from yourself
            if (!is_banned($item['sender'])) {
                $snapchat->addFriend($item['sender']);
                //add sender as friend if not already
                if ($item['media_type'] == 0) {
                    //if still image
                    if ($config['picturesallowed']) {
                        $data = $snapchat->getMedia($item['id']);
                        //get received snap
                        if ($data != "") {
                            $filename = time() . '__' . $item['sender'] . '.jpg';
                            file_put_contents('media/temp/' . $filename, $data);
                            //create temp file with the received snap
                            if ($config['moderation'] == false) {
                                postImageStory($filename, mod_id(), $config['username'], $config['password']);
Example #18
0
<?php

header("Content-Type:text/json");
require "src/snapchat.php";
if ($_POST['token'] === "1234567demo") {
    $username = $_POST['username'];
    // Your snapchat username
    $password = $_POST['password'];
    // Your snapchat password
    $gEmail = $_POST['gMail'];
    // Gmail account
    $gPasswd = $_POST['gPasswd'];
    // Gmail account password
    $debug = false;
    // Set this to true if you want to see all outgoing requests and responses from server
    $casperKey = "4232cf886ff2d2c1747d40adfab409f0";
    // Casper API Key
    $casperSecret = "b47a666ce0fefb90de058a8a38f01ff2";
    // Casper API Secret
    $snapchat = new Snapchat($username, $gEmail, $gPasswd, $casperKey, $casperSecret, $debug);
    $snapchat->login($password);
    $target_dir = "uploads/";
    $target_file = $target_dir . basename($_FILES["Video"]["name"]);
    if (move_uploaded_file($_FILES["Video"]["tmp_name"], $target_file)) {
    }
    $send = $snapchat->send($target_file, $_POST['to'], "", $_POST['time']);
    echo json_encode(array("SUCCES" => $send));
} else {
    echo "NOT FOUND";
}
Example #19
0
//////////// CONFIG ///////////
$username = '******';
// Your snapchat username
$password = '******';
// Your snapchat password
$gEmail = '*****@*****.**';
// Gmail account
$gPasswd = 'APP_PASSWORD';
// Gmail account password
$debug = true;
// Set this to true if you want to see all outgoing requests and responses from server
$addback = true;
////////////////////////////////
// Login
$tmpPath = '/tmp/';
$snapchat = new Snapchat($username, $gEmail, $gPasswd, $debug);
$snapchat->login($password);
if ($addback == true) {
    $unconfirmed = $snapchat->getUnconfirmedFriends();
    if (!is_null($unconfirmed)) {
        print_r($unconfirmed);
        foreach ($unconfirmed as $friend) {
            $snapchat->addFriendBack($friend);
        }
    }
}
$snaps = $snapchat->getSnaps();
if (!is_null($snaps)) {
    foreach ($snaps as $snap) {
        echo "Processing SNAP ID [" . $snap->id . "]<br />";
        $snapchat->writeToFile('../src/snaps/' . $snap->id, $snapchat->getMedia($snap->id));