简体   繁体   中英

Paste returns of a javascript function into Excel (dictionary “attack”)

I have a Website that use a javascript function to validate a 5 characters text.

The HTML code is like this:

<p class="form-control-static ret">
            Input your Text:
            <input type="text" name="text_input" id="text_input" maxlength="5" value="">
            <button class="validate-button" id="btn">Check!</button>
          </p> 

<script type="text/javascript">
              $(document).ready(function(){
                $("#btn").click(function(e){ 
                  e.preventDefault();
                  location.href = "https://www.url_here?sc=" + $('#text_input').val();
                });
              });
              </script>

The 5 characters text goes directly in the URL.

Examples:

https://www.url_here?sc=ABCDE

https://www.url_here?sc=ATTEF

Is is possible to make a Macro on Excel that try all URls with the given options and paste in a Spread sheet the texts that returned True?

Or, does it have an easiest way to do that?

All i need is an automatically dictionary "attack".

You need a remote controllable application to make http requests. I'd recommend the command line tool "wget".

Then write a VBA-script that reads the lines in excel and calls "wget" each time.

If you want more options, you could have a look to the complex and sophisticated tool "JMeter".

26^5 = 11881376 (only counting CAPITAL LETTERS), so your site would have to address this many service calls if you want to do it this way.

If you want to test this, I would refactor the server side code, separate the validation function, and call it internally with a key generator.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM