Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SnapChat API "register" #19

Open
MartinMeijer1980 opened this issue May 1, 2014 · 72 comments
Open

SnapChat API "register" #19

MartinMeijer1980 opened this issue May 1, 2014 · 72 comments

Comments

@MartinMeijer1980
Copy link

Hello i am trying to add a new snapchat user through the API

I have made my self a form with:

  • Username
  • Password
  • Birthdate
  • Email

I'm sending the form and requesting the next code
$SC = new Snapchat;
getHtml::getTagP($SC->register($_POST['gebruiker'], $_POST['wachtwoord'], $_POST['email'], $_POST['geboortedatum']));

I have puted random in that function an echo with text and found out that it stops at the next line of code (rule 190)
if (!isset($result->token))
{
return FALSE;
}

Now is my next question...

  • what do i need to configure in this script? (to let it work with the domain of my customer)
  • How can u really add a new user?

Sorry for my questions, but i couldn't find much information regarding this

Kind regards,
Martin Meijer

@JorgenPhi
Copy link
Owner

This current version does not have capacha solving built in, which is what
I believe is the problem. Try looking at one of the forks, maybe someone
has figured it out. :)
On May 1, 2014 8:25 AM, "MartinMeijer1980" [email protected] wrote:

Hello i am trying to add a new snapchat user through the API

I have made my self a form with:

  • Username
  • Password
  • Birthdate
  • Email

I'm sending the form and requesting the next code
$SC = new Snapchat;
getHtml::getTagP($SC->register($_POST['gebruiker'], $_POST['wachtwoord'],
$_POST['email'], $_POST['geboortedatum']));

I have puted random in that function an echo with text and found out that
it stops at the next line of code (rule 190)
if (!isset($result->token))
{
return FALSE;
}

Now is my next question...

  • what do i need to configure in this script? (to let it work with the
    domain of my customer)
  • How can u really add a new user?

Sorry for my questions, but i couldn't find much information regarding this

Kind regards,
Martin Meijer


Reply to this email directly or view it on GitHubhttps://github.com//issues/19
.

@MartinMeijer1980
Copy link
Author

Euhm... how do you mean this? The request can't past the captcha controller of snapchat...

So if i'm right... i can skip this one and look to it later?

And the uri in the file "snapchat_agent.php" on line 25

Its pointing to "URL = 'https://feelinsonice-hrd.appspot.com/bq';" do i need to keep it like that or do i need to make an own link?

PS: Tanks for your fast reply

Kind regards,
Martin Meijer

@dprogramming
Copy link

You have to keep that URL

@MartinMeijer1980
Copy link
Author

Thank you

This is helping me out on this way!

@dprogramming
Copy link

You're welcome. What do you mean with this: "Euhm... how do you mean this? The request can't past the captcha controller of snapchat...

So if i'm right... i can skip this one and look to it later?"?

@MartinMeijer1980
Copy link
Author

Well i can't register a new user for snapchat with this API, its returning nothing

Jorgen told that "This current version does not have capacha solving built in" (i believe he is meaning captcha)

So i'm looking for a way to work around this so i can make new accounts at Snapchat with the api

Sorry that i'm not alway's clear (just a dutchman overhere :P)

@dprogramming
Copy link

No problem :P I'm from Belgium so... :)
Yes, he's meaning captcha, that's not included in this project, you'll have to look for it in another fork or project or create your own implementation. I'm looking for it too, so if you have found a way around, let me know ;)

@MartinMeijer1980
Copy link
Author

Ok, thanks!

Than i will first go on with the other functions

If i'm ready with that i will look again to solve the register with captcha working

I will post it overhere

Kind regards,
Martin Meijer

@dprogramming
Copy link

Great! If you have a question, just post/ask it!

Follow me on Twitter - @LenaertsDaan

@JorgenPhi
Copy link
Owner

Sorry for not being clearer and for the typo. I am commenting on my phone
in class. Let us know if you have any more questions!
On May 1, 2014 8:46 AM, "dprogramming" [email protected] wrote:

Great! If you have a question, just post/ask it!

Follow me on Twitter - @LenaertsDaan


Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-41910927
.

@MartinMeijer1980
Copy link
Author

Does someone gets this, it looks like they are explaining how to get a work around

