Này người xa lạ!

Còn chờ gì nữa mà không mau đăng nhập hoặc đăng ký để cùng tham gia thảo luận với cộng đồng!

Automatically Modify Post Data/Parameter(s)

Im wondering if someone can write a script that would allow me or other users to edit the script in order to automatically change post data like you can do in Tamper Data. Tamper Data is manual though I would really like to see an automatic one which is why I am here :)

Bình luận

  • What is "the script"?
    What site are you requesting this script for? All of them?
  • Qon nói:

    What is "the script"?
    What site are you requesting this script for? All of them?

    I want it for just any site really (i can edit it) if you are considering taking up the challenge you could just try making a script for live.com and just make it so it can replace one of the post values.
  • QonQon
    đã sửa July 2015 Firefox
    // ==UserScript==
    // @name        Thingy
    // @description Makes stuff happen.
    // @namespace   https://greasyfork.org/en/users/11891-qon
    // @include     *
    // @grant       none
    // ==/UserScript==
    
    window.addEventListener('click', catchEvent) // it catches all the clicks which isn't necessary but it works...
    
    function catchEvent(ev) {
      // check that its an input submit box
      if(ev.target.tagName == 'INPUT' && ev.target.type == 'submit') {
        var sub = ev.target
        //find the form tag that contains the submit button you clicked
        var form = sub.parentNode
        while(form != null && form.tagName != 'FORM') {
          form = form.parentNode
        }
        if(form.tagName == 'FORM'){
          var inputs = form.getElementsByTagName('input')
          var s = ''
          // check all input boxes
          for(input of inputs) {
            s += 'type: ' + input.type + '  id: ' + input.id + '  value: ' + input.value + '\n'
            // change the values of it's the email or password field
            if(input.type=='email') {
              input.value='hello@hotmail.com'
            }
            if(input.type=='password') {
              input.value='p455w0rd'
            }
          }
          alert(s) // display all input fields in the form
        }
      }
    }
    

    This changes the email field to 'hello@hotmail.com' and password field to 'p455w0rd'. Was it something like this you wanted? Should work on most sites but tested on login.live.com. Anything that has a submit button in a form and where the email and password fields have the correct type set should work.

  • It might be better to use document.addEventListener('submit', catchEvent) to also process submits triggered by pressing the Enter key.

  • QonQon
    đã sửa July 2015 Firefox
    @wOxxOm But click does catch submits with enter. At least in firefox.

    And yes the qode could be prettier. That can be an exercise for Rav_n q:
Đăng nhập hoặc Đăng ký để gửi bình luận.