Advertisement
fortin

pastebin-user-keygen.php

Mar 8th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1. #!/usr/bin/php
  2. // This script generates and returns a Pastebin session key. For use with alfred-pastebin.php and the Pastebin Workflow for Alfred (OS X).
  3.  
  4. <?php
  5. $pastebin_pwd       = shell_exec('security find-internet-password -wl "[KEYCHAIN PASTEBIN PWD]" | tr -d "\\n"');
  6. $api_dev_key        = shell_exec('security find-generic-password -wl "[KEYCHAIN DEV KEY]" | tr -d "\\n"');
  7. $api_user_name      = '[PASTEBIN USERNAME]';   
  8. $api_user_name      = urlencode($api_user_name);
  9. $api_user_password  = urlencode($pastebin_pwd);
  10. $url                = 'https://pastebin.com/api/api_login.php';
  11. $ch                 = curl_init($url);
  12.  
  13. curl_setopt($ch, CURLOPT_POST, true);
  14. curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_dev_key='.$api_dev_key.'&api_user_name='.$api_user_name.'&api_user_password='.$api_user_password.'');
  15. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  16. curl_setopt($ch, CURLOPT_VERBOSE, 1);
  17. curl_setopt($ch, CURLOPT_NOBODY, 0);
  18.  
  19. $response           = curl_exec($ch);
  20. echo $response;
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement