토론 » 제작 요청

Automatically Modify Post Data/Parameter(s)

§
게시: 2015-07-26

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 :)

Qon
§
게시: 2015-07-26

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

§
게시: 2015-07-26
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.

Qon
§
게시: 2015-07-26
수정: 2015-07-26

// ==UserScript== // @name Thingy // @description Makes stuff happen. // @namespace https://greasyforks.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='[email protected]'
        }
        if(input.type=='password') {
          input.value='p455w0rd'
        }
      }
      alert(s) // display all input fields in the form
    }
  }
}

This changes the email field to '[email protected]' 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.

woxxom관리자
§
게시: 2015-07-26

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

Qon
§
게시: 2015-07-26
수정: 2015-07-26

@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:

답글 게시

답글을 게시하려면 로그인하세요.

长期地址
遇到问题?请前往 GitHub 提 Issues。