http://www.hakobaito.co.uk/b/bypassing-snaptcha

Can someone verrifie this for me?

Again thanks

@dprogramming
Copy link

Hello, this looks a solution to me, I did not test it but I think it's a working solution. It's written by Hako, he has a fork of this repository so... - https://github.com/hako/php-snapchat/ - I don't have time to test it right now but if you do, please post your results here...

Thanks

@MartinMeijer1980
Copy link
Author

I'm busy with it now, and have seen that it's still not verry easy

In first he needs now a header.txt

There are only a few new classes in the fork of Hako

This is the code that i'm testing now

    $SC     = new Snapchat();
    $SC->register($_POST['gebruiker'], $_POST['wachtwoord'], $_POST['email'], $_POST['geboortedatum']); 

    $captcha_id = $SC->getCaptcha($_POST['email']);
    // Im not getting an Captcha id... maybe its because the user isn't registering
    echo "captcha? - ".$captcha_id;

    // This is a strange one, i dont get this. I also have an error on this one
    // Warning: fgets() expects parameter 1 to be resource, string given in 
    $solution = fgets(STDIN); // Solution is in binary.

    $SC->sendCaptcha($username, $captcha_id, $solution);

I will keep on testing, but if someone has some time to also look into it, i would appriciate that!

So i have my script like they are telling me on this site (http://www.hakobaito.co.uk/b/bypassing-snaptcha)

But i'm not even getting the first post /bg/register like that... so thats my first problem. Could there be an other reason that i'm not getting the information back like they are telling

Thanks again for your time

Kind regards,
Martin Meijer

@MartinMeijer1980
Copy link
Author

Ok its working, i have triggerd some errors in snapchat_agent.php on line 260 is $result = curl_exec($ch);

This contains important information why there something wrong with the post, the password needs to be 8 chars at least and for the rest it works fine :)

Maybe an errorhandler wouldn't be difficult to make...

I now need to work on an other project, i will go further later this day with this script.

Thanks again and if you have questions let me know

Kind regards
Martin Meijer

@dprogramming
Copy link

Great, I would want to help you but unfortunately I'm still busy :/ keep us updated..

Thanks

@hako
Copy link
Collaborator

hako commented May 2, 2014

@MartinMeijer1980 Did you get it working? I've been kind of busy with some uni work thus unable to update the php-snapchat fork.

Also the captcha_id is only obtained through the dumped headers.txt. (For some reason snapchat sends 401 UNAUTHORIZED if you request the headers.)

@MartinMeijer1980
Copy link
Author

@hako i had deleted my snapchat account, i got all the request on the proper way

So after i have registerd my self (i'm not getting an email or sms text so i know it went good). But i have logged in at snapchat site with the emailadress and given password and it worked like a charm

i can't login with the given username only with the given email

so it is possible to register, only the error handling is not given a nice message back, so i need to make that one for my self. And maybe i'm going to make in my script a mail with the information about snapchat

If you have any questions let me know

Kind regards,
Martin

@dprogramming
Copy link

Hello again, did you get it working? If so it would be very helpful if you would post your final code here.

Thanks

@MartinMeijer1980
Copy link
Author

@dpprogramming it's partial working... i have also downloaded the new fork of Hako

Now i can register a user but....

After i register my self a new account, i only can login on the website of Snapchat but not at the SnapChat app on my Android phone

At the first time it wasn't possible to use the given username (not the email) to login i got a message that the account didn't exists.

Now with the new update in the fork of Hako it's possible to use the username, i can login the website of snapchat. But if i whant to login into snapchat on my android phone it sais "Invalid Account"

I have the feeling that i need to send a SMS to the snapchat phonenumber? At least i can find something like that to do?

Can someone help me to pass this one?

Im going to make a class thats also handeling errors

@MartinMeijer1980
Copy link
Author

I have a code what's the return messages of register_username

Array
(
[birthday] => 1980-07-18
[number_of_best_friends] => 3
[logged] => 1
[story_privacy] => FRIENDS
[username] => martin1980nl1
[can_see_custom_stories] => 1
[name] => martin1980nl1
[display] => Team Snapchat
[snap_p] => 1
[mobile_verification_key] => MjE3NzptYXJ0aW4xOTgwbmwx
[0] => martin1980nl1
[notification_sound_setting] => OFF
[snapchat_phone_number] => +31636465228
[auth_token] => 2713bddd-204b-480a-ad31-354a4a646c33
[current_timestamp] => 1399452793953
[email] => [email protected]
[title] => Content Warning
[message] => The red exclamation mark on this Story indicates that Stories posted by this user may not be suitable for sensitive viewers. Do you wish to continue? After selecting 'Yes', you will never be prompted again.
[yes_text] => Yes
[no_text] => No
[1] => teamsnapchat
[last_interaction_ts] => 1399447288635
[sn] => teamsnapchat
[t] => 10
[timer] => 10
[id] => 175103399447288211r
[st] => 1
[ts] => 1399447288211
[sts] => 1399447288211
[payload] => eyJ1c2VybmFtZSI6Im1hcnRpbjE5ODBubDEiLCJ0aW1lc3RhbXAiOjEzOTk0NTI3OTM4OTR9
[mac] => D2B9GG_oHT4IfbgT6IdfqxXG09cXH1tWVNOAWhMxUVQ=
[type] => needs_captcha
[text] => Welcome to chat! �
[chat_message_id] => 1799b615-82f9-4229-953d-4eff87ddcd04
[seq_num] => 1
[timestamp] => 1399447288632
[from] => teamsnapchat
[conv_id] => martin1980nl1~teamsnapchat
[iter_token] => {"teamsnapchat":2}
[teamsnapchat] => 4
[last_writer] => teamsnapchat
[last_write_timestamp] => 1399447288635
[last_write_type] => text
[gateway_server] => 108.59.85.17:443
[background_fetch_secret_key] => PqiXToE2RPJ+SKLpho1LALnvaOYh82rgd6IgekRRErs=
[prompt] => Select all images containing a ghost.
)

@MartinMeijer1980
Copy link
Author

Now i see that there is standing an old phonenumber of my in the results...

How does they become to my number? It's in this case not a good one!

Kind regards

@MartinMeijer1980
Copy link
Author

Even when i use a new emailaddress the request is still getting an old phonenumber of mine... how the * is this possible... i can't find annything whats pointing to that number... verry strange

Some ideas?

@dprogramming
Copy link

That's very strange, maybe it helps if you clear your cache, but I doubt. Do you only use a different email address? Or are there other things the same? Can't you still not sign in on the official updated Android app?

@MartinMeijer1980
Copy link
Author

Hello,

If you read my posts right... while registering to snapchat with the fork of Hako it's filling in my old phonenumber

My first question is where does he get that phonenumber from? Because it's an old one

I assume when it's registerd an account with an old phonenumber that it's impossible to login to snapchat at my phone with an other phonenumber

I also asume you need to get a text message to activate the account and to verrifie the phonenumber

I need some more information about these steps

@dprogramming
Copy link

Normally it should be possible to sign in with another account in the Android app. But I don't think you should get a text message on your phone, at least in the previous versions. Maybe that's changed now, I don't know for sure. Have you tried removing and reinstalling the Snapchat app on your phone?
But in your code you never mention your phone number? And while registering it is getting your old phone number?

@JorgenPhi
Copy link
Owner

Your account type is [type] => needs_captcha which is why you cannot login
with it.

Hello,

If you read my posts right... while registering to snapchat with the fork
of Hako it's filling in my old phonenumber

My first question is where does he get that phonenumber from? Because it's
an old one

I assume when it's registerd an account with an old phonenumber that it's
impossible to login to snapchat at my phone with an other phonenumber

I also asume you need to get a text message to activate the account and to
verrifie the phonenumber

I need some more information about these steps


Reply to this email directly or view it on
GitHubhttps://github.com//issues/19#issuecomment-42417237
.

@dprogramming
Copy link

Ooh you didn't solve the captcha? @MartinMeijer1980

@MartinMeijer1980
Copy link
Author

@JorgenPhi

I thought it was a working fork...

How do i need to solve this? Is there only a problem with registering accounts?

The strange is i have made an account, because i can login with the emailaddress of the new account into http://snapchat.com i assume tha account has been made OK. Only thing thats not correspending is my phonenumber in the array that i'm getting back.

So if there is a documentation of SnapChat them self i would appriciate that, maybee i can figure more things out.

@dpprogramming Thats true there is standing a verry old phonenumber of mine (JorgenPhi could have been right... but still i want first the phonenumber ok otherwise i cant test this issue)

Kind regards

@dprogramming
Copy link

Snapchat doesn't have a documentation, they even don't have an official public API. You'll have to use the captcha to be able to create an account. They don't use captchas that long. Maybe they didn't change their online sign in system to be working without the captcha registration.?

@JorgenPhi
Copy link
Owner

The other fork has a method to solve captchas, but does not solve it
automatically. You still need to download the captcha image, read it, and
then push the solution.
On May 7, 2014 7:50 AM, "dprogramming" [email protected] wrote:

Snapchat doesn't have a documentation, they even don't have an official
public API. You'll have to use the captcha to be able to create an account.
They don't use captchas that long. Maybe they didn't change their online
sign in system to be working without the captcha registration.?


Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-42422407
.

@MartinMeijer1980
Copy link
Author

@hako i have edited the request from /solve_cpatcha i have edit it with bq/ in front of it

Still no download

  • About to connect() to feelinsonice-hrd.appspot.com port 443 (#0)
  • Trying 74.125.136.141...
  • connected
  • Connected to feelinsonice-hrd.appspot.com (74.125.136.141) port 443 (#0)
  • successfully set certificate verify locations:
  • CAfile: /etc/pki/tls/certs/ca-bundle.crt
    CApath: none
  • SSL connection using RC4-SHA
  • Server certificate:
  • subject: C=US; ST=California; L=Mountain View; O=Google Inc; CN=*.appspot.com
  • start date: 2014-04-23 12:07:32 GMT
  • expire date: 2014-07-22 00:00:00 GMT
  • subjectAltName: feelinsonice-hrd.appspot.com matched
  • issuer: C=US; O=Google Inc; CN=Google Internet Authority G2
  • SSL certificate verify ok.

POST /bq/solve_captcha HTTP/1.1
User-Agent: Snapchat/5.0.3 (Nexus 5; Android 19; gzip)
Host: feelinsonice-hrd.appspot.com
Accept: /
Content-Length: 166
Content-Type: application/x-www-form-urlencoded

  • upload completely sent off: 166 out of 166 bytes
    < HTTP/1.1 400 Bad Request
    < Content-Type: text/html; charset=utf-8
    < X-Snapchat-Jobs: Work with us, make Snapchat even better! -- Visit http://bit.ly/sc-job -- Mention this header for bonus points.
    < Vary: Accept-Encoding
    < Date: Wed, 07 May 2014 14:57:18 GMT
    < Server: Google Frontend
    < Cache-Control: private
    < Alternate-Protocol: 443:quic
    < Transfer-Encoding: chunked
    <
  • Connection #0 to host feelinsonice-hrd.appspot.com left intact
  • Closing connection Logging in #10

The $captcha_id is also false... so there must be an other solution to work around this

@MartinMeijer1980
Copy link
Author

I cant connect to this link, if this is not going to work than it's impossible to add an account (thats my feeling)

@hako
Copy link
Collaborator

hako commented May 7, 2014

What do you mean no download? Do you mean the .zip captcha file?

@MartinMeijer1980
Copy link
Author

Or i have the wrong data given through (that is causing the 400 Bad Request and why i dont get the download)

First i must solve the Captcha it keeps givin false in stead of username~digits

The second problem is with the header.txt that i'm having a 400 bad request

@hako
Copy link
Collaborator

hako commented May 7, 2014

I tested my fork on ubuntu and was able to download the captcha zip, what OS are you using?

@dprogramming
Copy link

I'm getting false too, when using your example on your github fork. I tested on Windows using Xampp server. @hako

@hako
Copy link
Collaborator

hako commented May 9, 2014

Not sure if it could be SSL or not, try adding this line:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

To the snapchat_agent.php file in the post method.

@dprogramming
Copy link

That seems to work, I'll do some further tests, I'll keep y'all updated...

@dprogramming
Copy link

@hako , really thanks this does indeed work, the file gets downloaded correctly and the headers.txt file gets generated too. I only have one question, how can I send back the captcha solution that the user has selected? - Thanks

@hako
Copy link
Collaborator

hako commented May 9, 2014

You save the solution in a $solution variable (can be like 010001010)

eg, $solution = fgets(STDIN);

then send it off.

 $s->sendCaptcha($solution, $captcha_id, $username);

In the users perspective, for example you could create an array holding 9 0's by default then when the user selects a image with a ghost, one of those 0's should flip to 1.

The only issue is that when you send it (even though the captcha is perfect), Snapchat usually sends back HTTP 403 Forbidden and I don't know why.

@dprogramming
Copy link

Oh, so if I get it it's currently not yet possible to sign up?

@dprogramming
Copy link

@hako Noticed it too, I get a 403 error too.

@dprogramming
Copy link

@hako I was thinking about it and I saw that when registering a new user we get a new zip file with captchas, Right after the solution gets sent the solution gets sent (in the example) but when filling in the solution, it's the solution of the first zip, not the newly downloaded one..? #JustGuessing

@hako
Copy link
Collaborator

hako commented May 9, 2014

@dprogramming Really? I don't think I noticed that, but thats the only problem the 403. I've signed an account using the real app and checked the headers, cookies URL encoding and I'm not sure whats missing.

@dprogramming
Copy link

capture
@hako Like on this image, the first zip file is made when registering. The second when running again.
So, I mean this: (because after reading my previous comment it looks like I made some typos and I don't think it was stated clearly :-) )

  1. Run the registration functions (register($email,$password,$birthday); and register_username($email, $username);)
  2. Get the captcha (getCaptcha($username, true);), The captcha gets downloaded
  3. Solve the captcha manually and fill in the $solution value
  4. Run the script again with the $solution filled in
  5. There gets downloaded a new zip file with new captcha images

This seems obvious to me, I'm not sure if you're doing it like that, but when doing it like stated above you should set the $solution value with the solution value of the newly downloaded captcha and not the old one like in step 2.

@hako
Copy link
Collaborator

hako commented May 9, 2014

I'll give this a shot but could this be why the 403's keep appearing?

@dprogramming
Copy link

I think this can be a possible problem because every time the Snapchat API sends out a new zip file with a new captcha and thus a new solution. When sending a wrong solution maybe the Snapchat server reacts by sending a 403 error? What does the official app respond when selecting wrong captcha images?

@hako
Copy link
Collaborator

hako commented May 9, 2014

403

@dprogramming
Copy link

Then this can very well be the problem, don't you guess?

@hako
Copy link
Collaborator

hako commented May 9, 2014

Ack, @dprogramming I'm still getting 403, this is what I'm doing:

  1. Run the script
  2. Run the Register and register_username functions
  3. Get the captcha
  4. Manually solve the captcha
    403.

Are you telling me that I have to save the first solution value for the second time I run getCaptcha?

@dprogramming
Copy link

@hako no, I think that's the thing that's going wrong. What do you do after step 4? Do you run the script again but now with the first solution value filled in?

@hako
Copy link
Collaborator

hako commented May 9, 2014

After I get the 403 from the first try, I rerun the script with the first solution and still get 403.

Did you test this?

@dprogramming
Copy link

@hako That's exactly what I mean, when rerunning the script with the first solution you get 403. We should do this:

  • Get the zip with captcha
  • Solve the captcha manually
  • Send the solution without requesting a new zip file and thus a new solution

@hako
Copy link
Collaborator

hako commented May 9, 2014

Ok, I've created a separate file for sendCaptcha and getCaptcha (without requesting a new zip file)

I ran getCaptcha once and got the zip
I typed in manually the captcha
I send the solution without requesting another zip file

And now I get a 401 Unauthorized.

@dprogramming
Copy link

Maybe it has something to do with the authentication key? Maybe you need to have the same key when creating the username, requesting the zip etc. as when sending the solution?

@dprogramming
Copy link

At least the changes you made make clear that this was an issue too... I guess

@dprogramming
Copy link

@hako Have you already found what's wrong?

Thanks

@dprogramming
Copy link

@hako already a solution?

@Snowlav
Copy link

Snowlav commented Feb 19, 2015

Very old topic but I'm going to reply anyway,
I have the same phone number when sniffing /loq/register_username.
And I am from Holland as well.
+31636465228

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants